Remove excessive logging

This commit is contained in:
Matt McWilliams 2022-11-15 20:55:06 -05:00
parent 5a0da25109
commit b93ef905ae
1 changed files with 19 additions and 21 deletions

View File

@ -346,41 +346,41 @@ def normalize_image(blank, rotated, offset, tl) :
diffX = offset[0] - tl["x"] diffX = offset[0] - tl["x"]
diffY = offset[1] - tl["y"] diffY = offset[1] - tl["y"]
print(f'diffX : {diffX}') #print(f'diffX : {diffX}')
print(f'diffY : {diffY}') #print(f'diffY : {diffY}')
crop = rotated.copy() crop = rotated.copy()
if diffX < 0 : if diffX < 0 :
crop = crop[0:rotatedHeight, abs(diffX):rotatedWidth] crop = crop[0:rotatedHeight, abs(diffX):rotatedWidth]
rotatedHeight, rotatedWidth = crop.shape[:2] rotatedHeight, rotatedWidth = crop.shape[:2]
print('Cropped X') #print('Cropped X')
print(f'Rotated: {rotatedWidth},{rotatedHeight}') #print(f'Rotated: {rotatedWidth},{rotatedHeight}')
diffX = 0 diffX = 0
if diffY < 0 : if diffY < 0 :
crop = crop[abs(diffY):rotatedHeight, 0:rotatedWidth] crop = crop[abs(diffY):rotatedHeight, 0:rotatedWidth]
rotatedHeight, rotatedWidth = crop.shape[:2] rotatedHeight, rotatedWidth = crop.shape[:2]
print('Cropped Y') #print('Cropped Y')
print(f'Rotated: {rotatedWidth},{rotatedHeight}') #print(f'Rotated: {rotatedWidth},{rotatedHeight}')
diffY = 0 diffY = 0
if rotatedWidth > width : if rotatedWidth > width :
crop = crop[0:rotatedHeight, 0:rotatedWidth-(rotatedWidth - width)] crop = crop[0:rotatedHeight, 0:rotatedWidth-(rotatedWidth - width)]
rotatedHeight, rotatedWidth = crop.shape[:2] rotatedHeight, rotatedWidth = crop.shape[:2]
print('Cropped X') #print('Cropped X')
print(f'Rotated: {rotatedWidth},{rotatedHeight}') #print(f'Rotated: {rotatedWidth},{rotatedHeight}')
if rotatedHeight > normalHeight : if rotatedHeight > normalHeight :
crop = crop[0:rotatedHeight-(rotatedHeight - normalHeight), 0:width] crop = crop[0:rotatedHeight-(rotatedHeight - normalHeight), 0:width]
rotatedHeight, rotatedWidth = crop.shape[:2] rotatedHeight, rotatedWidth = crop.shape[:2]
print('Cropped Y') #print('Cropped Y')
print(f'Rotated: {rotatedWidth},{rotatedHeight}') #print(f'Rotated: {rotatedWidth},{rotatedHeight}')
print(f'diffX : {diffX}') #print(f'diffX : {diffX}')
print(f'diffY : {diffY}') #print(f'diffY : {diffY}')
print(f'Rotated: {rotatedWidth},{rotatedHeight}') #print(f'Rotated: {rotatedWidth},{rotatedHeight}')
print(f'Blank : {width},{normalHeight}') #print(f'Blank : {width},{normalHeight}')
cropHeight = normalHeight cropHeight = normalHeight
cropWidth = width cropWidth = width
@ -432,9 +432,7 @@ tl = None
for hp in holePunches : for hp in holePunches :
if tl is None : if tl is None :
tl = hp tl = hp
print(f'{hp["order"] + 1} {hp["x"]},{hp["y"]}') #print(f'{hp["order"] + 1} {hp["x"]},{hp["y"]}')
print(f'Normal dimensions: {width},{normalHeight}')
# the mean rectangle is the average width and height # the mean rectangle is the average width and height
# determined by the four corner hole punches # determined by the four corner hole punches
@ -444,10 +442,10 @@ print(f'Mean rectangle: {meanRect[0]},{meanRect[1]}')
# offset is the position within the new normal image # offset is the position within the new normal image
# the top left hole punch should be centered to # the top left hole punch should be centered to
offset = center_within((width, normalHeight), meanRect) offset = center_within((width, normalHeight), meanRect)
print(f'Offset : {offset[0]},{offset[1]}') #print(f'Offset : {offset[0]},{offset[1]}')
print(f'Topleft: {tl["x"]},{tl["y"]}') #print(f'Topleft: {tl["x"]},{tl["y"]}')
print(f'Rotated: {rotatedWidth},{rotatedHeight}') #print(f'Rotated: {rotatedWidth},{rotatedHeight}')
print(f'Blank : {width},{normalHeight}') print(f'Normal : {width},{normalHeight}')
#cv2.rectangle(blank, offset, (offset[0]+meanRect[0], offset[1]+meanRect[1]), (255, 0, 0), thickness=20) #cv2.rectangle(blank, offset, (offset[0]+meanRect[0], offset[1]+meanRect[1]), (255, 0, 0), thickness=20)