Worked on card value detection
This commit is contained in:
@@ -6,8 +6,6 @@ import cv2
|
||||
import numpy
|
||||
import itertools
|
||||
|
||||
A = cv2.imread("Solitaire.png")
|
||||
|
||||
|
||||
def pixelcount(image: numpy.ndarray) -> List[Tuple[Tuple[int, int, int], int]]:
|
||||
p: Dict[Tuple[int, int, int], int] = {(0, 0, 0): 0}
|
||||
@@ -31,14 +29,24 @@ def simplify(image: numpy.ndarray) -> None:
|
||||
|
||||
|
||||
def main() -> None:
|
||||
adj = adjustment.adjust_field(A)
|
||||
image_squares = card_finder.get_field_squares(A, adj)
|
||||
for img in image_squares:
|
||||
print(*pixelcount(img), sep='\n')
|
||||
cv2.imshow("Window", img)
|
||||
cv2.waitKey(0)
|
||||
cv2.destroyWindow("Window")
|
||||
print()
|
||||
image = cv2.imread("Solitaire.png")
|
||||
image2 = cv2.imread("Solitaire2.png")
|
||||
image2 = cv2.resize(image2, (1000, 629))
|
||||
|
||||
adj = adjustment.adjust_field(image)
|
||||
squares = card_finder.get_simplified_squares(image, adj)
|
||||
print("Simplified")
|
||||
|
||||
adj.x -= 2
|
||||
adj.y -= 2
|
||||
adj.w += 5
|
||||
adj.h += 5
|
||||
|
||||
image_squares = card_finder.get_field_squares(image2, adj)
|
||||
for i in range(10,20):
|
||||
image_squares[i], _ = card_finder.simplify(image_squares[i])
|
||||
print("Finding...")
|
||||
found_image, certainty = card_finder.find_square(image_squares[i], squares)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user