Skip to content

Commit

Permalink
[优化] 移除小干扰点 (wangshub#1146)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruodeng authored and 柴茂源 committed Feb 2, 2018
1 parent 6b65c54 commit 9c2cf62
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions wechat_jump_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,14 @@ def find_piece_and_board(im):
if abs(j - piece_x) < piece_body_width:
continue

# 修掉圆顶的时候一条线导致的小 bug,这个颜色判断应该 OK,暂时不提出来
# 检查Y轴下面5个像素, 和背景色相同, 那么是干扰
ver_pixel = im_pixel[j, i + 5]
if abs(pixel[0] - last_pixel[0]) \
+ abs(pixel[1] - last_pixel[1]) \
+ abs(pixel[2] - last_pixel[2]) > 10:
+ abs(pixel[2] - last_pixel[2]) > 10 \
and abs(ver_pixel[0] - last_pixel[0]) \
+ abs(ver_pixel[1] - last_pixel[1]) \
+ abs(ver_pixel[2] - last_pixel[2]) > 10:
board_x_sum += j
board_x_c += 1
if board_x_sum:
Expand Down

0 comments on commit 9c2cf62

Please sign in to comment.