Skip to content

Commit

Permalink
Fix Segmentation Tile Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinyzu committed Jan 12, 2025
1 parent e36d47f commit ae9ca30
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recognizer/components/detection_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def calculate_segmentation_response(
def is_tile_fully_enclosed(tile_corners, threshold_image):
for corner in tile_corners:
x, y = corner
# Check if x, y are within the bounds of the threshold_image
if not (0 <= x < threshold_image.shape[1] and 0 <= y < threshold_image.shape[0]):
return False

# Check if the corner is inside the mask (non-zero pixel)
if threshold_image[y, x] == 0: # 0 means the pixel is outside the contour
return False
Expand Down

0 comments on commit ae9ca30

Please sign in to comment.