当前位置:编程学习 > C/C++ >>

画矩形

//画矩形

 
#include "stdafx.h"   
#include "highgui.h"   
#include "cv.h"   
  
int _tmain(int argc, _TCHAR* argv[])  
{  
    cvNamedWindow("ShowImage", CV_WINDOW_AUTOSIZE);  
  
    //创建100*100矩阵,并置零   
    IplImage* image= cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 3);  
    cvZero(image);    
  
   cvRectangle(image, cvPoint(10, 10), cvPoint(60, 60), cvScalar(0, 255, 0), 1);  
     
   cvShowImage("ShowImage", image);  
  
   cvWaitKey(0);  
  
   cvReleaseImage(&image);  
   cvDestroyWindow("ShowImage");  
  
   return 0;  
}  

#include "stdafx.h"
#include "highgui.h"
#include "cv.h"

int _tmain(int argc, _TCHAR* argv[])
{
	cvNamedWindow("ShowImage", CV_WINDOW_AUTOSIZE);

	//创建100*100矩阵,并置零
	IplImage* image= cvCreateImage(cvSize(100, 100), IPL_DEPTH_8U, 3);
	cvZero(image);  

   cvRectangle(image, cvPoint(10, 10), cvPoint(60, 60), cvScalar(0, 255, 0), 1);
   
   cvShowImage("ShowImage", image);

   cvWaitKey(0);

   cvReleaseImage(&image);
   cvDestroyWindow("ShowImage");

   return 0;
}


 

补充:软件开发 , C++ ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,