rawshift_image/transforms/mod.rs
1//! Image transformation and processing pipeline.
2//!
3//! This module provides the core building blocks for transforming raw sensor data
4//! (like Bayer CFA) into viewable RGB images. These transforms are generic and
5//! designed to support various RAW formats (ARW, DNG, CR2, NEF, etc.).
6//!
7//! # General RAW Processing Flow
8//! Most RAW formats follow a similar processing pipeline:
9//!
10//! 1. **Sensor Normalization**:
11//! - **Black Level**: Subtracting the sensor noise floor (pedestal).
12//! - **White Level**: Normalizing signal to a standard range (0.0 - 1.0).
13//! - See [`black_level`].
14//!
15//! 2. **Demosaicing**:
16//! - Converting incomplete Color Filter Array (CFA) data (e.g., Bayer) into
17//! fully populated RGB pixels.
18//! - See [`cfa`].
19//!
20//! 3. **Color Processing**:
21//! - **White Balance**: Adjusting gains for Red/Blue channels to neutralize color casts.
22//! - **Color Transformation**: Converting from Camera Native RGB space to a standard
23//! connection space (like CIE XYZ) and then to an output space (like sRGB or ProPhoto).
24//! - See [`color`].
25//!
26//! 4. **Post-Processing & Correction**:
27//! - **Tone Mapping/Gamma**: Applying gamma curves for display or HDR compression.
28//! - **Corrections**: Lens distortion, vignetting, and other optical fixes (often handled
29//! via opcodes in formats like DNG).
30//! - See [`tonemap`] and [`opcodes`].
31
32pub mod bad_pixel;
33pub mod black_level;
34pub mod ca_correction;
35pub mod cfa;
36pub mod color;
37pub mod denoise;
38pub mod lens_correction;
39pub mod opcodes;
40pub mod orientation;
41pub mod simd;
42pub mod tonemap;
43
44pub use bad_pixel::{
45 BadPixelCorrectionMode, apply_bad_pixel_correction, correct_bad_pixels, detect_bad_pixels,
46};
47pub use black_level::apply_black_level;
48pub use ca_correction::apply_ca_correction;
49pub use color::{
50 ColorSpaceTransform, ColorTemperature, apply_color_matrix, apply_white_balance,
51 apply_white_balance_raw, compute_camera_to_srgb, convert_to_srgb,
52 estimate_cct_from_as_shot_neutral, interpolate_color_matrix,
53};
54pub use denoise::{apply_bilateral_filter, apply_gaussian_blur};
55pub use lens_correction::{apply_warp_rectilinear, apply_warp_rectilinear_tangential};
56pub use orientation::{
57 apply_crop, apply_orientation, flip_horizontal, flip_vertical, rotate_90_ccw, rotate_90_cw,
58 rotate_180,
59};
60pub use simd::{apply_gains_rgb, apply_matrix_rgb, subtract_black_level_uniform};
61pub use tonemap::{apply_tone_reproduction, apply_tonemap};