用opencv查看视频信息(视频的宽度、高度、帧率和总得帧数)
// look_up_fps.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <cv.h> #include <highgui.h> int _tmain(int argc, _TCHAR* argv[]) { IplImage *nFrames = NULL; CvCapture* pCapture = NULL; if( !(pCapture = cvCaptureFromAVI("C:\\zcd.avi"))) { fprintf(stderr, "Can not open camera.\n"); return -1; } int frameH = (int) cvGetCaptureProperty(pCapture, CV_CAP_PROP_FRAME_HEIGHT); int frameW = (int) cvGetCaptureProperty(pCapture, CV_CAP_PROP_FRAME_WIDTH); int fps = (int) cvGetCaptureProperty(pCapture, CV_CAP_PROP_FPS); int numFrames = (int) cvGetCaptureProperty(pCapture, CV_CAP_PROP_FRAME_COUNT); printf("vedio's \nwidth = %d\t height = %d\n video's fps = %d\t nums = %d", frameW, frameH, fps, numFrames); getchar(); return 0; }