OpenCv播放视频并滚动条滚动
2016-05-16 22:21
169 查看
#include "highgui.h" #include "cv.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(int argc, char** argv){ cvNamedWindow("test2", 0); g_capture = cvCreateFileCapture(argv[1]); int frames = (int) cvGetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_COUNT); if (frames != 0){ cvCreateTrackbar("Position", "test2", &g_slider_position, frames, onTrackbarSlide); } IplImage* frame; while (1){ frame = cvQueryFrame(g_capture); if (!frame){ break; } cvSetTrackbarPos("Position", "test2", g_slider_position++); cvShowImage("test2", frame); char c = cvWaitKey(5); if (c == 27){ break; } } cvReleaseCapture(&g_capture); cvDestroyWindow("test2"); return 0; }
相关文章推荐
- Expressions are not allowed at the top level
- linux:error while loading shared libraries: /usr/lib/xx.so.xx: file too short
- 阿里云 centos7 Jdk8-64 mysql5.6 tomcat8 环境搭建
- 学习写一个shellcode
- Centos7 关闭防火墙设置
- linux corosync+pacemaker+drbd+mysql配置安装详解
- (9)在 operator=中处理自我赋值
- 热加载Properties 工具类
- linux抵御DDOS攻击 通过iptables限制TCP连接和频率
- linux kernel的中断子系统之(八):softirq
- Linux查看程序端口占用情况
- Ubuntu16.04下开发Openni+Nite+OpenCv3.1
- bash 语法篇
- ocfs2集群的配置
- 集群介绍
- Linux系统搭建SVN服务
- 关机/重启命令
- linux中的svn命令使用
- Spark-再接着上次的Lamda架构
- Linux软RAID的技术概要及实现