diff --git a/.gitignore b/.gitignore index 2c011a9..59fd4b3 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ build/ dist/ draft/ +Makefile perception-default/ \ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index fcc5325..0000000 --- a/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -# Makefile -# Part of http://github.com/gfiumara/CIEDE2000 by Gregory Fiumara. -# See LICENSE for details. -# - -.PHONY: all clean debug library test - -LIBRARY = CIEDE2000 -SOURCE = $(LIBRARY).cpp -OBJECT = $(SOURCE:%.cpp=%.o) -DISPOSABLE_FILES = lib$(LIBRARY).so lib$(LIBRARY).dylib $(LIBRARY).dll \ - $(OBJECT) test$(OBJECT) test$(LIBRARY) -DISPOSABLE_DIRS = *dSYM -OS = $(shell uname) - -ifneq ($(findstring MINGW,$(OS)),MINGW) -WARNING_FLAGS = -Wall -Wextra -pedantic -PRODUCTION_FLAGS = -O3 -endif -DEBUG_FLAGS = -g -TEST_FLAGS = -Wno-unused-parameter - -CXXFLAGS += -I. -std=c++11 $(WARNING_FLAGS) $(PRODUCTION_FLAGS) - -all: library - -debug: CXXFLAGS += $(DEBUG_FLAGS) -debug: CXXFLAGS := $(filter-out $(PRODUCTION_FLAGS),$(CXXFLAGS)) -debug: all - -test$(LIBRARY): LDFLAGS += -L. -lCIEDE2000 -test$(LIBRARY): CXXFLAGS += $(TEST_FLAGS) -test$(LIBRARY): test$(OBJECT) - $(CXX) $^ -o $@ $(LDFLAGS) - -test: library test$(LIBRARY) - -library: $(LIBRARY).cpp -ifeq ($(findstring Darwin,$(OS)),Darwin) - $(CXX) -dynamiclib $(CXXFLAGS) $^ -o lib$(LIBRARY).dylib -else -ifeq ($(findstring MINGW,$(OS)),MINGW) - $(CXX) -shared $(CXXFLAGS) $^ -o lib$(LIBRARY).dll -else - $(CXX) -shared $(CXXFLAGS) $^ -o lib$(LIBRARY).so -endif -endif - -clean: - $(RM) $(DISPOSABLE_FILES) - $(RM) -r $(DISPOSABLE_DIRS) - diff --git a/README.md b/README.md index 015bd84..1492c43 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,24 @@ -CIE Delta E 2000 (CIEDE2000) ----------------------------- +# Perception -A C++ library containing a function to determine how similar two colors are. -The code here is original, based on the psuedocode written in the paper -[The CIEDE2000 Color-Difference Formula: Implementation Notes, Supplementary -Test Data, and Mathematical Observations](http://www.ece.rochester.edu/~gsharma/ciede2000/), by Gaurav Sharma, Wencheng Wu, and Edul N. Dalal. While -this is written in C++ so that I could place it in a namespace, there's nothing -C++-specific about the implementation, and so it would be trivial to convert -to C if required. The conversion is left as an exercise to the reader. +A Python3 library with CLI that generates the optimal discernible color palette for theme building. -**To Build** -`make` +## Installation and Usage -**To Test** -`make test && ./testCIEDE2000` (Expected output below.) + git clone https://github.com/gywn/perception.git + cd perception && python3 setup.py install -As I implemented the method from the paper, I commented the code to line up -code fragements with lines from the paper for tracability. There are ways to -speed up and optimize this algorithm, which have not been attempted. +Generate demo page -A test program (`testCIEDE2000`) is built by default to run the -[tests](http://www.ece.rochester.edu/~gsharma/ciede2000/dataNprograms/CIEDE2000.xls) perscribed by the algorithm authors. Tested on OS X 10.10.2, -and Ubuntu 14.04 LTS. Should work on Cygwin/MINGW, though there will likely -need to be edits to the [Makefile](Makefile). + perception --profile demo + cd ./perception-default/demo/ -**NOTE** -The `CIEDE2000` algorithm uses colors from the -[LAB colorspace](http://en.wikipedia.org/wiki/Lab_color_space), not RGB. In -practice, I've used [ImageMagick](http://www.imagemagick.org) to convert -color values for use with CIEDE2000, though that not may be entirely correct. +Generate warm & dark theme extension for VSCode -**Expected Testing Output** + perception --name warm-and-dark --temperature 4500 --background 15 --profile vscode + rsync -a ./perception-warm-and-dark/vscode/ ~/.vscode/extensions/ - $ ./testCIEDE2000 - 1: 2.0425 vs 2.0425 PASS - 2: 2.8615 vs 2.8615 PASS - 3: 3.4412 vs 3.4412 PASS - 4: 1.0000 vs 1.0000 PASS - 5: 1.0000 vs 1.0000 PASS - 6: 1.0000 vs 1.0000 PASS - 7: 2.3669 vs 2.3669 PASS - 8: 2.3669 vs 2.3669 PASS - 9: 7.1792 vs 7.1792 PASS - 10: 7.1792 vs 7.1792 PASS - 11: 7.2195 vs 7.2195 PASS - 12: 7.2195 vs 7.2195 PASS - 13: 4.8045 vs 4.8045 PASS - 14: 4.8045 vs 4.8045 PASS - 15: 4.7461 vs 4.7461 PASS - 16: 4.3065 vs 4.3065 PASS - 17: 27.1492 vs 27.1492 PASS - 18: 22.8977 vs 22.8977 PASS - 19: 31.9030 vs 31.9030 PASS - 20: 19.4535 vs 19.4535 PASS - 21: 1.0000 vs 1.0000 PASS - 22: 1.0000 vs 1.0000 PASS - 23: 1.0000 vs 1.0000 PASS - 24: 1.0000 vs 1.0000 PASS - 25: 1.2644 vs 1.2644 PASS - 26: 1.2630 vs 1.2630 PASS - 27: 1.8731 vs 1.8731 PASS - 28: 1.8645 vs 1.8645 PASS - 29: 2.0373 vs 2.0373 PASS - 30: 1.4146 vs 1.4146 PASS - 31: 1.4441 vs 1.4441 PASS - 32: 1.5381 vs 1.5381 PASS - 33: 0.6377 vs 0.6377 PASS - 34: 0.9082 vs 0.9082 PASS +## Aknowladgement + +- [AlexanderFabisch/CMA-ESpp](https://github.com/AlexanderFabisch/CMA-ESpp) +- [gfiumara/CIEDE2000](https://github.com/gfiumara/CIEDE2000) +- [pybind/pybind11](https://github.com/pybind/pybind11) \ No newline at end of file diff --git a/cmake/Modules/FindNumPy.cmake b/cmake/Modules/FindNumPy.cmake deleted file mode 100644 index 248f8c2..0000000 --- a/cmake/Modules/FindNumPy.cmake +++ /dev/null @@ -1,55 +0,0 @@ -# - Find the NumPy libraries -# This module finds if NumPy is installed, and sets the following variables -# indicating where it is. -# -# TODO: Update to provide the libraries and paths for linking npymath lib. -# -# NUMPY_FOUND - was NumPy found -# NUMPY_VERSION - the version of NumPy found as a string -# NUMPY_VERSION_MAJOR - the major version number of NumPy -# NUMPY_VERSION_MINOR - the minor version number of NumPy -# NUMPY_VERSION_PATCH - the patch version number of NumPy -# NUMPY_VERSION_DECIMAL - e.g. version 1.6.1 is 10601 -# NUMPY_INCLUDE_DIR - path to the NumPy include files - -unset(NUMPY_VERSION) -unset(NUMPY_INCLUDE_DIR) - -if(PYTHONINTERP_FOUND) - execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" - "import numpy as n; print(n.__version__); print(n.get_include());" - RESULT_VARIABLE __result - OUTPUT_VARIABLE __output - OUTPUT_STRIP_TRAILING_WHITESPACE) - - if(__result MATCHES 0) - string(REGEX REPLACE ";" "\\\\;" __values ${__output}) - string(REGEX REPLACE "\r?\n" ";" __values ${__values}) - list(GET __values 0 NUMPY_VERSION) - list(GET __values 1 NUMPY_INCLUDE_DIR) - - string(REGEX MATCH "^([0-9])+\\.([0-9])+\\.([0-9])+" __ver_check "${NUMPY_VERSION}") - if(NOT "${__ver_check}" STREQUAL "") - set(NUMPY_VERSION_MAJOR ${CMAKE_MATCH_1}) - set(NUMPY_VERSION_MINOR ${CMAKE_MATCH_2}) - set(NUMPY_VERSION_PATCH ${CMAKE_MATCH_3}) - math(EXPR NUMPY_VERSION_DECIMAL - "(${NUMPY_VERSION_MAJOR} * 10000) + (${NUMPY_VERSION_MINOR} * 100) + ${NUMPY_VERSION_PATCH}") - string(REGEX REPLACE "\\\\" "/" NUMPY_INCLUDE_DIR ${NUMPY_INCLUDE_DIR}) - else() - unset(NUMPY_VERSION) - unset(NUMPY_INCLUDE_DIR) - message(STATUS "Requested NumPy version and include path, but got instead:\n${__output}\n") - endif() - endif() -else() - message(STATUS "To find NumPy Python interpretator is required to be found.") -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(NumPy REQUIRED_VARS NUMPY_INCLUDE_DIR NUMPY_VERSION - VERSION_VAR NUMPY_VERSION) - -if(NUMPY_FOUND) - message(STATUS "NumPy ver. ${NUMPY_VERSION} found (include: ${NUMPY_INCLUDE_DIR})") -endif()