From fd41ce094b515559b3361ba6de548192aa2aef91 Mon Sep 17 00:00:00 2001 From: lipeng Date: Fri, 7 Aug 2020 17:46:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=8B=E7=9B=98=E8=AF=86=E5=88=AB=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 图像识别CV/pythoncv_learn/detection_chessboard_v4.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/图像识别CV/pythoncv_learn/detection_chessboard_v4.py b/图像识别CV/pythoncv_learn/detection_chessboard_v4.py index ede7d39..b9c8d71 100644 --- a/图像识别CV/pythoncv_learn/detection_chessboard_v4.py +++ b/图像识别CV/pythoncv_learn/detection_chessboard_v4.py @@ -136,6 +136,9 @@ cv2.imshow('houghLinesImage', houghLinesImage) thresh_min = min(dst.shape) lines = cv2.HoughLinesP(dst, 1, np.pi / 180, 200, minLineLength=int(dst.shape[0] * 0.45), maxLineGap=int(thresh_min * 0.5)) +# 过滤斜率 +lines = list(filter(lambda line: True if abs(line[0][0] - line[0][2]) < 280 or abs(line[0][1] - line[0][3]) < 280 else False, lines)) + houghLinesImage = img.copy() for line in lines: x1,y1,x2,y2 = line[0]