Let say I have made a program to detect a green ball in a video. Whenever there is a green ball detected, I want to print out the duration of video at the time the green ball is detected. Is it possible?
In this answer, you will find a solution to determine the frames per second.
so you'd want to use:
fps = cap.get(cv2.cv.CV_CAP_PROP_FPS)
and count the number of frames you're at. Then you can compute the video time with
videotime = current_frame_number / fps.
EDIT:
@Miki suggested to use CAP_PROP_POS_MSEC
which should result in the same time (in [ms])
Corrected my typo as pointed out by @Swiper-CCCVI
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments