Skip to content

Commit 07b9a7b

Browse files
committed
Merge branch 'feature/v0.1.4' into develop
2 parents fd346a1 + be0ef32 commit 07b9a7b

16 files changed

+231
-205
lines changed

.github/workflows/continuous-integration-documentation.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ jobs:
77
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
88
strategy:
99
matrix:
10-
os: [ubuntu-20.04]
11-
python-version: [3.8]
10+
os: [ubuntu-22.04]
11+
python-version: [3.11]
1212
fail-fast: false
1313
runs-on: ${{ matrix.os }}
1414
steps:
1515
- uses: actions/checkout@v1
1616
- name: Environment Variables
1717
run: |
1818
echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
19-
echo "CI_PACKAGE=colour" >> $GITHUB_ENV
19+
echo "CI_PACKAGE=colour_checker_detection" >> $GITHUB_ENV
2020
echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV
2121
echo "MPLBACKEND=AGG" >> $GITHUB_ENV
2222
echo "COLOUR_SCIENCE__DOCUMENTATION_BUILD=True" >> $GITHUB_ENV
@@ -31,8 +31,7 @@ jobs:
3131
sudo apt-get --yes install latexmk texlive-full
3232
- name: Install Poetry
3333
run: |
34-
curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py
35-
python get-poetry.py
34+
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
3635
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
3736
shell: bash
3837
- name: Install Package Dependencies

.github/workflows/continuous-integration-quality-unit-tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ jobs:
77
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
88
strategy:
99
matrix:
10-
os: [macOS-latest, ubuntu-20.04, windows-2019]
11-
python-version: [3.8, 3.9, '3.10']
10+
os: [macOS-latest, ubuntu-22.04, windows-2019]
11+
python-version: [3.9, '3.10', 3.11]
1212
fail-fast: false
1313
runs-on: ${{ matrix.os }}
1414
steps:
@@ -22,14 +22,17 @@ jobs:
2222
echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV
2323
echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV
2424
shell: bash
25+
- name: Set up Python 3.9 for Pre-Commit
26+
uses: actions/setup-python@v1
27+
with:
28+
python-version: 3.9
2529
- name: Set up Python ${{ matrix.python-version }}
2630
uses: actions/setup-python@v1
2731
with:
2832
python-version: ${{ matrix.python-version }}
2933
- name: Install Poetry
3034
run: |
31-
curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py
32-
python get-poetry.py --version 1.1.12
35+
curl -sSL https://install.python-poetry.org | POETRY_HOME=$HOME/.poetry python3 -
3336
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
3437
shell: bash
3538
- name: Install Package Dependencies

.github/workflows/continuous-integration-static-type-checking.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ jobs:
88
strategy:
99
matrix:
1010
os: [macOS-latest]
11-
python-version: [3.9]
11+
python-version: [3.11]
1212
fail-fast: false
1313
runs-on: ${{ matrix.os }}
1414
steps:
1515
- uses: actions/checkout@v1
1616
- name: Environment Variables
1717
run: |
18-
echo "CI_PACKAGE=colour" >> $GITHUB_ENV
18+
echo "CI_PACKAGE=colour_checker_detection" >> $GITHUB_ENV
1919
shell: bash
2020
- name: Set up Python ${{ matrix.python-version }}
2121
uses: actions/setup-python@v1
2222
with:
2323
python-version: ${{ matrix.python-version }}
24-
- name: Static Type Checking
24+
- name: Install Package Dependencies
2525
run: |
2626
pip install -r requirements.txt
27-
mypy --install-types --non-interactive --show-error-codes --warn-unused-ignores --warn-redundant-casts -p $CI_PACKAGE
27+
- name: Static Type Checking
28+
run: |
29+
mypy --install-types --non-interactive --show-error-codes --warn-unused-ignores --warn-redundant-casts $CI_PACKAGE

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
*.egg-info
12
*.pyc
3+
*.pyo
24
.DS_Store
35
.coverage
46
.dmypy.json
7+
.fleet
58
.idea
6-
.ipynb_checkpoints/
9+
.ipynb_checkpoints
710
.mypy_cache
8-
.vscode
911
.sandbox
12+
.vs
13+
.vscode
1014

1115
__pycache__
1216

.pre-commit-config.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
repos:
22
- repo: https://github.com/asottile/pyupgrade
3-
rev: v2.37.3
3+
rev: v3.2.2
44
hooks:
55
- id: pyupgrade
6-
args: [--py38-plus]
6+
args: [--py39-plus]
77
- repo: https://github.com/ikamensh/flynt/
8-
rev: '0.76'
8+
rev: '0.77'
99
hooks:
1010
- id: flynt
1111
- repo: https://github.com/psf/black
12-
rev: 22.6.0
12+
rev: 22.10.0
1313
hooks:
1414
- id: black
15-
language_version: python3.8
15+
language_version: python3.9
16+
- repo: https://github.com/keewis/blackdoc
17+
rev: v0.3.8
18+
hooks:
19+
- id: blackdoc
20+
language_version: python3.9
1621
- repo: https://github.com/PyCQA/flake8
17-
rev: 5.0.3
22+
rev: 6.0.0
1823
hooks:
1924
- id: flake8
2025
- repo: https://github.com/pycqa/pydocstyle
@@ -23,4 +28,4 @@ repos:
2328
- id: pydocstyle
2429
args:
2530
- --convention=numpy
26-
- --add-ignore=D104,D200,D202,D205,D301,D400
31+
- --add-ignore=D104,D200,D202,D205,D301,D400

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
build:
44
os: ubuntu-20.04
55
tools:
6-
python: "3.8"
6+
python: "3.11"
77

88
sphinx:
99
configuration: docs/conf.py

CONTRIBUTORS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Contributors
44
Development & Technical Support
55
-------------------------------
66

7-
- **Thomas Mansencal**, *Lead Pipeline Developer @ WetaFX*
7+
- **Thomas Mansencal**, *Technology Supervisor @ Wētā FX*
88

99
Project coordination, overall development.
1010

colour_checker_detection/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,19 @@
4141
"detect_colour_checkers_segmentation",
4242
]
4343

44-
RESOURCES_DIRECTORY: str = os.path.join(os.path.dirname(__file__), "resources")
45-
EXAMPLES_RESOURCES_DIRECTORY: str = os.path.join(
46-
RESOURCES_DIRECTORY, "colour-checker-detection-examples-datasets"
44+
ROOT_RESOURCES: str = os.path.join(os.path.dirname(__file__), "resources")
45+
ROOT_RESOURCES_EXAMPLES: str = os.path.join(
46+
ROOT_RESOURCES, "colour-checker-detection-examples-datasets"
4747
)
48-
TESTS_RESOURCES_DIRECTORY: str = os.path.join(
49-
RESOURCES_DIRECTORY, "colour-checker-detection-tests-datasets"
48+
ROOT_RESOURCES_TESTS: str = os.path.join(
49+
ROOT_RESOURCES, "colour-checker-detection-tests-datasets"
5050
)
5151

5252
__application_name__ = "Colour - Checker Detection"
5353

5454
__major_version__ = "0"
5555
__minor_version__ = "1"
56-
__change_version__ = "3"
56+
__change_version__ = "4"
5757
__version__ = ".".join(
5858
(__major_version__, __minor_version__, __change_version__)
5959
)

colour_checker_detection/detection/segmentation.py

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def as_8_bit_BGR_image(image: ArrayLike) -> NDArray:
292292
def adjust_image(
293293
image: ArrayLike,
294294
target_width: Integer,
295-
interpolation_method: Literal[ # type: ignore[misc]
295+
interpolation_method: Literal[ # type: ignore[valid-type]
296296
cv2.INTER_AREA,
297297
cv2.INTER_BITS,
298298
cv2.INTER_BITS2,
@@ -465,7 +465,7 @@ def scale_contour(contour: ArrayLike, factor: Floating) -> NDArray:
465465
def crop_and_level_image_with_rectangle(
466466
image: ArrayLike,
467467
rectangle: Tuple[Tuple, Tuple, Floating],
468-
interpolation_method: Literal[ # type: ignore[misc]
468+
interpolation_method: Literal[ # type: ignore[valid-type]
469469
cv2.INTER_AREA,
470470
cv2.INTER_BITS,
471471
cv2.INTER_BITS2,
@@ -499,10 +499,13 @@ def crop_and_level_image_with_rectangle(
499499
--------
500500
>>> import os
501501
>>> from colour import read_image
502-
>>> from colour_checker_detection import TESTS_RESOURCES_DIRECTORY
503-
>>> path = os.path.join(TESTS_RESOURCES_DIRECTORY,
504-
... 'colour_checker_detection', 'detection',
505-
... 'IMG_1967.png')
502+
>>> from colour_checker_detection import ROOT_RESOURCES_TESTS
503+
>>> path = os.path.join(
504+
... ROOT_RESOURCES_TESTS,
505+
... "colour_checker_detection",
506+
... "detection",
507+
... "IMG_1967.png",
508+
... )
506509
>>> image = adjust_image(read_image(path), 1440)
507510
>>> rectangle = (
508511
... (723.29608154, 465.50939941),
@@ -661,10 +664,13 @@ def colour_checkers_coordinates_segmentation(
661664
--------
662665
>>> import os
663666
>>> from colour import read_image
664-
>>> from colour_checker_detection import TESTS_RESOURCES_DIRECTORY
665-
>>> path = os.path.join(TESTS_RESOURCES_DIRECTORY,
666-
... 'colour_checker_detection', 'detection',
667-
... 'IMG_1967.png')
667+
>>> from colour_checker_detection import ROOT_RESOURCES_TESTS
668+
>>> path = os.path.join(
669+
... ROOT_RESOURCES_TESTS,
670+
... "colour_checker_detection",
671+
... "detection",
672+
... "IMG_1967.png",
673+
... )
668674
>>> image = read_image(path)
669675
>>> colour_checkers_coordinates_segmentation(image) # doctest: +ELLIPSIS
670676
(array([[ 369, 688],
@@ -856,10 +862,13 @@ def extract_colour_checkers_segmentation(
856862
--------
857863
>>> import os
858864
>>> from colour import read_image
859-
>>> from colour_checker_detection import TESTS_RESOURCES_DIRECTORY
860-
>>> path = os.path.join(TESTS_RESOURCES_DIRECTORY,
861-
... 'colour_checker_detection', 'detection',
862-
... 'IMG_1967.png')
865+
>>> from colour_checker_detection import ROOT_RESOURCES_TESTS
866+
>>> path = os.path.join(
867+
... ROOT_RESOURCES_TESTS,
868+
... "colour_checker_detection",
869+
... "detection",
870+
... "IMG_1967.png",
871+
... )
863872
>>> image = read_image(path)
864873
>>> extract_colour_checkers_segmentation(image)
865874
... # doctest: +SKIP
@@ -1042,10 +1051,13 @@ def detect_colour_checkers_segmentation(
10421051
--------
10431052
>>> import os
10441053
>>> from colour import read_image
1045-
>>> from colour_checker_detection import TESTS_RESOURCES_DIRECTORY
1046-
>>> path = os.path.join(TESTS_RESOURCES_DIRECTORY,
1047-
... 'colour_checker_detection', 'detection',
1048-
... 'IMG_1967.png')
1054+
>>> from colour_checker_detection import ROOT_RESOURCES_TESTS
1055+
>>> path = os.path.join(
1056+
... ROOT_RESOURCES_TESTS,
1057+
... "colour_checker_detection",
1058+
... "detection",
1059+
... "IMG_1967.png",
1060+
... )
10491061
>>> image = read_image(path)
10501062
>>> detect_colour_checkers_segmentation(image) # doctest: +SKIP
10511063
(array([[ 0.361626... , 0.2241066..., 0.1187837...],
@@ -1115,7 +1127,7 @@ def detect_colour_checkers_segmentation(
11151127
settings.swatches_achromatic_slice,
11161128
]:
11171129
swatch_std_mean = as_float_array(swatch_colours[slice_])
1118-
swatch_std_mean /= swatch_std_mean[..., 1][..., np.newaxis]
1130+
swatch_std_mean /= swatch_std_mean[..., 1][..., None]
11191131
std_means.append(np.mean(np.std(swatch_std_mean, 0)))
11201132
if std_means[0] < std_means[1]:
11211133
usage_warning(

colour_checker_detection/detection/tests/test_segmentation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from colour import read_image
1414
from colour.models import cctf_encoding
1515

16-
from colour_checker_detection import TESTS_RESOURCES_DIRECTORY
16+
from colour_checker_detection import ROOT_RESOURCES_TESTS
1717
from colour_checker_detection.detection.segmentation import (
1818
SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC,
1919
swatch_masks,
@@ -53,7 +53,7 @@
5353
]
5454

5555
DETECTION_DIRECTORY = os.path.join(
56-
TESTS_RESOURCES_DIRECTORY, "colour_checker_detection", "detection"
56+
ROOT_RESOURCES_TESTS, "colour_checker_detection", "detection"
5757
)
5858

5959
PNG_FILES = glob.glob(os.path.join(DETECTION_DIRECTORY, "*.png"))

0 commit comments

Comments
 (0)