Yaz Hobooti
commited on
Commit
·
47353d6
1
Parent(s):
946aa7f
Fix scikit-image import: footprint_rectangle -> rectangle
Browse files- pdf_comparator.py +2 -2
pdf_comparator.py
CHANGED
|
@@ -13,7 +13,7 @@ import numpy as np
|
|
| 13 |
from PIL import Image, ImageChops, ImageDraw, UnidentifiedImageError
|
| 14 |
from pdf2image import convert_from_path
|
| 15 |
from skimage.measure import label, regionprops
|
| 16 |
-
from skimage.morphology import dilation,
|
| 17 |
import gradio as gr
|
| 18 |
|
| 19 |
# Optional features
|
|
@@ -68,7 +68,7 @@ def find_diff_boxes(diff_img: Image.Image, threshold: int = 12, min_area: int =
|
|
| 68 |
arr = np.asarray(diff_img).astype(np.uint16)
|
| 69 |
gray = arr.max(axis=2).astype(np.uint8)
|
| 70 |
mask = (gray >= threshold).astype(np.uint8)
|
| 71 |
-
mask = dilation(mask,
|
| 72 |
labeled = label(mask, connectivity=2)
|
| 73 |
out: List[Box] = []
|
| 74 |
for p in regionprops(labeled):
|
|
|
|
| 13 |
from PIL import Image, ImageChops, ImageDraw, UnidentifiedImageError
|
| 14 |
from pdf2image import convert_from_path
|
| 15 |
from skimage.measure import label, regionprops
|
| 16 |
+
from skimage.morphology import dilation, rectangle
|
| 17 |
import gradio as gr
|
| 18 |
|
| 19 |
# Optional features
|
|
|
|
| 68 |
arr = np.asarray(diff_img).astype(np.uint16)
|
| 69 |
gray = arr.max(axis=2).astype(np.uint8)
|
| 70 |
mask = (gray >= threshold).astype(np.uint8)
|
| 71 |
+
mask = dilation(mask, rectangle(3, 3))
|
| 72 |
labeled = label(mask, connectivity=2)
|
| 73 |
out: List[Box] = []
|
| 74 |
for p in regionprops(labeled):
|