本文整理汇总了C++中VideoCapture::pause方法的典型用法代码示例。如果您正苦于以下问题:C++ VideoCapture::pause方法的具体用法?C++ VideoCapture::pause怎么用?C++ VideoCapture::pause使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VideoCapture
的用法示例。
在下文中一共展示了VideoCapture::pause方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char** argv)
{
if ( argc != 2 )
{
cout << "Usage :" << argv[0] << " <video/image filename or camera device>" << endl;
exit(0);
}
cout << "Opening " << argv[1] << endl;
capture = new Capture( argv[1]);
char type[32];
strcpy( type, capture->getType());
cout << "Type :" << type << endl;
float fps = 100;
cvNamedWindow( "Video", 1);
if ( !strncmp( type, "VIDEO", 5))
{
delete capture;
capture = new VideoCapture( argv[1]);
VideoCapture* temp = (VideoCapture*) capture;
//cout << "Width : " << temp->getWidth() << endl;
//cout << "Height : " << temp->getHeight() << endl;
//cout << "Duration : " << temp->getDuration() << endl;
//cout << "FPS : " << temp->getFPS() << endl;
fps = 25;
}
else
{
fprintf( stderr, "Couldn't Not Detect Type of Source");
fprintf( stderr, " or No Handeller Available\n");
exit(0);
}
if ( !(strncmp( capture->getType(), "VIDEO", 5)))
{
VideoCapture* temp = (VideoCapture*) capture;
temp->play();
cout << capture->getStatus();
}
IplImage* image = NULL;
if (( capture->getWidth() > 0) && (capture->getHeight() > 0))
{
image = cvCreateImageHeader( cvSize(capture->getWidth(),
capture->getHeight()), IPL_DEPTH_8U, 3);
}
else
{
cout << capture->getStatus();
return 0;
}
//Assuming height 1100 and width 2000
vecDetections = new vector<Detection>* [1100];
for( int i=0; i<1100; i++)
vecDetections[i] = new vector<Detection>[2000];
char key=' ';
for( int i = 0; ;)
{
image->imageData = (char*) capture->getNextFrame();
processFrameFastHog(image);
if ( image->imageData == NULL) break;
cvShowImage( "Video", image);
key = cvWaitKey((int) 1000.0 / fps);
if (( key == '\n') && ( i == 0))
{
i = 1;
if ( !(strncmp( capture->getType(), "VIDEO", 5)))
{
VideoCapture* temp = (VideoCapture*) capture;
temp->pause();
}
}
else if( key == 27) break;
}
fstream outfile;
outfile.open("dump.txt", ios_base::out);
for(int i=0; i<capture->getHeight(); i++)
for(int j=0; j<capture->getWidth(); j++)
{
vector<Detection> detVec = vecDetections[i][j];
for(int k=0; k<detVec.size(); k++)
{
outfile << detVec[k].y << " " << detVec[k].x << " " << detVec[k].width;
outfile << " " << detVec[k].height << " " << detVec[k].scale << " " << detVec[k].score << endl;
}
//.........这里部分代码省略.........