Linting
This commit is contained in:
@@ -102,8 +102,8 @@ def find_square(search_square: np.ndarray,
|
|||||||
best_square = square
|
best_square = square
|
||||||
best_count = count
|
best_count = count
|
||||||
best_coord = coord
|
best_coord = coord
|
||||||
assert best_square
|
assert isinstance(best_square, np.ndarray)
|
||||||
assert best_coord
|
assert isinstance(best_coord, tuple)
|
||||||
cv2.imshow("Window", best_square -
|
cv2.imshow("Window", best_square -
|
||||||
search_square[best_coord[0]:best_coord[0] +
|
search_square[best_coord[0]:best_coord[0] +
|
||||||
best_square.shape[0], best_coord[1]:best_coord[1] +
|
best_square.shape[0], best_coord[1]:best_coord[1] +
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
|
import itertools
|
||||||
|
from typing import Tuple, List, Dict
|
||||||
|
import numpy # type: ignore
|
||||||
|
import cv2 # type: ignore
|
||||||
|
|
||||||
from .context import shenzhen_solitaire
|
from .context import shenzhen_solitaire
|
||||||
from shenzhen_solitaire.cv import adjustment
|
from shenzhen_solitaire.cv import adjustment
|
||||||
from shenzhen_solitaire.cv import card_finder
|
from shenzhen_solitaire.cv import card_finder
|
||||||
from typing import Tuple, List, Dict
|
|
||||||
import cv2
|
|
||||||
import numpy
|
|
||||||
import itertools
|
|
||||||
|
|
||||||
|
|
||||||
def pixelcount(image: numpy.ndarray) -> List[Tuple[Tuple[int, int, int], int]]:
|
def pixelcount(image: numpy.ndarray) -> List[Tuple[Tuple[int, int, int], int]]:
|
||||||
@@ -18,6 +19,7 @@ def pixelcount(image: numpy.ndarray) -> List[Tuple[Tuple[int, int, int], int]]:
|
|||||||
B = sorted(p.items(), key=lambda x: x[1])
|
B = sorted(p.items(), key=lambda x: x[1])
|
||||||
return B
|
return B
|
||||||
|
|
||||||
|
|
||||||
def simplify(image: numpy.ndarray) -> None:
|
def simplify(image: numpy.ndarray) -> None:
|
||||||
cv2.imshow("Window", image)
|
cv2.imshow("Window", image)
|
||||||
cv2.waitKey(0)
|
cv2.waitKey(0)
|
||||||
@@ -46,7 +48,8 @@ def main() -> None:
|
|||||||
for i in range(10, 20):
|
for i in range(10, 20):
|
||||||
image_squares[i], _ = card_finder.simplify(image_squares[i])
|
image_squares[i], _ = card_finder.simplify(image_squares[i])
|
||||||
print("Finding...")
|
print("Finding...")
|
||||||
found_image, certainty = card_finder.find_square(image_squares[i], squares)
|
found_image, certainty = card_finder.find_square(
|
||||||
|
image_squares[i], squares)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user