OpenCV - Sizes of input arguments do not match - addWeighted

前端 未结 2 1461
失恋的感觉
失恋的感觉 2021-01-07 22:46

I am trying to apply the Canny operator in a certain location of an image with the following code:

//region of interest from my RGB image
Mat devilROI = img(         


        
2条回答
  •  庸人自扰
    2021-01-07 23:28

    Easy. You do not have the same number of channels in the 2 images to merge.

    cvtColor(devilROI, canny, CV_RGB2GRAY);
    

    Is taking your 3 channel image and turning it into a 1 channel greyscale image. You need the same number of channels to use addWeighted

提交回复
热议问题