项目要点
- 读取图片: image = cv2.imread('./images/page.jpg')
- 调整图片尺寸: resized = cv2.resize(image, (width, height), interpolation = cv2.INTER_AREA)
- 灰度化处理: gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
- 高斯模糊去噪点: gray = cv2.GaussianBlur(gray, (5,5), 0)
- 边缘检测: edged = cv2.Canny(gray, 75, 200)
- cnts = cv2.findContours(edged.copy(), cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)[0] 用边缘检测的结果进行轮廓检测 # 返回值两个: contours, hierarchy
- 按照面积排序: cnts = sorted(cnts, key = cv2.contourArea, reverse = True)
- 显示轮廓: image_contours = cv


5602

被折叠的 条评论
为什么被折叠?



