-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/v0.1.5' into develop
- Loading branch information
Showing
22 changed files
with
395 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[run] | ||
source = colour_checker_detection | ||
sigterm = True | ||
[report] | ||
exclude_lines = | ||
pragma: no cover | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
*.pyc | ||
*.pyo | ||
.DS_Store | ||
.coverage | ||
.coverage* | ||
.fleet | ||
.idea | ||
.ipynb_checkpoints | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,5 @@ About | |
|
||
| **Colour - Checker Detection** by Colour Developers | ||
| Copyright 2018 Colour Developers – `[email protected] <[email protected]>`__ | ||
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause | ||
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause | ||
| `https://github.com/colour-science/colour-checker-detection <https://github.com/colour-science/colour-checker-detection>`__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,11 @@ | ||
Copyright 2018 Colour Developers | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
* Neither the name of the Colour Developers nor the | ||
names of its contributors may be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL COLOUR DEVELOPERS BE LIABLE FOR ANY | ||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,11 @@ Colour - Checker Detection | |
.. end-badges | ||
A `Python <https://www.python.org/>`__ package implementing various colour | ||
A `Python <https://www.python.org>`__ package implementing various colour | ||
checker detection algorithms and related utilities. | ||
|
||
It is open source and freely available under the | ||
`New BSD License <https://opensource.org/licenses/BSD-3-Clause>`__ terms. | ||
`BSD-3-Clause <https://opensource.org/licenses/BSD-3-Clause>`__ terms. | ||
|
||
.. image:: https://raw.githubusercontent.com/colour-science/colour-checker-detection/master/docs/_static/ColourCheckerDetection_001.png | ||
|
||
|
@@ -66,12 +66,12 @@ Primary Dependencies | |
|
||
**Colour - Checker Detection** requires various dependencies in order to run: | ||
|
||
- `python >= 3.8, < 4 <https://www.python.org/download/releases/>`__ | ||
- `colour-science >= 4 <https://pypi.org/project/colour-science/>`__ | ||
- `imageio >= 2, < 3 <https://imageio.github.io/>`__ | ||
- `numpy >= 1.19, < 2 <https://pypi.org/project/numpy/>`__ | ||
- `opencv-python >= 4, < 5 <https://pypi.org/project/opencv-python/>`__ | ||
- `scipy >= 1.5, < 2 <https://pypi.org/project/scipy/>`__ | ||
- `python >= 3.9, < 4 <https://www.python.org/download/releases>`__ | ||
- `colour-science >= 4.3 <https://pypi.org/project/colour-science>`__ | ||
- `imageio >= 2, < 3 <https://imageio.github.io>`__ | ||
- `numpy >= 1.22, < 2 <https://pypi.org/project/numpy>`__ | ||
- `opencv-python >= 4, < 5 <https://pypi.org/project/opencv-python>`__ | ||
- `scipy >= 1.8, < 2 <https://pypi.org/project/scipy>`__ | ||
|
||
Pypi | ||
~~~~ | ||
|
@@ -90,7 +90,7 @@ Contributing | |
^^^^^^^^^^^^ | ||
|
||
If you would like to contribute to `Colour - Checker Detection <https://github.com/colour-science/colour-checker-detection>`__, | ||
please refer to the following `Contributing <https://www.colour-science.org/contributing/>`__ | ||
please refer to the following `Contributing <https://www.colour-science.org/contributing>`__ | ||
guide for `Colour <https://github.com/colour-science/colour>`__. | ||
|
||
Bibliography | ||
|
@@ -110,7 +110,7 @@ Code of Conduct | |
--------------- | ||
|
||
The *Code of Conduct*, adapted from the `Contributor Covenant 1.4 <https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>`__, | ||
is available on the `Code of Conduct <https://www.colour-science.org/code-of-conduct/>`__ page. | ||
is available on the `Code of Conduct <https://www.colour-science.org/code-of-conduct>`__ page. | ||
|
||
Contact & Social | ||
---------------- | ||
|
@@ -128,5 +128,5 @@ About | |
|
||
| **Colour - Checker Detection** by Colour Developers | ||
| Copyright 2018 Colour Developers – `[email protected] <[email protected]>`__ | ||
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause | ||
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause | ||
| `https://github.com/colour-science/colour-checker-detection <https://github.com/colour-science/colour-checker-detection>`__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ TODO | |
|
||
- colour_checker_detection/__init__.py | ||
|
||
- Line 81 : # TODO: Remove legacy printing support when deemed appropriate. | ||
- Line 84 : # TODO: Remove legacy printing support when deemed appropriate. | ||
|
||
|
||
- colour_checker_detection/detection/tests/test_segmentation.py | ||
|
@@ -18,6 +18,6 @@ About | |
----- | ||
|
||
| **Colour - Checker Detection** by Colour Developers | ||
| Copyright 2018 Colour Developers – `[email protected] <[email protected]>`__ | ||
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause | ||
| Copyright 2018 Colour Developers - `[email protected] <[email protected]>`__ | ||
| This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause | ||
| `https://github.com/colour-science/colour-checker-detection <https://github.com/colour-science/colour-checker-detection>`__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
import cv2 | ||
import numpy as np | ||
import os | ||
import subprocess # nosec | ||
import subprocess | ||
|
||
import colour | ||
|
||
|
@@ -29,7 +29,7 @@ | |
|
||
__author__ = "Colour Developers" | ||
__copyright__ = "Copyright 2018 Colour Developers" | ||
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" | ||
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" | ||
__maintainer__ = "Colour Developers" | ||
__email__ = "[email protected]" | ||
__status__ = "Production" | ||
|
@@ -61,8 +61,8 @@ | |
|
||
try: | ||
_version = ( | ||
subprocess.check_output( # nosec | ||
["git", "describe"], | ||
subprocess.check_output( | ||
["git", "describe"], # noqa: S603, S607 | ||
cwd=os.path.dirname(__file__), | ||
stderr=subprocess.STDOUT, | ||
) | ||
|
@@ -77,7 +77,7 @@ | |
] = _version | ||
colour.utilities.ANCILLARY_RUNTIME_PACKAGES[ # pyright: ignore | ||
"opencv" | ||
] = cv2.__version__ | ||
] = cv2.__version__ # pyright: ignore | ||
|
||
del _version | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,8 +41,9 @@ | |
MixinDataclassIterable, | ||
Structure, | ||
as_float_array, | ||
as_int_array, | ||
as_int, | ||
as_int_array, | ||
as_int_scalar, | ||
orient, | ||
usage_warning, | ||
) | ||
|
@@ -53,7 +54,7 @@ | |
|
||
__author__ = "Colour Developers" | ||
__copyright__ = "Copyright 2018 Colour Developers" | ||
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" | ||
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" | ||
__maintainer__ = "Colour Developers" | ||
__email__ = "[email protected]" | ||
__status__ = "Production" | ||
|
@@ -210,7 +211,7 @@ def swatch_masks( | |
return tuple(masks) | ||
|
||
|
||
def as_8_bit_BGR_image(image: ArrayLike) -> NDArrayFloat: | ||
def as_8_bit_BGR_image(image: ArrayLike) -> NDArrayInt: | ||
""" | ||
Convert and encodes given linear float *RGB* image to 8-bit *BGR* with | ||
*sRGB* reverse OETF. | ||
|
@@ -280,7 +281,7 @@ def as_8_bit_BGR_image(image: ArrayLike) -> NDArrayFloat: | |
if image.dtype == np.uint8: | ||
return image | ||
|
||
return cv2.cvtColor( | ||
return cv2.cvtColor( # pyright: ignore | ||
cast(NDArrayFloat, cctf_encoding(image) * 255).astype(np.uint8), | ||
cv2.COLOR_RGB2BGR, | ||
) | ||
|
@@ -346,11 +347,11 @@ def adjust_image( | |
ratio = width / target_width | ||
|
||
if np.allclose(ratio, 1): | ||
return cast(NDArrayFloat, image) | ||
return image | ||
else: | ||
return cv2.resize( | ||
return cv2.resize( # pyright: ignore | ||
image, | ||
(as_int(target_width), as_int(height / ratio)), | ||
(as_int_scalar(target_width), as_int_scalar(height / ratio)), | ||
interpolation=interpolation_method, | ||
) | ||
|
||
|
@@ -383,7 +384,7 @@ def is_square(contour: ArrayLike, tolerance: float = 0.015) -> bool: | |
|
||
return ( | ||
cv2.matchShapes( | ||
contour, | ||
contour, # pyright: ignore | ||
np.array([[0, 0], [1, 0], [1, 1], [0, 1]]), | ||
cv2.CONTOURS_MATCH_I2, | ||
0.0, | ||
|
@@ -418,7 +419,7 @@ def contour_centroid(contour: ArrayLike) -> Tuple[float, float]: | |
(0.5, 0.5) | ||
""" | ||
|
||
moments = cv2.moments(contour) | ||
moments = cv2.moments(contour) # pyright: ignore | ||
centroid = ( | ||
moments["m10"] / moments["m00"], | ||
moments["m01"] / moments["m00"], | ||
|
@@ -535,7 +536,7 @@ def crop_and_level_image_with_rectangle( | |
if image_c.shape[0] > image_c.shape[1]: | ||
image_c = orient(image_c, "90 CW") | ||
|
||
return image_c | ||
return image_c # pyright: ignore | ||
|
||
|
||
@dataclass | ||
|
@@ -786,7 +787,10 @@ def colour_checkers_coordinates_segmentation( | |
|
||
if additional_data: | ||
return DataColourCheckersCoordinatesSegmentation( | ||
tuple(colour_checkers), tuple(clusters), tuple(swatches), image_c | ||
tuple(colour_checkers), | ||
tuple(clusters), | ||
tuple(swatches), | ||
image_c, # pyright: ignore | ||
) | ||
else: | ||
return colour_checkers | ||
|
@@ -934,7 +938,9 @@ def extract_colour_checkers_segmentation( | |
colour_checkers_coordinates_segmentation(image, **settings), | ||
): | ||
colour_checker = crop_and_level_image_with_rectangle( | ||
image, cv2.minAreaRect(rectangle), settings.interpolation_method | ||
image, | ||
cv2.minAreaRect(rectangle), # pyright: ignore | ||
settings.interpolation_method, | ||
) | ||
width, height = (colour_checker.shape[1], colour_checker.shape[0]) | ||
|
||
|
@@ -974,9 +980,9 @@ def detect_colour_checkers_segmentation( | |
samples: int = 16, | ||
additional_data: bool = False, | ||
**kwargs: Any, | ||
) -> Tuple[DataDetectColourCheckersSegmentation, ...] | Tuple[ | ||
NDArrayFloat, ... | ||
]: | ||
) -> ( | ||
Tuple[DataDetectColourCheckersSegmentation, ...] | Tuple[NDArrayFloat, ...] | ||
): | ||
""" | ||
Detect the colour checkers swatches in given image using segmentation. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
|
||
__author__ = "Colour Developers" | ||
__copyright__ = "Copyright 2018 Colour Developers" | ||
__license__ = "New BSD License - https://opensource.org/licenses/BSD-3-Clause" | ||
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" | ||
__maintainer__ = "Colour Developers" | ||
__email__ = "[email protected]" | ||
__status__ = "Production" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.