mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 19:20:28 +08:00
fixed positioning in ffmpeg wrapper (thanks to mike_at_nrec for the patch). Added frame positioning feature to laplace demo to test the feature
This commit is contained in:
parent
c5088ca1b8
commit
2e520b05c4
@ -2,6 +2,7 @@
|
|||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
@ -26,8 +27,22 @@ int main( int argc, char** argv )
|
|||||||
|
|
||||||
if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0])))
|
if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0])))
|
||||||
cap.open(argc == 2 ? argv[1][0] - '0' : 0);
|
cap.open(argc == 2 ? argv[1][0] - '0' : 0);
|
||||||
else if( argc == 2 )
|
else if( argc >= 2 )
|
||||||
|
{
|
||||||
cap.open(argv[1]);
|
cap.open(argv[1]);
|
||||||
|
if( cap.isOpened() )
|
||||||
|
cout << "Video " << argv[1] <<
|
||||||
|
": width=" << cap.get(CV_CAP_PROP_FRAME_WIDTH) <<
|
||||||
|
", height=" << cap.get(CV_CAP_PROP_FRAME_HEIGHT) <<
|
||||||
|
", nframes=" << cap.get(CV_CAP_PROP_FRAME_COUNT) << endl;
|
||||||
|
if( argc > 2 && isdigit(argv[2][0]) )
|
||||||
|
{
|
||||||
|
int pos;
|
||||||
|
sscanf(argv[2], "%d", &pos);
|
||||||
|
cout << "seeking to frame #" << pos << endl;
|
||||||
|
cap.set(CV_CAP_PROP_POS_FRAMES, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( !cap.isOpened() )
|
if( !cap.isOpened() )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user