OpenCV pyrMeanShiftFilter in Processing--problems with matrix

前端 未结 1 1437
轮回少年
轮回少年 2020-12-20 02:40

I\'m trying to use the Mean Shift Function from OpenCV inside a program called Processing, which is a language based on Java. So far, I know that the function requires two m

相关标签:
1条回答
  • 2020-12-20 03:15

    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

    0 讨论(0)
提交回复
热议问题