我正在尝试用在这里打开简历是我的测试代码。在
import numpy as np
import cv2
im = cv2.imread('keli.jpg')
imgray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
thresh = cv2.adaptiveThreshold(im,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY,7,2)
contours,hierarchy = cv2.findContours(thresh,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
img = cv2.drawContours(im, contours, -1, (0,255,0), 1)
cv2.imwrite("result.jpg",img)
错误就在这里
^{pr2}$我怎样才能解决这个问题。在
adaptiveThreshold
需要CV_8UC1
(灰度)图像,因此只需传递imgray
而不是{相关问题 更多 >
编程相关推荐