#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"
int main(int argc, char* argv[])
{
IplImage * src1 = cvLoadImage("E:\\个人资料\\小新头像.jpg",0);
IplImage * src2 = cvLoadImage("E:\\个人资料\\小新头像.jpg",1);
cvNamedWindow("huidutu");
cvNamedWindow("caisetu");
cvShowImage("huidutu",src1);
cvShowImage("caisetu",src2);
cvWaitKey(0);
cvReleaseImage(&src1);
cvReleaseImage(&src2);
cvDestroyWindow("huidutu");
cvDestroyWindow("caisetu");
return 0;
}
#include "stdafx.h"
#include "cv.h"
#include "highgui.h"
#include "cxcore.h"
int frame_count = 0;
int g_slide_pose = 0;
CvCapture * capture = NULL;
void change(int pos){ //回调函数执行设置进度条位置,跳过不播放之前的帧,直接到相应的帧播放
cvSetCaptureProperty(capture,CV_CAP_PROP_POS_FRAMES,pos);
frame_count = pos; //进度条的位置
}
int main(int argc, char* argv[])
{
cvNamedWindow("show");
capture = cvCreateFileCapture("F:\\电影视频\\已看\\银HHW队.TC1280清晰国语中字.mp4");
int Frames = (int)cvGetCaptureProperty(capture,CV_CAP_PROP_FRAME_COUNT); //获取视频的总帧数
if (Frames>0)
{
cvCreateTrackbar("posion","show",&g_slide_pose,Frames,change); //创建进度条,名称,窗口,起始帧号,回调函数
}
IplImage * Frame;
while (1)
{
Frame = cvQueryFrame(capture);
cvShowImage("show",Frame);
char c = cvWaitKey(30);
if (c == 27) break;
cvSetTrackbarPos("posion","show",frame_count); //跟踪进度条的位置,为什么这个加上以后速度会变慢??难道是计算机速度太慢了,不理解
frame_count++;
}
cvReleaseCapture(&capture);
cvDestroyWindow("show");
return 0;
}