You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Drawing into a numpy view with a negative step in the channel dimension doesn't work #15895
I create three 3-channel images and draw a circle into them. In the second case I use the step trick A[:, :, ::-1] to flip the R and B channels in the image, emulating cv.cvtColor with COLOR_BGR2RGB. I then try to draw into that array. The result, as seen in the screenshot, is that nothing gets drawn. In the third case I explicitly make a copy of the channel-flipped array (which is actually a view) before drawing, and it works.
Expected is that cv.circle works in all three cases.
imshow is a custom function that wraps ipywidgets.Image, but I tried it with cv.imwrite as well and the result is the same, so it's not a visualization issue.
With patch from #15918 we can see this message of failed conversion:
[ WARN:0] Bindings conversion failed: Layout of the output array img is incompatible with cv::Mat (step[ndims-1] != elemsize or step[1] != elemsize*nchannels)
Unfortunately, bindings wrapper didn't fail on these arguments and did moved forward to malformed UMat overload (this is a bug).
Activity
tailsu commentedon Nov 12, 2019
imshowis a custom function that wrapsipywidgets.Image, but I tried it withcv.imwriteas well and the result is the same, so it's not a visualization issue.alalek commentedon Nov 14, 2019
There is lack of support in OpenCV for numpy on-the-fly reshaped arrays. OpenCV can't even copy data back if layout is not supported.
Workaround: use return value.
alalek commentedon Nov 15, 2019
With patch from #15918 we can see this message of failed conversion:
Unfortunately, bindings wrapper didn't fail on these arguments and did moved forward to malformed
UMatoverload (this is a bug).