使用findConteurs在open中处理图像时出错

2024-10-02 20:43:46 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试用在这里打开简历是我的测试代码。在

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}$

我怎样才能解决这个问题。在


Tags: importnumpyimgasnpcv2jpg测试代码