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]