Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count Frames Function #261

Open
kbvatral opened this issue Oct 6, 2021 · 0 comments
Open

Count Frames Function #261

kbvatral opened this issue Oct 6, 2021 · 0 comments

Comments

@kbvatral
Copy link

kbvatral commented Oct 6, 2021

The count frames function currently will resort to using manual counting instead of the cv2.CAP_PROP_FRAME_COUNT property if you use version 4+ of OpenCV. From imutils/video/count_frames.py:

try:
	# check if we are using OpenCV 3
	if is_cv3():
		total = int(video.get(cv2.CAP_PROP_FRAME_COUNT))

	# otherwise, we are using OpenCV 2.4
	else:
		total = int(video.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT))

I believe that if OpenCV 4 using the same property as OpenCV 3, so this should be as simple as changing the if statement to check if cv3 or cv4. Is there already a convenience function for checking version 4 that could be used here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant