Skip to content

Commit 1cfe7e7

Browse files
committed
ready to review
1 parent 5564c32 commit 1cfe7e7

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.8-dev2
2+
3+
* Enhancement: Optimized `zoom_image` (codeflash)
4+
15
## 1.0.7
26

37
* Fix a hardcoded file extension causing confusion in the logs
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.7" # pragma: no cover
1+
__version__ = "1.0.8-dev2" # pragma: no cover

unstructured_inference/models/tables.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,16 +766,14 @@ def zoom_image(image: PILImage.Image, zoom: float) -> PILImage.Image:
766766
if zoom <= 0:
767767
# no zoom but still does dilation and erosion
768768
zoom = 1
769-
770-
kernel = np.ones((1, 1), np.uint8)
771769
new_image = cv2.resize(
772770
cv2.cvtColor(np.asarray(image), cv2.COLOR_RGB2BGR),
773771
None,
774772
fx=zoom,
775773
fy=zoom,
776774
interpolation=cv2.INTER_CUBIC,
777775
)
778-
776+
kernel = np.ones((1, 1), np.uint8)
779777
new_image = cv2.dilate(new_image, kernel, iterations=1, dst=new_image)
780778
new_image = cv2.erode(new_image, kernel, iterations=1, dst=new_image)
781779

0 commit comments

Comments
 (0)