Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Python Package to PyPI

on:
push:
tags:
- 'v*.*.*' # Memicu alur kerja pada push tag versi, misalnya v1.0.0

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
version: "0.5.23"
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: 3.12

- name: Extract version from Git tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

# - name: Install the project
# run: uv sync --all-groups --no-group dev-model

- name: Clear directory
run: rm -rf dist

- name: Build package
run: uv build

- name: Publish to PyPI
run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ wheels/
*.coverage
.pytest_cache/
.ruff_cache/

*.pyc
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,31 @@ This package is designed to perform color correction on images using the Color C
- **Accuracy**: Leverage the color correction matrix for precise color adjustments.
- **Flexibility**: Adaptable for various image sets with different color profiles.

## Installation

```bash
pip install color-correction-asdfghjkl
```
## Usage

```python
import cv2

from color_correction_asdfghjkl import ColorCorrection

cc = ColorCorrection(
detection_model="yolov8",
correction_model="least_squares",
use_gpu=False,
)

input_image = cv2.imread("cc-19.png")
cc.fit(input_image=input_image)
corrected_image = cc.correct_image(input_image=input_image)
cv2.imwrite("corrected_image.png", corrected_image)
```


<!-- write reference -->
## 📚 References
- [Color Checker Classic 24 Patch Card](https://www.xrite.com/categories/calibration-profiling/colorchecker-classic)
Expand Down
17 changes: 17 additions & 0 deletions color_correction_asdfghjkl/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
__version__ = "0.0.1a1"

# fmt: off
from .constant.color_checker import reference_color_d50 as REFERENCE_COLOR_D50 # noqa: N812, I001
from .core.card_detection.yolov8_det_onnx import YOLOv8CardDetector
from .schemas.yolov8_det import DetectionResult as YOLOv8DetectionResult
from .services.color_correction import ColorCorrection

# fmt: on

__all__ = [
"__version__",
"REFERENCE_COLOR_D50",
"ColorCorrection",
"YOLOv8CardDetector",
"YOLOv8DetectionResult",
]
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def download_google_drive_file(file_id: str, output_file: str) -> None:

def downloader_model_yolov8(use_gpu: bool = False) -> str:
specs = get_device_specs()
model_folder = "color_correction_asdfghjkl/asset/.model"
model_folder = os.path.join(os.getcwd(), "tmp", "models")
if use_gpu:
if specs.is_apple_silicon:
print("Apple Silicon device detected.")
Expand Down
30 changes: 25 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[project]
name = "color-correction-asdfghjkl"
version = "0.1.0"
description = "Add your description here"
version = "0.0.1a2"
description = "help to do color correction on images based on color checker card classic 24 patch."
keywords = ["color correction", "color-correction", "color consistency", "color-consistency"]
readme = "README.md"
authors = [
{ name = "magfianf", email = "muhammadagfian96@gmail.com" }
Expand All @@ -14,10 +15,20 @@ dependencies = [
"shapely>=2.0.6",
"colour-science>=0.4.6",
]
classifiers = [
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Operating System :: OS Independent',
'Typing :: Typed'
]


[project.urls]
Repository = "https://github.com/agfianf/color-correction-asdfghjkl"
Issues = "https://github.com/agfianf/color-correction-asdfghjkl/issues"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[dependency-groups]
default = [
Expand All @@ -42,6 +53,15 @@ dev-model = [
"ultralytics>=8.3.65",
]


[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"


[tool.hatch.build.targets.wheel]
packages = ["color_correction_asdfghjkl"]

# ---- ruff ----
[tool.ruff]
exclude = [
Expand Down
2 changes: 0 additions & 2 deletions src/color_correction_asdfghjkl/__init__.py

This file was deleted.

121 changes: 45 additions & 76 deletions uv.lock

Large diffs are not rendered by default.

Loading