OpenCV pyrMeanShiftFilter in Processing--problems with matrix

会有一股神秘感。 提交于 2019-11-29 12:23:02

The problem is that you are using rows where the columns should be and columns where the rows should be. Check the Mat documentation for more information.

so, whenever you have this:

new Mat( width, height, CvType.CV_8UC3);

invert the order

new Mat( height, width, CvType.CV_8UC3);

Also, I notice that you have a 4 channel images (ARGB) and the toMat function also have 4 channels, but you create a Mat with only 3 CV_8UC3, you should use 4 CV_8UC4 (not sure in java), and beware, normally opencv uses is BGRA !! so you may need to mix the channels correctly.

I hope this helps you

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!