Small text clarifier tweak #15

Merged
ewellenr merged 3 commits from autocropper into main 2023-11-06 18:56:14 -05:00

View File

@ -662,6 +662,11 @@ def textClarifying(image):
kernel6 = cv2.getStructuringElement(cv2.MORPH_RECT, (20, 2))
kernel7 = cv2.getStructuringElement(cv2.MORPH_RECT, (2, 8))
#This will probably need fixing later because it should be in proportion to the character/word height vs actual picture dimension
kdim = 5-(max(gray.shape[0], gray.shape[1])//1000)
print(kdim)
kernel8 = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (kdim, kdim))
# return lab[:,:,2]
currentimgofatype = lab[:,:,0] # L-channel: expresses the brightness in the image
@ -710,6 +715,7 @@ def textClarifying(image):
mask = cv2.rectangle(mask, (b[0],b[1]), (b[0]+b[2], b[1]+b[3]), 0, thickness=cv2.FILLED)
bingus = cv2.bitwise_or(goodmorphBthresh, mask)
bingus = cv2.morphologyEx(bingus, cv2.MORPH_ERODE, kernel8)
return bingus