OpenCV - Sizes of input arguments do not match - addWeighted

Я пытаюсь применить оператор Canny в определенном месте изображения со следующим кодом:

//region of interest from my RGB image
Mat devilROI = img(Rect(r->x+lowerRect.x, 
                        r->y + lowerRect.y, 
                        lowerRect.width, 
                        lowerRect.height));
Mat canny;
//to grayscale so I can apply canny
cvtColor(devilROI, canny, CV_RGB2GRAY);
//makes my region of interest with Canny
Canny(canny, canny, low_threshold, high_threshold);
//back to the original image
addWeighted(devilROI, 1.0, canny, 0.3, 0., devilROI);

И это дает мне следующую ошибку при выполнении addWeighted:

OpenCV Error: Sizes of input arguments do not match (The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array') in arithm_op, file C:\OpenCV2.3\ opencv\modules\core\src\arithm.cpp, line 1227
terminate called after throwing an instance of 'cv::Exception'
what():  C:\OpenCV2.3\opencv\modules\core\src\arithm.cpp:1227: error: (-209) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function arithm_op

Есть ли у вас какие-либо предположения о том, в чем может быть проблема? Я застрял на этом уже долгое время...

Спасибо.

14
задан Some programmer dude 17 January 2012 в 07:22
поделиться