#include "stdafx.h"
#include <opencv.hpp>
using namespace cv;
int g_slider = 0;
CvCapture* g_capture = NULL;
void onTrack(int pos) {
cvSetCaptureProperty(g_capture, CV_CAP_PROP_POS_FRAMES, pos);
}
int main()
{
cvNamedWindow("1", CV_WINDOW_AUTOSIZE);
//IplImage* img = cvLoadImage("H:\\picture\\opencv\\01.mp4");
g_capture = cvCreateFileCapture("H:\\picture\\opencv\\01.mp4");
int frames = (int)cvGetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_COUNT);
if (frames != 0) {
cvCreateTrackbar("position", "1", &g_slider, frames, onTrack);
}
IplImage* frame; //帧
while (1) {
frame = cvQueryFrame(g_capture);
if (!frame) break;
cvShowImage("1", frame);
char c = cvWaitKey(33);
if (27 == c) break;
}
cvReleaseCapture(&g_capture);
cvDestroyWindow("1");
return 0;
}
创建简单播放器滚动条
最新推荐文章于 2021-12-08 09:50:56 发布