Skip to content

OpenImageSignalProcessor Professional (OpenISP-Pro) is an open-source pure-Python image signal processor enabling end-to-end RAW-to-RGB/YUV/JPEG conversion with documented algorithms for learning and practical use.

License

Notifications You must be signed in to change notification settings

Doublelif1/OpenISP_PRO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Image Signal Processor (OPENISP_PRO)

Introduction

OPENISP_PRO is a pure-Python software ISP that converts RAW/DNG from image sensors into display-ready RGB/YUV and JPEG outputs.
The pipeline follows a practical, production-minded order—RAW input → front-end calibration → color reconstruction → back-end enhancement → encoding—with robust fallbacks, metadata propagation, and intermediate artifacts for quality control and reproducibility. 流程图描述 Key traits:

  • Robust RAW ingest (rawio): reliable DNG parsing; hierarchical fallback for black/white levels (tags → optical black → low-quantile estimation), Bayer pattern detection, bit-depth inference, standardized metadata, and quick sRGB preview.
  • Quality-first calibration: DPC with robust statistics + edge-preserving repair; BLC with two-stage search to avoid under/over-subtraction; AWB using bright-region sampling with gain guards for natural skin/highlights.
  • Detail-aware denoising: RAW-domain BM3D per-channel (R/Gr/Gb/B) to prevent cross-color bleed; optional YUV-domain CBM3D for late-stage refinement.
  • Luminance-consistent demosaicing: color-difference interpolation with G-mean feedback to keep brightness stable; mild USM only on Y to avoid color shifts.
  • Color with safety rails (ccm): camera matrices with mired-domain interpolation and Bradford adaptation; condition-number checks and graceful fallback (e.g., blending toward identity).
  • Stable display mapping: gamma with soft lifting for small negatives; precise CSC (BT.601/709/2020, full/limited range).
  • Tasteful tone & detail shaping: TMO (filmic/Hable) operates on Y′ only; EE with dual gating (MAD + quantization thresholds) to reduce halos/noise.
  • Color finishing: saturation (Cb/Cr scaling around neutral), contrast (linear/S-curve/power/HEQ), hue (global rotation + selective edits + highlight warming).
  • Baseline JPEG encoder: standards-compliant JFIF Baseline in pure Python (AAN FDCT, quantization, RLE, Huffman, 0xFF stuffing) with self-checks.

Objectives

This project provides a practical, end-to-end ISP reference that is modular, reproducible, and hardware-inspired, while remaining approachable in pure Python. Specifically, OPENISP_PRO:

  1. Stimulates the whole ISP pipeline from RAW ingest to JPEG output, exposing intermediate states for inspection and QA.
  2. Implements robust front-end corrections (RAW parsing, DPC, BLC, AWB) using statistically robust methods (quantiles, MAD, hierarchical fallback).
  3. Reconstructs color faithfully via luminance-consistent demosaicing and a defensive CCM (mired interpolation + Bradford + safe fallback).
  4. Balances visual quality with engineering practicality using BM3D/CBM3D, tone mapping on Y′, gated sharpening, and decoupled color finishing (Sat/Contrast/Hue).
  5. Outputs standard formats (RGB/YUV/JPEG) compatible with common display and downstream pipelines.

Advanced capabilities such as LSC (Lens Shading Correction), HDR (multi-exposure fusion), and AF are planned to further broaden coverage.

Pipeline Diagrams

Feature Checklist

  • Defective Pixel Correction (DPC) — robust detection + edge-aware inpainting
  • Black Level Correction (BLC) — two-stage search, no over/under subtraction
  • Lens Shading Correction (LSC) — planned
  • RAW-domain Noise Reduction — BM3D per-channel
  • Auto White Balance (AWB) — bright-region sampling with safety rails
  • Demosaicing — luminance-consistent, color-difference interpolation
  • Gamma Correction — soft lifting for near-zero negatives
  • Color Correction Matrix (CCM) — mired interpolation + Bradford + fallback
  • Color Space Conversion (CSC) — BT.601/709/2020, full/limited range
  • YUV-domain Noise Refinement — CBM3D (optional)
  • Edge Enhancement (EE) — USM with dual gating, halo-safe
  • Hue / Saturation / Contrast — decoupled finishing (Y′ vs. Cb/Cr)
  • Baseline JPEG Encoding — JFIF-compliant, 4:4:4 / 4:2:0

File Structure

The OPENISP_PRO project tree is listed as follows.

OPENISP_PRO
├── .idea/                # IDE configs (e.g., PyCharm)
├── .venv/                # Python venv (default)
├── .venv1/               # Alternate venv (e.g., other Python/deps)
├── examples/             # Test inputs (RAW/DNG samples)
│   ├── input1.DNG
│   └── input2.DNG
├── lab/                  # Experimental prototypes (e.g., new denoise/HDR)
├── openisp_pro/          # Core ISP implementation
│   ├── core/             # Pipeline stages
│   │   ├── awb.py
│   │   ├── blc.py
│   │   ├── bm3d.py
│   │   ├── cbm3d_yuv.py
│   │   ├── ccm.py
│   │   ├── contrast.py
│   │   ├── csc.py
│   │   ├── demosaic.py
│   │   ├── dpc.py
│   │   ├── ee.py
│   │   ├── fpn.py
│   │   ├── gamma.py
│   │   ├── hue.py
│   │   ├── sat.py
│   │   ├── tmc.py
│   │   └── yuv2jpeg.py
│   ├── utils/
│   │   └── rawio.py       # DNG parsing, BL/WL fallback, bit-depth, preview
│   └── pipeline.py        # RAW→JPEG orchestration + intermediates

Directory Notes

  • utils/rawio.py — robust RAW ingest (Bayer pattern detection, black/white-level fallback, bit-depth inference) with standardized metadata.
  • openisp_pro/core/* — individual ISP modules (each testable and swappable).
  • openisp_pro/pipeline.py — wires modules end-to-end, logs decisions, and can save intermediates for QA.

Usage

After cloning the repo, run the pipeline on a DNG sample:

cd openisp_pro
python pipeline.py ../examples/a0144-07-11-20-at-16h38m08s-_MG_5725.dng

Notes

  • Absolute paths are supported, e.g.:

    python pipeline.py /abs/path/to/input.dng
  • On Windows, quote paths with spaces, e.g.:

    python pipeline.py "C:\path with space\input.dng"
  • If CLI options like --out or --save-intermediate are available, append them as needed (see code).


Domain Notes

While algorithms such as DPC/BLC/AWB/BM3D/Demosaic operate in the Bayer/RAW or linear RGB domain, display mapping and finishing steps (e.g., Gamma/CSC/TMC/EE/Sat/Contrast/Hue) operate in R′G′B′/Y′CbCr. This split preserves physical linearity early and human-perception alignment late. Noise filtering can be placed in RAW/RGB/YUV, and both temporal/spatial domains are feasible; OPENISP_PRO currently emphasizes RAW BM3D with optional YUV CBM3D refinement for a balanced quality/perf trade-off.


License

This project is licensed under the MIT License - see the LICENSE file for details.
© [2025] OPENISP_PRO Authors

About

OpenImageSignalProcessor Professional (OpenISP-Pro) is an open-source pure-Python image signal processor enabling end-to-end RAW-to-RGB/YUV/JPEG conversion with documented algorithms for learning and practical use.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages