opencv程序

时间:2017-11-13 14:46:23
【文件属性】:

文件名称:opencv程序

文件大小:1003B

文件格式:CPP

更新时间:2017-11-13 14:46:23

视屏播放

一个简单的基于opencv视屏播放程序 #include "cv.h" #include "highgui.h" int g_slider_positon = 0; CvCapture* g_capture = NULL; void onTrackbarSlide(int pos){ cvSetCaptureProperty( g_capture, CV_CAP_PROP_POS_FRAMES, pos ); } int main(int argc, char** argv){ cvNamedWindow("Example", CV_WINDOW_AUTOSIZE); CvCapture* g_capture = cvCreateFileCapture(argv[1]); int frames = (int)cvGetCaptureProperty( g_capture, CV_CAP_PROP_FRAME_COUNT ); if (frames != 0){ cvCreateTrackbar( "position", "Example", &g_slider_positon, frames, onTrackbarSlide ); } IplImage* frame;//最简单播放视频 while (1) { frame = cvQueryFrame(g_capture); if (!frame)break; cvShowImage("Example", frame); char c = cvWaitKey(33); if (c == 27)break; } cvReleaseCapture(&g_capture); cvDestroyWindow("Example"); return (0); }


网友评论