Added new pictures

This commit is contained in:
Lukas Wölfer
2019-08-09 19:13:38 +02:00
parent 3c87c813eb
commit 4e5872f71b
11 changed files with 13 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

BIN
pictures/20190809172206_1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 KiB

BIN
pictures/20190809172213_1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 KiB

BIN
pictures/20190809172219_1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 KiB

BIN
pictures/20190809172225_1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 KiB

BIN
pictures/20190809172232_1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 KiB

BIN
pictures/20190809172238_1.jpg Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 KiB

View File

@@ -38,12 +38,16 @@ class Configuration:
for square, card in self.catalogue:
counter += 1
file_stream = io.BytesIO()
np.save(file_stream, card_finder.simplify(square)[0], allow_pickle=False)
np.save(
file_stream,
card_finder.simplify(square)[0],
allow_pickle=False)
file_name = ""
if isinstance(card, board.SpecialCard):
file_name = f's{card.value}-{card.name}-{counter}.npy'
elif isinstance(card, board.NumberCard):
file_name = f'n{card.suit.value}{card.number}-{card.suit.name}-{counter}.npy'
file_name = f'n{card.suit.value}{card.number}'\
f'-{card.suit.name}-{counter}.npy'
else:
raise AssertionError()
zip_file.writestr(
@@ -72,7 +76,8 @@ class Configuration:
catalogue: List[Tuple[np.ndarray, board.Card]] = []
with zipfile.ZipFile(filename, 'r') as zip_file:
adj = adjustment.Adjustment(
**json.loads(zip_file.read(Configuration.ADJUSTMENT_FILE_NAME)))
**json.loads(
zip_file.read(Configuration.ADJUSTMENT_FILE_NAME)))
for template_filename in (
x for x in zip_file.namelist() if
x.startswith(Configuration.TEMPLATES_DIRECTORY + '/')):

View File

@@ -11,7 +11,7 @@ from shenzhen_solitaire.cv.configuration import Configuration
def generate() -> None:
"""Generate a configuration"""
with open("Solitaire.png", 'rb') as png_file:
with open("pictures/20190809172213_1.jpg", 'rb') as png_file:
img_str = png_file.read()
nparr = np.frombuffer(img_str, np.uint8)
image = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
@@ -19,13 +19,14 @@ def generate() -> None:
generated_config = Configuration.generate(image)
generated_config.save('test_config.zip')
def parse() -> board.Board:
"""Parse a configuration"""
with open("Solitaire2.png", 'rb') as png_file:
with open("pictures/20190809172213_1.jpg", 'rb') as png_file:
img_str = png_file.read()
nparr = np.frombuffer(img_str, np.uint8)
image = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
image = cv2.resize(image, (1000, 629))
# image = cv2.resize(image, (1000, 629))
loaded_config = Configuration.load('test_config.zip')
loaded_config.field_adjustment = adjustment.adjust_field(image)

Binary file not shown.