Calculate all Haralick descriptors for a sequence of different co-occurrence matrices, given input masks and coordinates. Example: >>> img = np.array([[[108, 201, 72], [255, 11, 127]], ... [[56, 56, 56], [128, 255, 107]]]) >>> gray = grayscale
(
masks: tuple[np.ndarray, np.ndarray], coordinate: tuple[int, int]
)
| 311 | |
| 312 | |
| 313 | def get_descriptors( |
| 314 | masks: tuple[np.ndarray, np.ndarray], coordinate: tuple[int, int] |
| 315 | ) -> np.ndarray: |
| 316 | """ |
| 317 | Calculate all Haralick descriptors for a sequence of |
| 318 | different co-occurrence matrices, given input masks and coordinates. |
| 319 | |
| 320 | Example: |
| 321 | >>> img = np.array([[[108, 201, 72], [255, 11, 127]], |
| 322 | ... [[56, 56, 56], [128, 255, 107]]]) |
| 323 | >>> gray = grayscale(img) |
| 324 | >>> binary = binarize(gray) |
| 325 | >>> morphological = opening_filter(binary) |
| 326 | >>> get_descriptors(binary_mask(gray, morphological), (0, 1)) |
| 327 | array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]) |
| 328 | """ |
| 329 | descriptors = np.array( |
| 330 | [haralick_descriptors(matrix_concurrency(mask, coordinate)) for mask in masks] |
| 331 | ) |
| 332 | |
| 333 | # Concatenate each individual descriptor into |
| 334 | # one single list containing sequence of descriptors |
| 335 | return np.concatenate(descriptors, axis=None) |
| 336 | |
| 337 | |
| 338 | def euclidean(point_1: np.ndarray, point_2: np.ndarray) -> float: |
no test coverage detected