我是python3的初学者,并且在处理已处理的彩色图像和img_edge时出现错误的情况
import cv2
num_down = 2
num_bilateral =7
img_rgb = cv2.imread('1.jpg')
img_color = img_rgb
for _ in range(num_down):
img_color = cv2.pyrDown(img_color)
for _ in range(num_bilateral):
img_color = cv2.bilateralFilter(img_color, d=9,
sigmaColor=9,
sigmaSpace=7)
for _ in range(num_down):
img_color = cv2.pyrUp(img_color)
gray_image = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
median = cv2.medianBlur(gray_image, 7)
img_edge = cv2.adaptiveThreshold(median, 255,
cv2.ADAPTIVE_THRESH_MEAN_C,
cv2.THRESH_BINARY,
blockSize=9,
C=2)
color_img = cv2.cvtColor(img_edge, cv2.COLOR_GRAY2BGR)
image = cv2.bitwise_and(color_img,img_edge)
cv2.imshow('Cartoon', image)
cv2.waitKey(0)
cv2.destroyAllWindows()
错误消息显示:
错误:( - 209)该操作既不是'数组操作数组'(其中数组具有相同的大小和类型),也不是'数组操作标量',也不是函数cv :: binary_o中的'标量操作数组'
有人可以帮我解决如何编写cv2.bitwise函数以使代码运行吗?