diff --git a/README.md b/README.md index 9046498..b0b362a 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ ![Lint workflow](https://github.com/MarvinKweyu/ColorDetect/actions/workflows/lint.yml/badge.svg?branch=master) [![PyPI version](https://badge.fury.io/py/ColorDetect.svg)](https://pypi.org/project/ColorDetect/) -[![Python](https://img.shields.io/badge/python-3.6%7C3.7%7C3.8%7C3.9-green)](https://pypi.org/project/ColorDetect/) -[![CircleCI](https://circleci.com/gh/MarvinKweyu/ColorDetect.svg?style=svg)](https://circleci.com/gh/MarvinKweyu/ColorDetect) +[![Python](https://img.shields.io/badge/python->=3.6-green)](https://pypi.org/project/ColorDetect/) +![Package tests](https://github.com/MarvinKweyu/ColorDetect/actions/workflows/package-tests.yml/badge.svg?branch=master) [![Downloads](https://pepy.tech/badge/colordetect)](https://pypi.org/project/ColorDetect/) [![Documentation Status](https://readthedocs.org/projects/colordetect/badge/?version=master)](https://colordetect.readthedocs.io/en/master/) diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/colordetect/__init__.py b/colordetect/__init__.py deleted file mode 100644 index b819b12..0000000 --- a/colordetect/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from . import col_share -from .color_detect import ColorDetect -from .video_color_detect import VideoColor diff --git a/docs/colshare.rst b/docs/colshare.rst index aca4f3c..5850a3b 100644 --- a/docs/colshare.rst +++ b/docs/colshare.rst @@ -5,7 +5,14 @@ Depending on how many colors you have or how many dominant colors you want to na :: - >>> from colordetect import col_share + +from src.colordetect import col_share + >>> all_colors = my_video.get_video_frames() + >>> top_colors = col_share.sort_order(object_description=all_colors,key_count=5) + {'[0.0, 0.0, 0.0]': 68.83, '[5.0, 7.0, 24.0]': 22.48, '[5.0, 8.0, 24.0]': 22.22, '[4.0, 7.0, 24.0]': 21.7, '[6.0, 9.0, 26.0]': 19.11} + +The sort gets the top 5 colors, by default, from all the colors obtained from all the frames present. This may be adjusted to suit your needs. +A reverse of the same may be obtained by passing the >>> all_colors = my_video.get_video_frames() >>> top_colors = col_share.sort_order(object_description=all_colors,key_count=5) {'[0.0, 0.0, 0.0]': 68.83, '[5.0, 7.0, 24.0]': 22.48, '[5.0, 8.0, 24.0]': 22.22, '[4.0, 7.0, 24.0]': 21.7, '[6.0, 9.0, 26.0]': 19.11} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..264a751 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,40 @@ +[build-system] +requires = ["setuptools>=61.0.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "ColorDetect" +dynamic = ["version"] +description = "Detect and recognize colors in images or video" +readme = "README.md" +authors = [ + { name = "Marvin Kweyu", email = "mkweyu1@gmail.com" } +] +license = { file = "LICENSE" } +classifiers = [ + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", +] +keywords = ["ColorDetect", "color recognition","images", "video"] +dependencies = [ + "numpy>=1.18.1", + "matplotlib>=3.2.1", + "opencv-python>=4.2.0.32", + "scikit-learn>=0.22.2.post1", + "webcolors>=1.11.1" +] +requires-python = ">=3.6" +[tool.setuptools] +tests = [ + "tests/", + "*tests\\", +] + +[project.optional-dependencies] + build = ["build", "twine"] + dev = ["black", "flake8","bumpver", "isort", "mypy", "pytest"] + +[project.urls] + repository = "https://github.com/MarvinKweyu/ColorDetect" + documentation = "https://colordetect.readthedocs.io" \ No newline at end of file diff --git a/src/colordetect/__init__.py b/src/colordetect/__init__.py new file mode 100644 index 0000000..1abe8e1 --- /dev/null +++ b/src/colordetect/__init__.py @@ -0,0 +1,6 @@ + +from color_detect import ColorDetect +from video_color_detect import VideoColor +from . import col_share + +__all__ = ['ColorDetect', 'VideoColor', 'col_share'] \ No newline at end of file diff --git a/colordetect/col_share.py b/src/colordetect/col_share.py similarity index 98% rename from colordetect/col_share.py rename to src/colordetect/col_share.py index c4ffa2c..41028a8 100644 --- a/colordetect/col_share.py +++ b/src/colordetect/col_share.py @@ -7,7 +7,7 @@ Usage: ->>> from colordetect import col_share +>>> from src.colordetect import col_share # show a progress bar for a process >>> col_share.progress_bar("", "", "") # sort a dictionary by value to required length or in specific order diff --git a/colordetect/color_detect.py b/src/colordetect/color_detect.py similarity index 100% rename from colordetect/color_detect.py rename to src/colordetect/color_detect.py diff --git a/colordetect/video_color_detect.py b/src/colordetect/video_color_detect.py similarity index 99% rename from colordetect/video_color_detect.py rename to src/colordetect/video_color_detect.py index 49b0472..9e8ac87 100644 --- a/colordetect/video_color_detect.py +++ b/src/colordetect/video_color_detect.py @@ -12,7 +12,7 @@ >>> colors = user_video.get_video_frames(frame_color_count=7) >>> colors # alternatively shorten the dictionary to get a specific number of sorted colors from the whole lot ->>> from colordetect import col_share +>>> from src.colordetect import col_share >>> top_colors = col_share.sort_order(object_description=colors, key_count=8) """ diff --git a/tests/test_functional.py b/tests/test_functional.py index 6de785a..2adc90a 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -9,7 +9,7 @@ import matplotlib.colors as mcolors -from ..colordetect import ColorDetect +from src.colordetect import ColorDetect def test_existence_of_image_vid_path(image, video): diff --git a/tests/test_unit.py b/tests/test_unit.py index 92595f8..1d63e1e 100644 --- a/tests/test_unit.py +++ b/tests/test_unit.py @@ -10,7 +10,7 @@ import cv2 import pytest -from ..colordetect import ColorDetect, VideoColor, col_share +from src.colordetect import ColorDetect, VideoColor, col_share def test_image_vid_parsed_to_class(image, video):