OpenCV应用实例-创新互联
1.加载图片
创新互联专注于西吉企业网站建设,成都响应式网站建设公司,成都做商城网站。西吉网站建设公司,为西吉等地区提供建站服务。全流程按需搭建网站,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务#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" ); }
文章标题:OpenCV应用实例-创新互联
网站网址:http://hbruida.cn/article/jsopc.html