RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
OpenCV应用实例

1.加载图片

创新互联公司成立10年来,这条路我们正越走越好,积累了技术与客户资源,形成了良好的口碑。为客户提供网站设计制作、网站建设、网站策划、网页设计、主机域名、网络营销、VI设计、网站改版、漏洞修补等服务。网站是否美观、功能强大、用户体验好、性价比高、打开快等等,这些对于网站建设都非常重要,创新互联公司通过对建站技术性的掌握、对创意设计的研究为客户提供一站式互联网解决方案,携手广大客户,共同发展进步。

#include "stdafx.h"
#include "highgui.h" 
#include 
using 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" 
#include 
using 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://sczitong.cn/article/ppiddp.html