-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
videoio: enum CAP_MODE_* should be removed #5485
Copy link
Copy link
Closed
Description
CAP_MODE_* enum, is supposed to be used as set(CAP_PROP_MODE, CAP_MODE_YUYV).
However this makes CAP_PROP_MODE ambiguous:
- the
cap_libv4limplementation interprets it as "output mode" and returns YUYV images. - the
cap_*1394*implementations interpret it as "transmission mode" and always return BGR images. (even converting gray to BGR) - the
cap_v4limplementation also interprets it as "transmission mode", but treats it read only - other
cap_*implementations do not supportCAP_PROP_MODE
looking at the documentation CAP_PROP_MODE we find:
Backend-specific value indicating the current capture mode.
therefore I think the cap_libv4l behavior wrong:
- the call should result in YUYV transmission frames, but still return BGR
- the currently available API for selecting output format is
CAP_PROP_CONVERT_RGB, which allows to disable conversion and get the transmission format - the user actually should not be able to specify the output format at all - even though it may save a memcpy
- this would mean we have to move half of the
cvtColorAPI to VideoCapture.CAP_MODE_YUYVimpliesCOLOR_XXXX2YUYV- soCAP_MODE_Labwould make sense as well - lets consider the transmission format is Bayer and the output is RGB. Which demosaicing algorithm should be used? Edge Aware, VNG, the fastest?
- Lets consider the user wants GRAY images and the possible transmission formats are MJPEG and YUYV. Which one would be more efficient for VideoCapture to select?
- this would mean we have to move half of the
allowing to specify the output format requires a large amount of logic inside VideoCapture which does not belong there.
However there are advantages in adding a API similar to cv::IMREAD_GRAYSCALE to VideoCapture - yet the CAP_MODE_* values are the wrong way to do so.
I suggest removing or deprecating the CAP_MODE_* enum as long as cap_libv4l is still the only implementation understanding it.
Reactions are currently unavailable