如何在 opencv 中计算每秒帧数?
How to calculate Frame Per Second in opencv?
这是我的代码,它以高 fps 显示视频。我想要这里的原始 fps,但不知道该怎么做。观看一些教程,他们正在使用 VideoCapture
,我尝试使用它,但这给了我链接器错误 undefined reference to 'cv::VideoCapture::VideoCapture(std::string const&)'..
虽然我正在链接所有库但错误是相同的。我正在使用 Dev-C++ 5.11 (GCC 4.9.2)
,所以知道如何在此处使用 (CV_CAP_PROP_FPS)
-
#include <windows.h>
#include <opencv/cv.hpp>
#include <opencv/highgui.h>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
double fps=0;
cvNamedWindow( "Movie", CV_WINDOW_NORMAL );
CvCapture* capture = cvCreateFileCapture( "G:\movie\Journey.2.The.Mysterious.Island.2012.avi" );
IplImage* frame;
//cv::VideoCapture cap("G:\movie\Journey.2.The.Mysterious.Island.2012.avi" ); [giving me error]
//fps=cap.get(CV_CAP_PROP_FPS); [How to use this]
while(1)
{
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( "Movie", frame );
char c = cvWaitKey(27);
if( c == 27 ) break; //esc
}
cvReleaseCapture( &capture );
cvDestroyWindow( "Movie" );
}
谢谢:)
double fps=cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
这是我的代码,它以高 fps 显示视频。我想要这里的原始 fps,但不知道该怎么做。观看一些教程,他们正在使用 VideoCapture
,我尝试使用它,但这给了我链接器错误 undefined reference to 'cv::VideoCapture::VideoCapture(std::string const&)'..
虽然我正在链接所有库但错误是相同的。我正在使用 Dev-C++ 5.11 (GCC 4.9.2)
,所以知道如何在此处使用 (CV_CAP_PROP_FPS)
-
#include <windows.h>
#include <opencv/cv.hpp>
#include <opencv/highgui.h>
using namespace cv;
using namespace std;
int main( int argc, char** argv )
{
double fps=0;
cvNamedWindow( "Movie", CV_WINDOW_NORMAL );
CvCapture* capture = cvCreateFileCapture( "G:\movie\Journey.2.The.Mysterious.Island.2012.avi" );
IplImage* frame;
//cv::VideoCapture cap("G:\movie\Journey.2.The.Mysterious.Island.2012.avi" ); [giving me error]
//fps=cap.get(CV_CAP_PROP_FPS); [How to use this]
while(1)
{
frame = cvQueryFrame( capture );
if( !frame ) break;
cvShowImage( "Movie", frame );
char c = cvWaitKey(27);
if( c == 27 ) break; //esc
}
cvReleaseCapture( &capture );
cvDestroyWindow( "Movie" );
}
谢谢:)
double fps=cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);