help to do color correction on images based on color checker card classic 24 patch.
Project description
🎨 Color Correction
Note: The "asdfghjkl" is just a placeholder due to some naming difficulties.
This 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.
📦 Installation
pip install color-correction-asdfghjkl
🏋️♀️ How it works
⚡ How to use
# Step 1: Define the path to the input image
image_path = "asset/images/cc-19.png"
# Step 2: Load the input image
input_image = cv2.imread(image_path)
# Step 3: Initialize the color correction model with specified parameters
color_corrector = ColorCorrection(
detection_model="yolov8",
detection_conf_th=0.25,
correction_model="polynomial", # "least_squares", "affine_reg", "linear_reg"
degree=3, # for polynomial correction model
use_gpu=True,
)
# Step 4: Extract color patches from the input image
# you can set reference patches from another image (image has color checker card)
# or use the default D50
# color_corrector.set_reference_patches(image=None, debug=True)
color_corrector.set_input_patches(image=input_image, debug=True)
color_corrector.fit()
corrected_image = color_corrector.predict(
input_image=input_image,
debug=True,
debug_output_dir="zzz",
)
# Step 5: Evaluate the color correction results
eval_result = color_corrector.calc_color_diff_patches()
print(eval_result)
- Output evaluation result:
{ "initial": { "min": 2.254003059526461, "max": 13.461066402633447, "mean": 8.3072755187654, "std": 3.123962754767539, }, "corrected": { "min": 0.30910031798755183, "max": 5.422311999126372, "mean": 1.4965478752947827, "std": 1.2915738724958112, }, "delta": { "min": 1.9449027415389093, "max": 8.038754403507074, "mean": 6.810727643470616, "std": 1.8323888822717276, }, }
- Sample output debug image (polynomial degree=2):
📈 Benefits
- Consistency: Ensure uniform color correction across multiple images.
- Accuracy: Leverage the color correction matrix for precise color adjustments.
- Flexibility: Adaptable for various image sets with different color profiles.
🤸 TODO
- Add Loggers
- Add detection MCC:CCheckerDetector from opencv
- Add Segmentation Color Checker using YOLOv11 ONNX
- Improve validation preprocessing (e.g., auto-match-orientation CC)
- Add more analysis and evaluation metrics (Still thinking...)
📚 References
- Color Checker Classic 24 Patch Card
- Color Correction Tool ML
- Colour Science Python
- Fast and Robust Multiple ColorChecker Detection ()
- Automatic color correction with OpenCV and Python (PyImageSearch)
- ONNX-YOLOv8-Object-Detection
- yolov8-triton
- Streamlined Data Science Development: Organizing, Developing and Documenting Your Code
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file color_correction_asdfghjkl-0.0.1b1.tar.gz.
File metadata
- Download URL: color_correction_asdfghjkl-0.0.1b1.tar.gz
- Upload date:
- Size: 1.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
645e8d7d101f21a546f6021b00cc0601b0b92ca2a4e1fe5567b71c3ff64a9bd8
|
|
| MD5 |
528303d0fc4eee1b3fa565d3256da904
|
|
| BLAKE2b-256 |
89038ae24836aa97e28a209ed5d32d92bea8b166544d52d0a6fb643ff26cbb41
|
File details
Details for the file color_correction_asdfghjkl-0.0.1b1-py3-none-any.whl.
File metadata
- Download URL: color_correction_asdfghjkl-0.0.1b1-py3-none-any.whl
- Upload date:
- Size: 31.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17443df041d3752e616a04d4ba740b18577c92aaadf45d5f86d6e2cac25b1b50
|
|
| MD5 |
63f32e3bac3e3026007fa0a054cce81e
|
|
| BLAKE2b-256 |
337c58b0f045d5a29d84bea63d7d7315ae6827cbb5081c9e57382a86d18e4176
|