Worked on card detection

This commit is contained in:
Lukas Wölfer
2019-04-21 22:32:31 +02:00
parent edeec74d9a
commit 3720e25a5a
6 changed files with 166 additions and 97 deletions

View File

@@ -0,0 +1,22 @@
from typing import List, Tuple
import numpy
from .adjustment import Adjustment, get_square
from .. import board
def _extract_squares(image: numpy.ndarray,
squares: List[Tuple[int,
int,
int,
int]]) -> List[numpy.ndarray]:
return [image[square[1]:square[3], square[0]:square[2]].copy()
for square in squares]
def get_field_squares(image: numpy.ndarray,
adjustment: Adjustment) -> List[numpy.ndarray]:
squares = []
for ix in range(8):
for iy in range(5):
squares.append(get_square(adjustment, ix, iy))
return _extract_squares(image, squares)