Skip to content

Commit

Permalink
Merge branch 'release/v0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Nov 28, 2020
2 parents 3265ba8 + 519680c commit 751c549
Show file tree
Hide file tree
Showing 22 changed files with 423 additions and 320 deletions.
127 changes: 21 additions & 106 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,134 +3,49 @@ name: Continuous Integration
on: [push, pull_request]

jobs:
unix-build:
name: Unix Build
continuous-integration:
name: ${{ matrix.os }} - Python ${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-18.04, macOS-10.14]
python-version: [3.6, 3.7]
os: [macOS-latest, ubuntu-18.04, windows-2019]
python-version: [3.6, 3.7, 3.8]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Environment Variables
run: |
CI_PYTHON_VERSION=${{ matrix.python-version }}
CI_PACKAGE=colour_checker_detection
CI_SHA=${{ github.sha }}
CI_SLACK_WEBHOOK=${{ secrets.SLACK_WEBHOOK }}
CI_SLACK_SUCCESS_NOTIFICATION="payload={\"attachments\": [{\"color\": \"#4CAF50\", \"author_name\": \"Python ${{ matrix.python-version }} build on ${{ matrix.os }}\", \"text\": \"Build for commit *${CI_SHA:0:7}* succeeded!\", \"title\": \"${{ github.repository }}@${{ github.ref }}\", \"title_link\": \"https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks\", \"footer\": \"Triggered by ${{ github.actor }}\"}], \"username\":\"Github Actions @ ${{ github.repository }}\", \"channel\":\"#continuous-integration\", \"icon_url\":\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}"
CI_SLACK_FAILURE_NOTIFICATION="${CI_SLACK_SUCCESS_NOTIFICATION/4CAF50/F44336}"
CI_SLACK_FAILURE_NOTIFICATION="${CI_SLACK_FAILURE_NOTIFICATION/succeeded/failed}"
COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}
echo ::set-env name=CI_PYTHON_VERSION::$CI_PYTHON_VERSION
echo ::set-env name=CI_PACKAGE::$CI_PACKAGE
echo ::set-env name=CI_SHA::$CI_SHA
echo ::set-env name=CI_SLACK_WEBHOOK::$CI_SLACK_WEBHOOK
echo ::set-env name=CI_SLACK_SUCCESS_NOTIFICATION::$CI_SLACK_SUCCESS_NOTIFICATION
echo ::set-env name=CI_SLACK_FAILURE_NOTIFICATION::$CI_SLACK_FAILURE_NOTIFICATION
echo ::set-env name=COVERALLS_REPO_TOKEN::$COVERALLS_REPO_TOKEN
echo "CI_PYTHON_VERSION=${{ matrix.python-version }}" >> $GITHUB_ENV
echo "CI_PACKAGE=colour_checker_detection" >> $GITHUB_ENV
echo "CI_SHA=${{ github.sha }}" >> $GITHUB_ENV
echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV
shell: bash
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py
python get-poetry.py --preview
PATH=$HOME/.poetry/bin:$PATH
echo ::set-env name=PATH::$PATH
python get-poetry.py --version 1.0.10
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
shell: bash
- name: Install Package Dependencies
run: |
poetry install
source $(poetry env info -p)/bin/activate
python -c "import imageio;imageio.plugins.freeimage.download()"
poetry run python -c "import imageio;imageio.plugins.freeimage.download()"
shell: bash
- name: Lint with flake8
run: |
source $(poetry env info -p)/bin/activate
flake8 $CI_PACKAGE --count --show-source --statistics
poetry run flake8 $CI_PACKAGE --count --show-source --statistics
shell: bash
- name: Test with nosetests
run: |
source $(poetry env info -p)/bin/activate
python -W ignore -m nose -v --nocapture --with-doctest --doctest-options=+ELLIPSIS --with-coverage --cover-package=$CI_PACKAGE $CI_PACKAGE
poetry run python -W ignore -m nose -q -v --with-doctest --doctest-options=+ELLIPSIS --with-coverage --cover-package=$CI_PACKAGE $CI_PACKAGE
shell: bash
- name: Upload Coverage to coveralls.io
if: matrix.python-version == '3.6' || matrix.python-version == '3.7'
run: |
source $(poetry env info -p)/bin/activate
if [ -z "$COVERALLS_REPO_TOKEN" ]; then echo \"COVERALLS_REPO_TOKEN\" secret is undefined!; else coveralls; fi
- name: Notify Slack
if: always()
run: |
if [ "${{ job.status }}" == "Success" ]; then CI_SLACK_NOTIFICATION="$CI_SLACK_SUCCESS_NOTIFICATION"; else CI_SLACK_NOTIFICATION="$CI_SLACK_FAILURE_NOTIFICATION"; fi
if [ -z "$CI_SLACK_WEBHOOK" ]; then echo \"SLACK_WEBHOOK\" secret is undefined!; else curl -k -d "$CI_SLACK_NOTIFICATION" -X POST $CI_SLACK_WEBHOOK; fi
windows-build:
name: Windows Build
strategy:
matrix:
os: [windows-2019]
python-version: [3.6, 3.7]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Environment Variables
run: |
set CI_PYTHON_VERSION=${{ matrix.python-version }}
set CI_PACKAGE=colour_checker_detection
set CI_SHA=${{ github.sha }}
set CI_SLACK_WEBHOOK=${{ secrets.SLACK_WEBHOOK }}
set CI_SLACK_SUCCESS_NOTIFICATION="payload={\"attachments\": [{\"color\": \"#4CAF50\", \"author_name\": \"Python ${{ matrix.python-version }} build on ${{ matrix.os }}\", \"text\": \"Build for commit *"%CI_SHA:~0,7%"* succeeded!\", \"title\": \"${{ github.repository }}@${{ github.ref }}\", \"title_link\": \"https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks\", \"footer\": \"Triggered by ${{ github.actor }}\"}], \"username\":\"Github Actions @ ${{ github.repository }}\", \"channel\":\"#continuous-integration\", \"icon_url\":\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}"
set CI_SLACK_FAILURE_NOTIFICATION=%CI_SLACK_SUCCESS_NOTIFICATION:4CAF50=F44336%
set CI_SLACK_FAILURE_NOTIFICATION=%CI_SLACK_FAILURE_NOTIFICATION:succeeded=failed%
set COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}
echo ::set-env name=CI_PYTHON_VERSION::%CI_PYTHON_VERSION%
echo ::set-env name=CI_PACKAGE::%CI_PACKAGE%
echo ::set-env name=CI_SHA::%CI_SHA%
echo ::set-env name=CI_SLACK_WEBHOOK::%CI_SLACK_WEBHOOK%
echo ::set-env name=CI_SLACK_SUCCESS_NOTIFICATION::%CI_SLACK_SUCCESS_NOTIFICATION%
echo ::set-env name=CI_SLACK_FAILURE_NOTIFICATION::%CI_SLACK_FAILURE_NOTIFICATION%
echo ::set-env name=COVERALLS_REPO_TOKEN::%COVERALLS_REPO_TOKEN%
shell: cmd
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
curl -L https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -o get-poetry.py
python get-poetry.py --preview
set PATH=%USERPROFILE%\.poetry\bin;%PATH%
echo ::set-env name=PATH::%PATH%
shell: cmd
- name: Install Package Dependencies
run: |
call poetry install
FOR /F %%a IN ('poetry env info -p') DO SET CI_VIRTUAL_ENVIRONMENT=%%a
echo ::set-env name=CI_VIRTUAL_ENVIRONMENT::%CI_VIRTUAL_ENVIRONMENT%
call %CI_VIRTUAL_ENVIRONMENT%\scripts\activate
python -c "import imageio;imageio.plugins.freeimage.download()"
shell: cmd
- name: Lint with flake8
run: |
call %CI_VIRTUAL_ENVIRONMENT%\scripts\activate
flake8 %CI_PACKAGE% --count --show-source --statistics
shell: cmd
- name: Test with nosetests
run: |
call %CI_VIRTUAL_ENVIRONMENT%\scripts\activate
python -W ignore -m nose -v --nocapture --with-doctest --doctest-options=+ELLIPSIS --with-coverage --cover-package=%CI_PACKAGE% %CI_PACKAGE%
shell: cmd
- name: Upload Coverage to coveralls.io
if: matrix.python-version == '3.6' || matrix.python-version == '3.7'
run: |
call %CI_VIRTUAL_ENVIRONMENT%\scripts\activate
IF "%COVERALLS_REPO_TOKEN%"=="" (echo "COVERALLS_REPO_TOKEN" secret is undefined!) ELSE (coveralls)
shell: cmd
- name: Notify Slack
if: always()
run: |
IF "${{ job.status }}"=="Success" (set CI_SLACK_NOTIFICATION=%CI_SLACK_SUCCESS_NOTIFICATION%) ELSE (set CI_SLACK_NOTIFICATION=%CI_SLACK_FAILURE_NOTIFICATION%)
IF "%CI_SLACK_WEBHOOK%"=="" (echo "SLACK_WEBHOOK" secret is undefined!) ELSE (curl -k -d %CI_SLACK_NOTIFICATION% -X POST %CI_SLACK_WEBHOOK%)
shell: cmd
if [ -z "$COVERALLS_REPO_TOKEN" ]; then echo \"COVERALLS_REPO_TOKEN\" secret is undefined!; else poetry run coveralls; fi
shell: bash
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ repos:
rev: 3.7.8
hooks:
- id: flake8
exclude: examples
exclude: examples|setup\.py
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.23.0
hooks:
- id: yapf
exclude: setup\.py
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ build:
image: latest

python:
version: 3.6
version: 3.7
pip_install: true
extra_requirements:
- read-the-docs
4 changes: 2 additions & 2 deletions BIBLIOGRAPHY.bib
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@misc{Abecassis2011,
title = {OpenCV - Rotation (Deskewing)},
author = {Abecassis, Felix},
title = {{OpenCV - Rotation (Deskewing)}},
year = 2011,
url = {http://felix.abecassis.me/2011/10/opencv-rotation-deskewing/},
urldate = {2018-10-27},
year = 2011,
}
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This Code of Conduct applies within all project spaces, and it also applies when
## Enforcement


Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting Thomas Mansencal and Michael Mauderer via email at thomas[email protected] and michael@mauderer.me respectively. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting Thomas Mansencal and Michael Mauderer via email at thomas@colour-science.org and michael@colour-science.org respectively. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ About
-----

| **Colour - Checker Detection** by Colour Developers
| Copyright © 2018-2019 – Colour Developers – `colour-[email protected] <colour-[email protected]>`__
| Copyright © 2018-2020 – Colour Developers – `colour-[email protected] <colour-[email protected]>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-checker-detection <https://github.com/colour-science/colour-checker-detection>`__
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018-2019, Colour Developers
Copyright (c) 2018-2020, Colour Developers
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
16 changes: 8 additions & 8 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Colour - Checker Detection
|actions| |coveralls| |codacy| |version|

.. |actions| image:: https://github.com/colour-science/colour-checker-detection/workflows/Continuous%20Integration/badge.svg
.. |actions| image:: https://img.shields.io/github/workflow/status/colour-science/colour-checker-detection/Continuous%20Integration?label=actions&logo=github&style=flat-square
:target: https://github.com/colour-science/colour-checker-detection/actions
:alt: Develop Build Status
.. |coveralls| image:: http://img.shields.io/coveralls/colour-science/colour-checker-detection/develop.svg?style=flat-square
Expand Down Expand Up @@ -57,22 +57,22 @@ Primary Dependencies

**Colour - Checker Detection** requires various dependencies in order to run:

- `Python >=3.5 <https://www.python.org/download/releases/>`__
- `Colour Science <https://www.colour-science.org>`__
- `opencv-python >=4 <https://pypi.org/project/opencv-python/>`__
- `python>=3.5 <https://www.python.org/download/releases/>`__
- `colour-science <https://pypi.org/project/colour-science/>`__
- `opencv-python>=4 <https://pypi.org/project/opencv-python/>`__

Pypi
^^^^

Once the dependencies satisfied, **Colour - Checker Detection** can be installed from
Once the dependencies are satisfied, **Colour - Checker Detection** can be installed from
the `Python Package Index <http://pypi.python.org/pypi/colour-checker-detection>`__ by
issuing this command in a shell::

pip install colour-checker-detection
pip install --user colour-checker-detection

The overall development dependencies are installed as follows::

pip install 'colour-checker-detection[development]'
pip install --user 'colour-checker-detection[development]'

Usage
-----
Expand Down Expand Up @@ -113,6 +113,6 @@ About
-----

| **Colour - Checker Detection** by Colour Developers
| Copyright © 2018-2019 – Colour Developers – `colour-[email protected] <colour-[email protected]>`__
| Copyright © 2018-2020 – Colour Developers – `colour-[email protected] <colour-[email protected]>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-checker-detection <https://github.com/colour-science/colour-checker-detection>`__
6 changes: 3 additions & 3 deletions TODO.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ TODO

- colour_checker_detection/detection/tests/test_segmentation.py

- Line 207 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
- Line 492 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
- Line 227 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.
- Line 517 : # TODO: Unit test is only reproducible on "macOs", skipping other OSes.

About
-----

| **Colour - Checker Detection** by Colour Developers
| Copyright © 2018-2019 – Colour Developers – `colour-[email protected] <colour-[email protected]>`__
| Copyright © 2018-2020 – Colour Developers – `colour-[email protected] <colour-[email protected]>`__
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
| `https://github.com/colour-science/colour-checker-detection <https://github.com/colour-science/colour-checker-detection>`__
6 changes: 3 additions & 3 deletions colour_checker_detection/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
detect_colour_checkers_segmentation)

__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2018-2019 - Colour Developers'
__copyright__ = 'Copyright (C) 2018-2020 - Colour Developers'
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
__maintainer__ = 'Colour Developers'
__email__ = 'colour-[email protected]'
__email__ = 'colour-[email protected]'
__status__ = 'Production'

__all__ = [
Expand All @@ -46,7 +46,7 @@

__major_version__ = '0'
__minor_version__ = '1'
__change_version__ = '1'
__change_version__ = '2'
__version__ = '.'.join(
(__major_version__,
__minor_version__,
Expand Down
30 changes: 15 additions & 15 deletions colour_checker_detection/detection/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
References
----------
- :cite:`Abecassis2011` : Abecassis, F. (2011). OpenCV - Rotation
(Deskewing). Retrieved October 27, 2018, from
http://felix.abecassis.me/2011/10/opencv-rotation-deskewing/
(Deskewing). Retrieved October 27, 2018, from http://felix.abecassis.me/\
2011/10/opencv-rotation-deskewing/
"""

from __future__ import division, unicode_literals
Expand All @@ -26,10 +26,10 @@
from colour.utilities import as_float_array, as_int_array, as_int

__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2018-2019 - Colour Developers'
__copyright__ = 'Copyright (C) 2018-2020 - Colour Developers'
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
__maintainer__ = 'Colour Developers'
__email__ = 'colour-[email protected]'
__email__ = 'colour-[email protected]'
__status__ = 'Production'

__all__ = [
Expand Down Expand Up @@ -155,15 +155,15 @@ def swatch_masks(width, height, swatches_h, swatches_v, samples):
Examples
--------
>>> from pprint import pprint
>>> pprint(swatch_masks(16, 8, 4, 2, 1))
[array([2, 2, 2, 2]),
array([2, 2, 6, 6]),
array([ 2, 2, 10, 10]),
array([ 2, 2, 14, 14]),
array([6, 6, 2, 2]),
array([6, 6, 6, 6]),
array([ 6, 6, 10, 10]),
array([ 6, 6, 14, 14])]
>>> pprint(swatch_masks(16, 8, 4, 2, 1)) # doctest: +ELLIPSIS
[array([2, 2, 2, 2]...),
array([2, 2, 6, 6]...),
array([ 2, 2, 10, 10]...),
array([ 2, 2, 14, 14]...),
array([6, 6, 2, 2]...),
array([6, 6, 6, 6]...),
array([ 6, 6, 10, 10]...),
array([ 6, 6, 14, 14]...)]
"""

samples = as_int(samples / 2)
Expand Down Expand Up @@ -520,11 +520,11 @@ def colour_checkers_coordinates_segmentation(image, additional_data=False):
... 'colour_checker_detection', 'detection',
... 'IMG_1967.png')
>>> image = read_image(path)
>>> colour_checkers_coordinates_segmentation(image)
>>> colour_checkers_coordinates_segmentation(image) # doctest: +ELLIPSIS
[array([[1065, 707],
[ 369, 688],
[ 382, 226],
[1078, 246]])]
[1078, 246]]...)]
"""

image = as_8_bit_BGR_image(adjust_image(image, WORKING_WIDTH))
Expand Down
Loading

0 comments on commit 751c549

Please sign in to comment.