视频画面本质上是由一帧一帧的连续图像组成的,播放视频其实就是在播放窗口把一系列连续图像按一定的时间间隔一幅幅贴上去实现的。
人眼在连续图像的刷新最少达到每秒24帧的时候,就分辨不出来图像间的闪动了,使人感觉呈现出来的是连续的画面,视频的播放就是利用了这一点。我们知道,电影被称为“24帧的艺术”,意思就是电影画面每秒刷新24帧,即每秒显示24副图像,它的帧率(Frames per Second,简称:FPS)为24。
一般情况下帧率要大于等于24,以下先测试一下两个视频文件的帧率,一个是网络上下载的“”friends“”,一个是用手机拍摄的视频。
#include "core/core.hpp"
#include "highgui/highgui.hpp"
#include "imgproc/imgproc.hpp"
#include
using namespace cv;
int main(int argc,char *argv[])
{
VideoCapture videoFriends(argv[1]);
VideoCapture videoPhone(argv[2]);
double fpsFriends=videoFriends.get(CV_CAP_PROP_FPS);
double fpsPhone=videoFriends.get(CV_CAP_PROP_FPS);
std::cout |