//畫矩形
#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; }