{"id":26553731,"url":"https://github.com/michel-leonard/ciede2000","last_synced_at":"2025-03-22T09:33:56.911Z","repository":{"id":276389776,"uuid":"851884738","full_name":"michel-leonard/ciede2000","owner":"michel-leonard","description":"The CIEDE2000 color-difference formula implementations.","archived":false,"fork":false,"pushed_at":"2025-03-18T01:13:33.000Z","size":73,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T01:33:36.500Z","etag":null,"topics":["algorithm","c","color","computer-vision","data-science","docs","education","example","golang","image-processing","java","javascript","linux","php","python","ruby","rust","simple","testing","windows"],"latest_commit_sha":null,"homepage":"https://michel-leonard.github.io/ciede2000/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michel-leonard.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-03T21:19:47.000Z","updated_at":"2025-03-18T01:13:36.000Z","dependencies_parsed_at":"2025-02-07T23:26:27.895Z","dependency_job_id":"99a697c4-18d5-4029-a6b9-746fc90eb3dc","html_url":"https://github.com/michel-leonard/ciede2000","commit_stats":null,"previous_names":["michel-leonard/delta-e-2000","michel-leonard/ciede2000"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michel-leonard%2Fciede2000","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michel-leonard%2Fciede2000/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michel-leonard%2Fciede2000/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michel-leonard%2Fciede2000/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michel-leonard","download_url":"https://codeload.github.com/michel-leonard/ciede2000/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244937753,"owners_count":20535124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","c","color","computer-vision","data-science","docs","education","example","golang","image-processing","java","javascript","linux","php","python","ruby","rust","simple","testing","windows"],"created_at":"2025-03-22T09:33:56.389Z","updated_at":"2025-03-22T09:33:56.899Z","avatar_url":"https://github.com/michel-leonard.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CIEDE2000 Color-Difference\n\nThis software is not affiliated with the CIE (International Commission on Illumination), has not been validated by it, and is released into the **public domain**. It is provided \"as is\" without any warranty.\n\n## Status\n\nReady to be deployed in **production** environments.\n\n## Version\n\nThis document describes the ΔE 2000 functions v1.0.0, released on March 1, 2025.\n\n## Cross-Language Consistency\n\nThe implementation of the **CIE ΔE 2000** consists of a single function with consistent results to **10 decimal places** in multiple programming languages :\n- C — C++\n- Rust\n- Go\n- Java — Kotlin\n- JavaScript — TypeScript\n- Lua — LuaJIT\n- PHP\n- Python\n- Ruby\n\nThese implementations of the **CIEDE2000 color difference formula** are [completely](tests#comparison-with-university-of-rochester-worked-examples) consistent with the samples studied by Gaurav Sharma, Wencheng Wu, and Edul N. Dalal at the University of Rochester.\n\n## Usage\nUse the CIEDE2000 color difference formula in your programming language.\n\n### C/C++\n```c\n// Example usage in C\ndouble deltaE = ciede_2000(l1, a1, b1, l2, a2, b2);\nprintf(\"%f\\n\", deltaE);\n```\n\n### Rust\n```rs\n// Example usage in Rust\nlet delta_e = ciede_2000(l1, a1, b1, l2, a2, b2);\nprintln!(\"{}\", delta_e);\n```\n\n### Go\n```go\n// Example usage in Go\ndeltaE := ciede_2000(l1, a1, b1, l2, a2, b2);\nfmt.Printf(\"%f\\n\", deltaE);\n```\n\n### Java\n```java\n// Example usage in Java\ndouble deltaE = ciede_2000(l1, a1, b1, l2, a2, b2);\nSystem.out.println(deltaE);\n```\n\n### Kotlin\n```kt\n// Example usage in Kotlin\nval deltaE = ciede_2000(l1, a1, b1, l2, a2, b2)\nprintln(deltaE)\n```\n\n### JavaScript\n```javascript\n// Example usage in JavaScript\nconst deltaE = ciede_2000(l1, a1, b1, l2, a2, b2);\nconsole.log(deltaE);\n```\n\n### Lua/LuaJIT\n```lua\n-- Example usage in Lua\nlocal deltaE = ciede_2000(l1, a1, b1, l2, a2, b2);\nprint(deltaE);\n```\n\n### PHP\n```php\n// Example usage in PHP\n$deltaE = ciede_2000($l1, $a1, $b1, $l2, $a2, $b2);\necho $deltaE;\n```\n\n### Python\n```python\n# Example usage in Python\ndelta_e = ciede_2000(l1, a1, b1, l2, a2, b2)\nprint(delta_e)\n```\n\n### Ruby\n```ruby\n# Example usage in Ruby\ndelta_e = ciede_2000(l1, a1, b1, l2, a2, b2)\nputs delta_e\n```\n\n## Possible Usage\n\n- **Precision**: Medical image processing (shade differences between healthy and diseased tissues).\n- **Efficiency**: Machine vision (color-based quality control).\n- **Everywhere**: Colorimetry in scientific research (studies on color perception).\n\n### Live Examples\n\nBased on our JavaScript implementation, you can see the CIEDE2000 color difference formula in action here :\n- [Tool](https://michel-leonard.github.io/ciede2000) that identify the name of the selected color based on a picture.\n- [Generator](https://michel-leonard.github.io/ciede2000/samples.html) for testing and comparing different implementations.\n- Simple [calculator](https://michel-leonard.github.io/ciede2000/calculator.html) of the **ΔE 2000**, given two L\\*a\\*b\\* colors.\n\n## Testing and Validation\n\nTo ensure **accurate color evaluation**, [extensive testing](tests#ciede-2000-function-test) involving 720,000,000 comparisons has been conducted. The correctness and consistency of the implementations across all programming languages is the essence of this project :\n- **Test Cases**: A set of test cases is used to validate the implementations.\n- **Tolerance**: The results are validated to be within a tolerance of 1e-10.\n- **Cross-Language**: All supported programming languages ​​are similarly tested.\n\nIn other words, the absolute value of the difference between any two implementations does not exceed 1e-10.\n\n### Numerical Stability in CIEDE2000\n\n#### Angle Conversions\n\nThe professional approach in software is to use radians for mathematical calculations, because angle conversions, while theoretically valid, result in a loss of precision due to rounding errors in floating-point numbers. Here, only radians are used, without conversion, but this can be a source of inconsistencies for an external implementation.\n\n#### IEEE 754 floating-point Limitations\n\nMinor discrepancies can arise between programming languages, for instance, `atan2(-49.2, -34.9)` evaluates to `-2.1877696633888672` in Python and `-2.1877696633888677` in JavaScript, while `-2.187769663388867475...` is correct. So the threshold for an accepted cross-language exact match is set to `1e-10`, linking sufficiency and achievability.\n\n#### Debugging\n\nRounding L\\*a\\*b\\* components and ΔE 2000 to [4 decimal places](tests#roundings) can be a solution for realistic color comparisons.\n\n### Performance Overview\n\nRuntimes were recorded while calculating 100 million iterations of the color difference formula ΔE 2000.\n\n| Language | Compilation Type | Duration (mm:ss) | Relative to C |\n|:--:|:--:|:--:|:--:|\n| C | Compiled| 00:45 | 1× (Reference) |\n| Rust | Compiled | 00:52 | 1.15× slower |\n| Go | Compiled | 00:52 | 1.15× slower |\n| LuaJIT | Just-In-Time Compiled | 00:53 | 1.18× slower |\n| Java | Just-In-Time Compiled | 00:57 | 1.25× slower |\n| Kotlin|  Just-In-Time Compiled | 00:57 | 1.26× slower |\n| TypeScript | Just-In-Time Compiled| 01:17 | 1.7× slower |\n| JavaScript | Just-In-Time Compiled | 01:18 | 1.73× slower |\n| PHP | Interpreted | 03:28 | 4.57× slower |\n| Lua | Interpreted | 07:03 | 9.36× slower |\n| Ruby | Interpreted | 07:20 | 9.65× slower |\n| Python | Interpreted | 10:13 | 13.45× slower |\n\n## Contributing\n\nExamples of interesting programming languages ​​to expand the `ciede_2000` function would be :\n- Julia\n- Dart\n- C#\n- MATLAB\n- R\n\n### Methodology\n\nTo ensure consistency across implementations, please follow these guidelines :\n1. **Base your implementation** on an existing one, copy-pasting and adapting is encouraged.\n2. **Validate correctness** using the generator available at [this link](https://michel-leonard.github.io/ciede2000/samples.html) :\n   - Generate some test sequences.\n   - Verify that the computed ΔE 2000 values do not deviate by more than **1e-10** from reference values.\n3. **Submit a pull request** with your implementation.\n\nTo enhance your contribution, consider:\n- Writing documentation, as done for other languages.\n- Adding advanced tests (refer to the `tests` directory for examples, and replicate the structure for your language).\n\n## The L\\*a\\*b\\* Color Range\n\n- **L\\*** nominally ranges from 0 (white) to 100 (black)\n- **a\\*** is unbounded and commonly clamped to the range of -128 (green) to 127 (red)\n- **b\\*** is unbounded and commonly clamped to the range of -128 (blue) to 127 (yellow)\n  \n## Short URL\nQuickly share this GitHub project permanently using [bit.ly/ciede2000](https://bit.ly/ciede2000).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichel-leonard%2Fciede2000","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichel-leonard%2Fciede2000","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichel-leonard%2Fciede2000/lists"}