stouputils.data_science.data_processing.prosthesis_detection module#
- get_brightness_score(image: ndarray[Any, dtype[Any]], rect: Any, percentile: int = 95) float [source]#
Compute brightness score using high-percentile pixel intensity.
- get_contrast_score(image: ndarray[Any, dtype[Any]], rect: Any) float [source]#
Compute contrast score between object and surrounding background.
- get_corners_distance(rect: Any, image_shape: tuple[int, int]) float [source]#
Compute average distance between rectangle corners and image center.
- get_box_overlap_ratio(box1: Any, box2: Any) float [source]#
Compute overlap ratio between two bounding boxes with intersection area.
- get_fracture_score(image: ndarray[Any, dtype[Any]], rect: Any, padding: int = 20) float [source]#
Compute fracture score based on bone fractures around prosthesis.
- keep_bright_enough_parts(image: ndarray[Any, dtype[Any]], window_size: int = 101, invert: bool = False, debug_level: int = 0) ndarray[Any, dtype[Any]] [source]#
Keep only the brightest parts of the image.
For each pixel, if the window around it is brighter than 60% of the brightest pixels in the image, keep it.
- Parameters:
image (NDArray[Any]) – Image to process.
window_size (int) – Size of the window to consider around each pixel.
invert (bool) – Instead of keeping the brightest parts, keep the darkest parts.
debug_level (int) – Debug level.
- Returns:
Processed image with only bright parts preserved.
- Return type:
NDArray[Any]