Skip to content

Commit a332419

Browse files
committed
Fix corner finding failures
* Remove image dilation step * Implement dynamically sized Gaussian filter box using sqrt(2) as sigma
1 parent 9c32482 commit a332419

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

code/corner_finding.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ def __init__(self,
105105
def find_corner_marks(image: np.ndarray) -> geometry_utils.Polygon:
106106
# Dilating helps find corner marks, but we don't want to mess up bubble fills
107107
# so it's only dilated after passing here
108-
dilated_image = image_utils.dilate(image)
108+
# dilated_image = image_utils.dilate(image)
109109
all_polygons: typing.List[
110-
geometry_utils.Polygon] = image_utils.find_polygons(dilated_image)
110+
geometry_utils.Polygon] = image_utils.find_polygons(image)
111111

112112
# Even though the LMark and SquareMark classes check length, it's faster to
113113
# filter out the shapes of incorrect length despite the increased time

code/image_utils.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Image filtering and processing utilities."""
22

3+
import math
34
import pathlib
45
import typing
56

@@ -18,7 +19,7 @@ def convert_to_grayscale(image: np.array) -> np.ndarray:
1819

1920
def remove_hf_noise(image: np.array) -> np.ndarray:
2021
"""Blur image slightly to remove high-frequency noise."""
21-
return cv2.GaussianBlur(image, (3, 3), 0)
22+
return cv2.GaussianBlur(image, (0, 0), sigmaX=math.sqrt(2))
2223

2324

2425
def detect_edges(image: np.array) -> np.ndarray:

0 commit comments

Comments
 (0)