opencv: extracting video channels and depth from caps

philippe renon philippe_renon at yahoo.fr
Mon Oct 24 08:53:02 UTC 2016


opencv misbehaves if that additional channel is not accounted for as it then assumes the image is RGB (i.e. stride 3). I thought about using the stride but it is a bit cumbersome as it is a per channel information.What about adding a IS_SPARSE flag (like HAS_ALPHA or IS_RGB) ?


    Le Lundi 24 octobre 2016 8h45, Sebastian Dröge <sebastian at centricular.com> a écrit :
 
 

 On Sun, 2016-10-23 at 09:44 +0000, philippe renon wrote:
> Hi,
> 
> The opencv plugins has a utility method to extract the number of
> video channels and depth from caps (see code below).
> 
> Problem is that it fails for sparse formats (BGRx, ...) where it
> reports 3 channels of depth 8.
> For opencv to work correctly downstream, it should report 4 channels.
> 
> I can't find a simple way to detect that the caps/video info is
> sparse and has one additional "channel".

Should it actually use that additional "channel", it's containing
arbitrary and useless data.

In any case, you can get this info with e.g.
GST_VIDEO_INFO_COMP_PSTRIDE(), which will tell you 4 here (4 bytes to
get from one pixel to the next). It might even be better to directly
have a switch around the GstVideoFormat here instead.

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


 
   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20161024/8a26d0a0/attachment.html>


More information about the gstreamer-devel mailing list