|
@@ -2,9 +2,8 @@
|
|
|
import os
|
|
import os
|
|
|
import numpy as np
|
|
import numpy as np
|
|
|
from PIL import Image
|
|
from PIL import Image
|
|
|
-from parse import BLOCK_SIZE, COLUMN_VSHIFT, MIN_COLUMN_VAL, MIN_COLUMN_SAT, \
|
|
|
|
|
- detect_blocks, detect_exa, detect_held, print_board, \
|
|
|
|
|
- detect_columns
|
|
|
|
|
|
|
+from detection import BLOCK_SIZE, COLUMN_VSHIFT, MIN_COLUMN_VAL, \
|
|
|
|
|
+ MIN_COLUMN_SAT, detect_columns
|
|
|
from strategy import State
|
|
from strategy import State
|
|
|
|
|
|
|
|
|
|
|
|
@@ -37,10 +36,8 @@ if __name__ == '__main__':
|
|
|
|
|
|
|
|
board = Image.open('screens/board%d.png' % ident).convert('HSV')
|
|
board = Image.open('screens/board%d.png' % ident).convert('HSV')
|
|
|
#board.crop((0, 0, board.width, detect_columns(board))).show()
|
|
#board.crop((0, 0, board.width, detect_columns(board))).show()
|
|
|
- blocks = list(detect_blocks(board))
|
|
|
|
|
- exa = detect_exa(board)
|
|
|
|
|
- held = detect_held(board, exa)
|
|
|
|
|
- print_board(blocks, exa, held)
|
|
|
|
|
|
|
+ state = State.detect(board)
|
|
|
|
|
+ state.print()
|
|
|
|
|
|
|
|
if extensive:
|
|
if extensive:
|
|
|
make_bitmap(board).save('screens/bitmap%d.png' % ident)
|
|
make_bitmap(board).save('screens/bitmap%d.png' % ident)
|