stouputils.data_science.data_processing.prosthesis_detection module#
- get_brightness_score(
- image: ndarray[tuple[int, ...], dtype[Any]],
- rect: Any,
- percentile: int = 95,
Compute brightness score using high-percentile pixel intensity.
- get_contrast_score(
- image: ndarray[tuple[int, ...], dtype[Any]],
- rect: Any,
Compute contrast score between object and surrounding background.
- get_corners_distance(
- rect: Any,
- image_shape: tuple[int, int],
Compute average distance between rectangle corners and image center.
- get_box_overlap_ratio(
- box1: Any,
- box2: Any,
Compute overlap ratio between two bounding boxes with intersection area.
- get_fracture_score(
- image: ndarray[tuple[int, ...], dtype[Any]],
- rect: Any,
- padding: int = 20,
Compute fracture score based on bone fractures around prosthesis.
- keep_bright_enough_parts(
- image: ndarray[tuple[int, ...], dtype[Any]],
- window_size: int = 101,
- invert: bool = False,
- debug_level: int = 0,
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]