我有ubuntu 16.04.我已经安装了opencv2.4.9并尝试运行此代码
import numpy as np
import cv2
from matplotlib import pyplot as plt
img = cv2.imread('/home/Picture/a.jpg')
dst = cv2.fastNlMeansDenoisingColored(img,None,10,10,7,21)
plt.subplot(121),plt.imshow(img)
p
lt.subplot(122),plt.imshow(dst)
plt.show()
但是我收到了这个错误 -
OpenCV Error: Bad argument (Type of input image should be CV_8UC3!) in fastNlMeansDenoisingColored, file /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/photo/src/denoising.cpp, line 91
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cv2.error: /build/opencv-SviWsf/opencv-2.4.9.1+dfsg/modules/photo/src/denoising.cpp:91: error: (-5) Type of input image should be CV_8UC3! in function fastNlMeansDenoisingColored
如何解决此问题?