Skip to content

Use the frame-count property on OpenCV 4 and newer - #304

Open
Aschenbath wants to merge 1 commit into
PyImageSearch:masterfrom
Aschenbath:codex/oss20-20261122b-de52-imutils-frame-count
Open

Aschenbath wants to merge 1 commit into
PyImageSearch:masterfrom
Aschenbath:codex/oss20-20261122b-de52-imutils-frame-count

Conversation

@Aschenbath

Copy link
Copy Markdown

OpenCV 4 currently falls through to the removed cv2.cv constant and counts every frame manually. Use the existing or_better version check so OpenCV 3 and newer take the fast property path, while retaining the legacy branch and manual fallback.

Fixes #261.

Validation: Three unittest tests cover OpenCV 2, 3, 4 and 5, manual override, unsupported properties and capture release. The OpenCV 4/5 regression fails before the fix and passes afterward; no camera is required.

This change was prepared with AI assistance.

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

Successfully merging this pull request may close these issues.

Count Frames Function

1 participant