1.加載圖片
創(chuàng)新互聯(lián)專注于西吉企業(yè)網(wǎng)站建設,成都響應式網(wǎng)站建設公司,成都做商城網(wǎng)站。西吉網(wǎng)站建設公司,為西吉等地區(qū)提供建站服務。全流程按需搭建網(wǎng)站,專業(yè)設計,全程項目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務#include "stdafx.h" #include "highgui.h" #includeusing namespace std; using namespace cv; int main( int argc, char** argv ) { IplImage* img = cvLoadImage("lena.jpg");//加載圖片 cvNamedWindow("Example1", CV_WINDOW_AUTOSIZE ); cvShowImage("Example1", img ); cvWaitKey(0); cvReleaseImage( &img ); cvDestroyWindow("Example1"); }
2.加載視頻
#include "stdafx.h" #include "highgui.h" #includeusing namespace std; using namespace cv; int main( int argc, char** argv ) { cvNamedWindow( "Example2", CV_WINDOW_AUTOSIZE ); //CvCapture* capture = cvCaptureFromAVI( argv[1] ); // either one will work CvCapture* capture = cvCreateFileCapture("E:\\視頻素材\\aaa.avi"); IplImage* frame; while(1) { frame = cvQueryFrame( capture ); if( !frame ) break; cvShowImage( "Example2", frame ); char c = cvWaitKey(33); if( c == 27 ) break; } cvReleaseCapture( &capture ); cvDestroyWindow( "Example2" ); }