Merged loop

This commit is contained in:
Lukas Wölfer
2019-06-23 17:35:34 +02:00
parent 7f2ae50804
commit c0c216e929

View File

@@ -2,6 +2,7 @@
from typing import Optional, Tuple from typing import Optional, Tuple
from dataclasses import dataclass from dataclasses import dataclass
import itertools
import numpy import numpy
import cv2 import cv2
@@ -35,13 +36,12 @@ def _adjust_squares(
adjustment = Adjustment(0, 0, 0, 0, 0, 0) adjustment = Adjustment(0, 0, 0, 0, 0, 0)
while True: while True:
working_image = image.copy() working_image = image.copy()
for index_x in range(count_x): for index_x, index_y in itertools.product(range(count_x), range(count_y)):
for index_y in range(count_y): square = get_square(adjustment, index_x, index_y)
square = get_square(adjustment, index_x, index_y) cv2.rectangle(working_image,
cv2.rectangle(working_image, (square[0], square[1]),
(square[0], square[1]), (square[2], square[3]),
(square[2], square[3]), (0, 0, 0))
(0, 0, 0))
cv2.imshow('Window', working_image) cv2.imshow('Window', working_image)
k = cv2.waitKey(0) k = cv2.waitKey(0)
print(k) print(k)