Skip to content

Commit 23a5e6b

Browse files
committed
Update various private class names.
1 parent 5d89dfa commit 23a5e6b

File tree

1 file changed

+60
-57
lines changed

1 file changed

+60
-57
lines changed

colour_checker_detection/detection/segmentation.py

Lines changed: 60 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@
6464
"SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC",
6565
"SETTINGS_SEGMENTATION_COLORCHECKER_SG",
6666
"FLOAT_DTYPE_DEFAULT",
67-
"ColourCheckersDetectionData",
68-
"ColourCheckerSwatchesData",
6967
"swatch_masks",
7068
"as_8_bit_BGR_image",
7169
"adjust_image",
7270
"is_square",
7371
"contour_centroid",
7472
"scale_contour",
7573
"crop_and_level_image_with_rectangle",
74+
"DataColourCheckersCoordinatesSegmentation",
7675
"colour_checkers_coordinates_segmentation",
7776
"extract_colour_checkers_segmentation",
77+
"DataDetectColourCheckersSegmentation",
7878
"detect_colour_checkers_segmentation",
7979
]
8080

@@ -149,52 +149,6 @@
149149
"""Dtype used for the computations."""
150150

151151

152-
@dataclass
153-
class ColourCheckersDetectionData(MixinDataclassIterable):
154-
"""
155-
Colour checkers detection data used for plotting, debugging and further
156-
analysis.
157-
158-
Parameters
159-
----------
160-
colour_checkers
161-
Colour checker bounding boxes, i.e., the. clusters that have the
162-
relevant count of swatches.
163-
clusters
164-
Detected swatches clusters.
165-
swatches
166-
Detected swatches.
167-
segmented_image
168-
Thresholded/Segmented image.
169-
"""
170-
171-
colour_checkers: Tuple[NDArray, ...]
172-
clusters: Tuple[NDArray, ...]
173-
swatches: Tuple[NDArray, ...]
174-
segmented_image: NDArray
175-
176-
177-
@dataclass
178-
class ColourCheckerSwatchesData(MixinDataclassIterable):
179-
"""
180-
Colour checker swatches data used for plotting, debugging and further
181-
analysis.
182-
183-
Parameters
184-
----------
185-
swatch_colours
186-
Colour checker swatches colours.
187-
colour_checker_image
188-
Cropped and levelled Colour checker image.
189-
swatch_masks
190-
Colour checker swatches masks.
191-
"""
192-
193-
swatch_colours: Tuple[NDArray, ...]
194-
colour_checker_image: NDArray
195-
swatch_masks: Tuple[NDArray, ...]
196-
197-
198152
def swatch_masks(
199153
width: Integer,
200154
height: Integer,
@@ -584,9 +538,34 @@ def crop_and_level_image_with_rectangle(
584538
return image_c
585539

586540

541+
@dataclass
542+
class DataColourCheckersCoordinatesSegmentation(MixinDataclassIterable):
543+
"""
544+
Colour checkers detection data used for plotting, debugging and further
545+
analysis.
546+
547+
Parameters
548+
----------
549+
colour_checkers
550+
Colour checker bounding boxes, i.e., the. clusters that have the
551+
relevant count of swatches.
552+
clusters
553+
Detected swatches clusters.
554+
swatches
555+
Detected swatches.
556+
segmented_image
557+
Thresholded/Segmented image.
558+
"""
559+
560+
colour_checkers: Tuple[NDArray, ...]
561+
clusters: Tuple[NDArray, ...]
562+
swatches: Tuple[NDArray, ...]
563+
segmented_image: NDArray
564+
565+
587566
def colour_checkers_coordinates_segmentation(
588567
image: ArrayLike, additional_data: Boolean = False, **kwargs: Any
589-
) -> Union[ColourCheckersDetectionData, Tuple[NDArray, ...]]:
568+
) -> Union[DataColourCheckersCoordinatesSegmentation, Tuple[NDArray, ...]]:
590569
"""
591570
Detect the colour checkers coordinates in given image :math:`image` using
592571
segmentation.
@@ -669,10 +648,10 @@ def colour_checkers_coordinates_segmentation(
669648
Returns
670649
-------
671650
:class:`colour_checker_detection.detection.segmentation.\
672-
ColourCheckersDetectionData` or :class:`tuple`
651+
DataColourCheckersCoordinatesSegmentation` or :class:`tuple`
673652
Tuple of colour checkers coordinates or
674-
:class:`ColourCheckersDetectionData` class instance with additional
675-
data.
653+
:class:`DataColourCheckersCoordinatesSegmentation` class
654+
instance with additional data.
676655
677656
Notes
678657
-----
@@ -803,7 +782,7 @@ def colour_checkers_coordinates_segmentation(
803782
colour_checkers = tuple(clusters[i] for i in indexes)
804783

805784
if additional_data:
806-
return ColourCheckersDetectionData(
785+
return DataColourCheckersCoordinatesSegmentation(
807786
tuple(colour_checkers), tuple(clusters), tuple(swatches), image_c
808787
)
809788
else:
@@ -963,12 +942,36 @@ def extract_colour_checkers_segmentation(
963942
return tuple(colour_checkers)
964943

965944

945+
@dataclass
946+
class DataDetectColourCheckersSegmentation(MixinDataclassIterable):
947+
"""
948+
Colour checker swatches data used for plotting, debugging and further
949+
analysis.
950+
951+
Parameters
952+
----------
953+
swatch_colours
954+
Colour checker swatches colours.
955+
colour_checker_image
956+
Cropped and levelled Colour checker image.
957+
swatch_masks
958+
Colour checker swatches masks.
959+
"""
960+
961+
swatch_colours: Tuple[NDArray, ...]
962+
colour_checker_image: NDArray
963+
swatch_masks: Tuple[NDArray, ...]
964+
965+
966966
def detect_colour_checkers_segmentation(
967967
image: ArrayLike,
968968
samples: Integer = 16,
969969
additional_data: Boolean = False,
970970
**kwargs: Any,
971-
) -> Union[Tuple[ColourCheckerSwatchesData, ...], Tuple[NDArray, ...]]:
971+
) -> Union[
972+
Tuple[DataDetectColourCheckersSegmentation, ...],
973+
Tuple[NDArray, ...],
974+
]:
972975
"""
973976
Detect the colour checkers swatches in given image using segmentation.
974977
@@ -1032,8 +1035,8 @@ def detect_colour_checkers_segmentation(
10321035
Returns
10331036
-------
10341037
:class`tuple`
1035-
Tuple of :class:`ColourCheckerSwatchesData` class instances or
1036-
colour checkers swatches.
1038+
Tuple of :class:`DataDetectColourCheckersSegmentation` class
1039+
instances or colour checkers swatches.
10371040
10381041
Examples
10391042
--------
@@ -1126,7 +1129,7 @@ def detect_colour_checkers_segmentation(
11261129

11271130
if additional_data:
11281131
return tuple(
1129-
ColourCheckerSwatchesData(
1132+
DataDetectColourCheckersSegmentation(
11301133
tuple(colour_checkers_colours[i]), *colour_checkers_data[i]
11311134
)
11321135
for i, colour_checker_colours in enumerate(colour_checkers_colours)

0 commit comments

Comments
 (0)