timer in video opencv
how to display time in video using opencv? CV_CAP_PROP_POS_MSEC--will this help me to display the time? please excuse my limited knowledge in opencv as i am new to this.
add a comment
how to display time in video using opencv? CV_CAP_PROP_POS_MSEC--will this help me to display the time? please excuse my limited knowledge in opencv as i am new to this.
are you asking how to get the value ? 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;
}
Asked: 2013-03-23 05:02:34 -0600
Seen: 801 times
Last updated: Mar 23 '13