Learning OpenCV: read video and add onTrackSlider
来源:互联网 发布:大数据的教育弊端 编辑:程序博客网 时间:2024/06/08 10:03
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
#include "cv.h"
#include "highgui.h"
int g_slider_position = 0;
CvCapture * g_capture = NULL;
void onTrackbarSlide(int pos)
{
cvSetCaptureProperty(g_capture,CV_CAP_PROP_POS_FRAMES,pos);
}
int main(void)
{
cvNamedWindow("video",CV_WINDOW_AUTOSIZE);
g_capture = cvCreateFileCapture("E:\\test\\fish1.avi");
int frames = (int)cvGetCaptureProperty(g_capture,CV_CAP_PROP_FRAME_COUNT);
if(frames != 0)
{
cvCreateTrackbar("position","video",&g_slider_position,frames,onTrackbarSlide);
}
IplImage * frame = NULL;
if(g_capture == NULL)
{
cout<<"read video file error!"<<endl;
}
while(1)
{
frame = cvQueryFrame(g_capture);
if(frame == NULL)
{
break;
}
cvShowImage("video",frame);
char c = cvWaitKey(33);
if(c == 27)
{
break;
}
}
cvReleaseCapture(&g_capture);
g_capture = NULL;
cvDestroyWindow("video");
return 0;
}
#include <iostream>
#include <fstream>
using namespace std;
#include "cv.h"
#include "highgui.h"
int g_slider_position = 0;
CvCapture * g_capture = NULL;
void onTrackbarSlide(int pos)
{
cvSetCaptureProperty(g_capture,CV_CAP_PROP_POS_FRAMES,pos);
}
int main(void)
{
cvNamedWindow("video",CV_WINDOW_AUTOSIZE);
g_capture = cvCreateFileCapture("E:\\test\\fish1.avi");
int frames = (int)cvGetCaptureProperty(g_capture,CV_CAP_PROP_FRAME_COUNT);
if(frames != 0)
{
cvCreateTrackbar("position","video",&g_slider_position,frames,onTrackbarSlide);
}
IplImage * frame = NULL;
if(g_capture == NULL)
{
cout<<"read video file error!"<<endl;
}
while(1)
{
frame = cvQueryFrame(g_capture);
if(frame == NULL)
{
break;
}
cvShowImage("video",frame);
char c = cvWaitKey(33);
if(c == 27)
{
break;
}
}
cvReleaseCapture(&g_capture);
g_capture = NULL;
cvDestroyWindow("video");
return 0;
}
0 0
- Learning OpenCV: read video and add onTrackSlider
- Learning OpenCV: read AVI video file
- Learning OpenCV: read video from Camera
- Learning OpenCV: cvPyrDown and display video
- Learning OpenCV : read and display a picture
- OpenCV read video
- Machine Learning and Data Mining Course/Video
- Deep Learning for Video Classification and Captioning
- Learning OpenCV:cvCvtColor and cvCanny
- Python&OpenCV - 读写(read&write)视频(video) 详解 及 代码
- Python OpenCV read Video write image to disk
- Learning OpenCV: cvCreateVideoWriter to save AVI video file
- 《Unsupervised Learning of Depth and Ego-Motion from Video》读书笔记
- algorithms learning and what i've read today
- Note for video Machine Learning and Data Mining——The Learning Problem
- Note for video Machine Learning and Data Mining——learning is feasible
- test add youku video
- Note for video Machine Learning and Data Mining——error and noise
- 145. Binary Tree Postorder Traversal
- Mysql 性能优化
- PETS-ICVS Datasets 数据集
- UITabelView分组样式时如何调整组之间的间距
- 211. Add and Search Word - Data structure design【M】【91】
- Learning OpenCV: read video and add onTrackSlider
- 关于图像对比度【5】——局部自适应对比度调整
- hibernate处理懒加载异常的方法
- Codeforces Round #317 [AimFund Thanks-Round] (Div. 2)A Arrays
- 人脸和手势识别数据集 FGnet - IST-2000-26434 Face and Gesture Recognition Working group
- Mysql 用户管理
- 基于C语言sprintf函数的深入理解
- VC MFC工具栏(CToolBar)控件
- 密码破解的原理