Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions unstructured/partition/utils/ocr_models/tesseract_ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,9 @@ def zoom_image(image: PILImage.Image, zoom: float = 1) -> PILImage.Image:
interpolation=cv2.INTER_CUBIC,
)

kernel = np.ones((1, 1), np.uint8)
new_image = cv2.dilate(new_image, kernel, iterations=1)
new_image = cv2.erode(new_image, kernel, iterations=1)
# Skip dilation and erosion for 1x1 kernel as they are no-ops
# kernel = np.ones((1, 1), np.uint8)
# new_image = cv2.dilate(new_image, kernel, iterations=1)
# new_image = cv2.erode(new_image, kernel, iterations=1)

return PILImage.fromarray(new_image)