Browse Source

棋盘识别优化

master
lipeng 4 years ago
parent
commit
fd41ce094b
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      图像识别CV/pythoncv_learn/detection_chessboard_v4.py

+ 3
- 0
图像识别CV/pythoncv_learn/detection_chessboard_v4.py View File

@@ -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]


Loading…
Cancel
Save