Repository navigation
Conversation
I believe, by default video capture should provide BGR/Gray 8U image. Switching to 16UC1 is possible after explicit additional property settings by user for |
|
@stbnps, I agree with @alalek. Your patch changes the default behavior of video capturing functionality in the case of one specific backend. Many OpenCV samples assume that the output from video capture is 8-bit 3-channel RGB image. Anything else should be explicitly configured using VideoCapture::set(int) method. Please, add some video capturing property (or a few) and set this property/properties in the beginning of your app when using VideoCapture |
|
@alalek, @stbnps Could you explain how does the patch change the behavior of video capturing functionality?
|
|
I mean, that the most part of user applications assumes these conditions of VideoCapture behavior:
It is a bug, but VideoCapture backend should convert camera format to BGR 8U by default, but it should not change output format to CV_16U. |
|
@alalek I respectfully disagree, to me it makes no sense to have a camera that only supports Y16, under default behavior, yield BGR 8-bit images (which will essentially contain garbage? Or should these be converted to 8-bit single-channel, then replicated to 2 other channels to yield a "BGR" image?). However, seeing that the patch won't get accepted without the changes you suggested, I'll try to implement them on my end and make a new PR from my fork. |
|
Yes, return "gray" 8U image with cloned channels. No need to make a new PR, just update this. |
| if (try_palette_v4l2(capture)) { | ||
| if (capture->palette == V4L2_PIX_FMT_Y16) { | ||
| capture->convert_rgb = false; | ||
| } |
There was a problem hiding this comment.
Problem is here.
capture->convert_rgb = false should be changed explicitly by user only (via set property call with CV_CAP_PROP_CONVERT_RGB = false).
|
@alalek , I implemented and tested the changes. I'll need you to verify that the way I'm doing setting CV_CAP_PROP_FOURCC is okay. The changes don't seem to have broken anything, but I only tested with two different cameras. I understand now what you meant by default behavior, I didn't realize there was a conversion involved. However, you said I can just modify this PR? How do I do this, since it's not mine? P.S. added my own PR here: #7293 |
|
@Algomorph thanks! |
Resolves #7194