{"id":26154931,"url":"https://github.com/agfianf/color-correction","last_synced_at":"2025-04-14T07:22:05.539Z","repository":{"id":274394546,"uuid":"920441602","full_name":"agfianf/color-correction","owner":"agfianf","description":"help to do color correction on images based on color checker card classic 24 patch.","archived":false,"fork":false,"pushed_at":"2025-03-26T00:57:45.000Z","size":4555,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T12:16:19.588Z","etag":null,"topics":["color-calibration","color-correction","computer-vision","image-manipulation","image-processing"],"latest_commit_sha":null,"homepage":"https://agfianf.github.io/color-correction/","language":"Python","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/agfianf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2025-01-22T06:41:43.000Z","updated_at":"2025-02-25T08:35:00.000Z","dependencies_parsed_at":"2025-02-05T01:23:26.822Z","dependency_job_id":"8c882b2d-56ed-4f68-ae59-d5f9f45d86f2","html_url":"https://github.com/agfianf/color-correction","commit_stats":null,"previous_names":["agfianf/color-correction-asdfghjkl","agfianf/color-correction"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agfianf%2Fcolor-correction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agfianf%2Fcolor-correction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agfianf%2Fcolor-correction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agfianf%2Fcolor-correction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agfianf","download_url":"https://codeload.github.com/agfianf/color-correction/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248537003,"owners_count":21120687,"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":["color-calibration","color-correction","computer-vision","image-manipulation","image-processing"],"created_at":"2025-03-11T08:40:28.641Z","updated_at":"2025-04-14T07:22:05.521Z","avatar_url":"https://github.com/agfianf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cdiv align=\"center\"\u003e\n\u003c!-- image logo --\u003e\n\u003cimg src=\"assets/logo-v1.png\" alt=\"Color Correction Logo\" width=\"150\"/\u003e\n\n# Color Correction\n\n\u003cbr\u003e\n\n[![version](https://badge.fury.io/py/color-correction.svg)](https://badge.fury.io/py/color-correction)\n[![downloads](https://img.shields.io/pypi/dm/color-correction)](https://pypistats.org/packages/color-correction)\n[![python-version](https://img.shields.io/pypi/pyversions/color-correction)](https://badge.fury.io/py/color-correction)\n[![Try color-correction using - Google Colab](https://img.shields.io/badge/Try_color--correction_using-Google_Colab-blue?logo=googlecolab)](https://colab.research.google.com/drive/146SXHHihMmGLzaTSwdBXncVr3SU_I-Dm?usp=sharing)\n[![read - docs](https://img.shields.io/badge/read-docs-blue?logo=materialformkdocs)](https://agfianf.github.io/color-correction/)\n\n\u003c/div\u003e\n\n\u003e _Package formerly published as [`color-correction-asdfghjkl`](https://pypi.org/project/color-correction-asdfghjkl/) on PyPI. The name has been simplified for better accessibility and professional recognition._\n\nThis package is designed to perform color correction on images using the Color Checker Classic 24 Patch card. It provides a robust solution for ensuring accurate color representation in your images.\n\n## 📦 Installation\n\n```bash\npip install color-correction\n```\n\n## 🏋️‍♀️ How it works\n![How it works](assets/color-correction-how-it-works.png)\n\n\n## ⚡ How to use\n\n```python\nfrom color_correction import ColorCorrection\n\n# Step 1: Define the path to the input image\nimage_path = \"asset/images/cc-19.png\"\n\n# Step 2: Load the input image\ninput_image = cv2.imread(image_path)\n\n# Step 3: Initialize the color correction model with specified parameters\ncolor_corrector = ColorCorrection(\n    detection_model=\"yolov8\",\n    detection_conf_th=0.25,\n    correction_model=\"polynomial\", # \"least_squares\", \"affine_reg\", \"linear_reg\"\n    degree=3,  # for polynomial correction model\n    use_gpu=True,\n)\n\n# Step 4: Extract color patches from the input image\n# you can set reference patches from another image (image has color checker card)\n# or use the default D50\n# color_corrector.set_reference_patches(image=None, debug=True)\ncolor_corrector.set_input_patches(image=input_image, debug=True)\ncolor_corrector.fit()\ncorrected_image = color_corrector.predict(\n    input_image=input_image,\n    debug=True,\n    debug_output_dir=\"zzz\",\n)\n\n# Step 5: Evaluate the color correction results\neval_result = color_corrector.calc_color_diff_patches()\nprint(eval_result)\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eSample Evaluation Output\u003c/summary\u003e\n\n```json\n{\n    \"initial\": {\n        \"min\": 2.254003059526461,\n        \"max\": 13.461066402633447,\n        \"mean\": 8.3072755187654,\n        \"std\": 3.123962754767539,\n    },\n    \"corrected\": {\n        \"min\": 0.30910031798755183,\n        \"max\": 5.422311999126372,\n        \"mean\": 1.4965478752947827,\n        \"std\": 1.2915738724958112,\n    },\n    \"delta\": {\n        \"min\": 1.9449027415389093,\n        \"max\": 8.038754403507074,\n        \"mean\": 6.810727643470616,\n        \"std\": 1.8323888822717276,\n    },\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eSample Output Debug Image\u003c/summary\u003e\n\n![Sample Output](assets/sample-output-debug.jpg)\n\n\u003c/details\u003e\n\n## 🔎 Reporting\n```python\nimport cv2\n\nfrom color_correction import ColorCorrectionAnalyzer\n\n# input_image_path = \"assets/cc-19.png\"\ninput_image_path = \"assets/cc-1.jpg\"\n\nreport = ColorCorrectionAnalyzer(\n    list_correction_methods=[\n        (\"least_squares\", {}),\n        (\"linear_reg\", {}),\n        (\"affine_reg\", {}),\n        (\"polynomial\", {\"degree\": 2}),\n        (\"polynomial\", {\"degree\": 3}),\n        # (\"polynomial\", {\"degree\": 4}),\n        # (\"polynomial\", {\"degree\": 5}),\n    ],\n    list_detection_methods=[\n        (\"yolov8\", {\"detection_conf_th\": 0.25}),\n    ],\n)\nreport.run(\n    input_image=cv2.imread(input_image_path),\n    reference_image=None,\n    output_dir=\"report-output\",\n)\n```\n\u003cdetails\u003e\n\u003csummary\u003eSample Report Output\u003c/summary\u003e\n\n![Sample Benchmark Output](assets/sample-benchmark.png)\n\u003c/details\u003e\n\n## 📈 Benefits\n- **Consistency**: Ensure uniform color correction across multiple images.\n- **Accuracy**: Leverage the color correction matrix for precise color adjustments.\n- **Flexibility**: Adaptable for various image sets with different color profiles.\n\n\n## 🤸 TODO\n- [ ] Add Loggers\n- [x] Add detection MCC:CCheckerDetector from opencv\n- [ ] Add Segmentation Color Checker using YOLOv11 ONNX\n- [ ] Improve validation preprocessing (e.g., auto-match-orientation CC)\n- [ ] Add more analysis and evaluation metrics (Still thinking...)\n\n\u003c!-- write reference --\u003e\n\n## 📚 References\n- [Color Checker Classic 24 Patch Card](https://www.xrite.com/categories/calibration-profiling/colorchecker-classic)\n- [Color Correction Tool ML](https://github.com/collinswakholi/ML_ColorCorrection_tool/tree/Pip_package)\n- [Colour Science Python](https://www.colour-science.org/colour-checker-detection/)\n- [Fast and Robust Multiple ColorChecker Detection ()](https://github.com/pedrodiamel/colorchecker-detection)\n- [Automatic color correction with OpenCV and Python (PyImageSearch)](https://pyimagesearch.com/2021/02/15/automatic-color-correction-with-opencv-and-python/)\n- [ONNX-YOLOv8-Object-Detection](https://github.com/ibaiGorordo/ONNX-YOLOv8-Object-Detection)\n- [yolov8-triton](https://github.com/omarabid59/yolov8-triton/tree/main)\n- [Streamlined Data Science Development: Organizing, Developing and Documenting Your Code](https://medium.com/henkel-data-and-analytics/streamlined-data-science-development-organizing-developing-and-documenting-your-code-bfd69e3ef4fb)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagfianf%2Fcolor-correction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagfianf%2Fcolor-correction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagfianf%2Fcolor-correction/lists"}