MCPcopy Create free account
hub / github.com/Vinyzu/recognizer / is_tile_fully_enclosed

Function is_tile_fully_enclosed

recognizer/components/detection_processor.py:73–83  ·  view source on GitHub ↗
(tile_corners, threshold_image)

Source from the content-addressed store, hash-verified

71
72 # Function to check if all corners are inside the mask
73 def is_tile_fully_enclosed(tile_corners, threshold_image):
74 for corner in tile_corners:
75 x, y = corner
76 # Check if x, y are within the bounds of the threshold_image
77 if not (0 <= x < threshold_image.shape[1] and 0 <= y < threshold_image.shape[0]):
78 return False
79
80 # Check if the corner is inside the mask (non-zero pixel)
81 if threshold_image[y, x] == 0: # 0 means the pixel is outside the contour
82 return False
83 return True
84
85 response[tile_index] = is_tile_fully_enclosed(corners, threshold_image)
86

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected