Metadata-Version: 2.4
Name: optocalib-lab
Version: 0.1.0
Summary: Lightweight ArUco-locked perspective alignment and Delta-E76 colorimetric calibration for scientific and industrial computer vision.
Project-URL: Homepage, https://github.com
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: opencv-contrib-python-headless

# OptoCalib

**Lightweight ArUco-locked perspective alignment and Δ E₇₆ colorimetric calibration for scientific and industrial computer vision.**

`optocalib` solves two major challenges in smartphone-based optical sensing (microfluidics, LAMP/PCR assays, water quality strips, agriculture leaf colorimetry, and industrial QC):
1. **Perspective & Scale Drift:** Automatically locks onto 4 printed ArUco markers (`IDs 0–3`) and rectifies skewed images in `<5 ms`.
2. **Ambient Lighting Bias:** Normalizes illumination using a built-in white reference patch and quantifies color accuracy via perceptual Δ E₇₆ and CIELAB (\(L^*, a^*, b^*\)).

## Quick Start

```python
import cv2
from optocalib import calibrate_image, measure_roi_lab, generate_calibration_card

# 1. Generate a printable calibration template
generate_calibration_card("my_lab_mat.png")

# 2. Calibrate a skewed/unevenly lit photo
img = cv2.imread("sample_photo.jpg")
result = calibrate_image(img)

print("Locked:", result["aruco_locked"])
print("Delta-E76 Improved:", result["delta_e_before"], "->", result["delta_e_after"])

# 3. Measure perceptual CIELAB color in any ROI
lab_values = measure_roi_lab(result["image"], box=(145, 145, 199, 295))
print("CIELAB:", lab_values)
```
