1 | initial version |
are you asking how to get the value ? that would be:
Mat frame;
namedWindow("win");
VideoCapture cap("my.mpeg");
while( cap.isOpened() )
{
cap >> frame;
double millis = cap.get(CV_CAP_PROP_POS_MSEC);
// let's draw it,
// needs a clone, because the frame is in video-memory
Mat draw = frame.clone();
putText(draw, format("%4.3f",millis),Point(20,20), FONT_HERSHEY_PLAIN, 1.0, CV_RGB(0,255,0), 2.0);
imshow("win", draw);
// no imshow without waitkey..
int k = waitKey(20);
if ( k==27 ) break;
}
2 | No.2 Revision |
are you asking how to get the value ? that would be:or how to display it ? anyway, let's try both:
Mat frame;
namedWindow("win");
VideoCapture cap("my.mpeg");
while( cap.isOpened() )
{
cap >> frame;
double millis = cap.get(CV_CAP_PROP_POS_MSEC);
// let's draw it,
// needs a clone, because the frame is in video-memory
Mat draw = frame.clone();
putText(draw, format("%4.3f",millis),Point(20,20), FONT_HERSHEY_PLAIN, 1.0, CV_RGB(0,255,0), 2.0);
imshow("win", draw);
// no imshow without waitkey..
int k = waitKey(20);
if ( k==27 ) break;
}