<html><head></head><body><div style="color:#000; background-color:#fff; font-family:lucida console, sans-serif;font-size:13px"><div id="yui_3_16_0_ym19_1_1477298849840_11444" dir="ltr">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.</div><div dir="ltr" id="yui_3_16_0_ym19_1_1477298849840_11518">What about adding a IS_SPARSE flag (like HAS_ALPHA or IS_RGB) ?<br></div><div class="qtdSeparateBR"><br><br></div><div class="yahoo_quoted" style="display: block;"> <div style="font-family: lucida console, sans-serif; font-size: 13px;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"> <div dir="ltr"><font size="2" face="Arial"> Le Lundi 24 octobre 2016 8h45, Sebastian Dröge <sebastian@centricular.com> a écrit :<br></font></div> <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <br><br> <div class="y_msg_container">On Sun, 2016-10-23 at 09:44 +0000, philippe renon wrote:<div class="yqt4366526893" id="yqtfd76281"><br clear="none">> Hi,<br clear="none">> <br clear="none">> The opencv plugins has a utility method to extract the number of<br clear="none">> video channels and depth from caps (see code below).<br clear="none">> <br clear="none">> Problem is that it fails for sparse formats (BGRx, ...) where it<br clear="none">> reports 3 channels of depth 8.<br clear="none">> For opencv to work correctly downstream, it should report 4 channels.<br clear="none">> <br clear="none">> I can't find a simple way to detect that the caps/video info is<br clear="none">> sparse and has one additional "channel".</div><br clear="none"><br clear="none">Should it actually use that additional "channel", it's containing<br clear="none">arbitrary and useless data.<br clear="none"><br clear="none">In any case, you can get this info with e.g.<br clear="none">GST_VIDEO_INFO_COMP_PSTRIDE(), which will tell you 4 here (4 bytes to<br clear="none">get from one pixel to the next). It might even be better to directly<br clear="none">have a switch around the GstVideoFormat here instead.<br clear="none"><br clear="none">-- <br clear="none">Sebastian Dröge, Centricular Ltd · <a shape="rect" href="http://www.centricular.com/" target="_blank">http://www.centricular.com</a><br>_______________________________________________<br clear="none">gstreamer-devel mailing list<br clear="none"><a shape="rect" ymailto="mailto:gstreamer-devel@lists.freedesktop.org" href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br clear="none"><a shape="rect" href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><div class="yqt4366526893" id="yqtfd23183"><br clear="none"></div><br><br></div> </blockquote> </div> </div>  </div></div></body></html>