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 /home/lzm/opencv-3.4.0/modules/core/src/arithm.cpp, line 659
terminate called after throwing an instance of 'cv::Exception'
what(): /home/lzm/opencv-3.4.0/modules/core/src/arithm.cpp:659: 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
已放棄 (核心已轉儲)
如果您向我們展示更多代碼,我們可以嘗試提供更多詳細信息,否則@Barriel答案是可以的。還要注意 addWieighted
用 alpha = 1
, beta = 1
並且 gamma = 0
是兩個圖像的簡單相加: temp_image += noise_image;
。無論如何,要注意飽和度。 - Miki 2015年9月29日11:05
您需要確保 temp_image
並 noise_image
具有相同的 大小 和 頻道編號。通常,當其中一個圖像出現BGR
而另一個出現 時,就會發生這種情況 GRAY
。
|
也就是說兩張圖片應該有相同的大小和rgb類型即可