Applies to v1.1.0+ 14 min read
Color Science 01 / Domain Decoupling

The Three Mathematical Domains of Negative Inversion

Rigorous physical derivations and the non-commutative theorem across transmittance, optical density, and print output domains.

# Transmittance Domain: Pre-Log Optical Response & Device Basis

In negative film digitization, the physical quantity recorded by an area-array CMOS sensor or a linear CCD scanner is not optical density. Rather, the sensor integrates the radiant photon flux that traverses the developed photographic emulsion and reaches each photosite. The transmittance domain refers explicitly to the linear-light space prior to logarithmic transformation, where measurements remain strictly proportional to incident physical irradiance. The objective of this domain is to obtain a physically meaningful, bounded, positive relative transmittance vector.

Let Iopen(λ)I_{\text{open}}(\lambda) represent the spectral radiant power incident across the scanning gate without film, let Itransmitted(λ)I_{\text{transmitted}}(\lambda) denote the transmitted flux through the developed negative, and let Idark(λ)I_{\text{dark}}(\lambda) quantify the combined contributions of sensor thermal dark current and internal optical flare within the scanning chamber. The spectral relative transmittance T(λ)T(\lambda) is defined as:

T(λ)=Itransmitted(λ)−Idark(λ)Iopen(λ)−Idark(λ)T(\lambda) = \frac{I_{\text{transmitted}}(\lambda) - I_{\text{dark}}(\lambda)}{I_{\text{open}}(\lambda) - I_{\text{dark}}(\lambda)}

For a discrete trichromatic imaging system, channel responses correspond to integrals of the transmitted spectrum weighted by color filter array transmissions and sensor quantum efficiencies. Denoting the raw digitized device vector as Idevice=[R,G,B]TI_{\text{device}} = [R, G, B]^T, all operations performed within the transmittance domain must preserve radiant linearity:

  1. Dark Level and Stray Light Subtraction: Removing thermal dark current and internal housing reflections ensures that zero transmitted light yields a true physical zero reading.
  2. Flat-Field Gain Normalization: Compensating for lens cosine-fourth illumination falloff and backlight spatial chromaticity nonuniformity across the field of view.
  3. Capture Separation Matrix: Decoupling the overlapping spectral bands of camera Bayer dyes or scanner beam splitters, aligning the channels with the actual optical absorption bands of the cyan, magenta, and yellow film dyes.

If channel separation is omitted at the capture stage, dye absorption signals remain entangled throughout all downstream operations. To prevent mathematical singularities during logarithmic mapping, the evaluated transmittance is clamped to a tiny positive threshold ϵ\epsilon:

Tvalid=max⁡(T,ϵ),ϵ=1.0×10−6T_{\text{valid}} = \max(T, \epsilon), \quad \epsilon = 1.0 \times 10^{-6}

Important

Values within the transmittance domain represent radiometric physical quantities. Any display-referred nonlinearities, monitor gamma curves, or perceptual contrast adjustments are strictly prohibited within this initial stage.

# Optical Density Domain: Post-Log Additive Absorption & Base Subtraction

Following logarithmic transformation, the signal transitions from the transmittance domain into the optical density domain. Under the Beer-Lambert absorption law, the attenuation of monochromatic light traversing a homogeneous absorbing medium follows an exponential decay. Evaluating the negative base-10 logarithm transforms multiplicative transmission attenuation into linear additive absorbance, establishing a tractable framework for dye layer decomposition.

The raw acquired optical density vector DrawD_{\text{raw}} is defined as the common logarithm of the reciprocal of valid relative transmittance:

Draw=−log⁡10(Tvalid)=[−log⁡10(TR)−log⁡10(TG)−log⁡10(TB)]D_{\text{raw}} = -\log_{10}(T_{\text{valid}}) = \begin{bmatrix} -\log_{10}(T_R) \\ -\log_{10}(T_G) \\ -\log_{10}(T_B) \end{bmatrix}

In chromogenic color negatives processed under standard C-41 chemistry, the unexposed film rebates contain residual unreacted color couplers forming an orange cast. This unexposed substrate introduces a substantial constant additive baseline. Designating the measured unexposed film base density under identical scanning conditions as DbaseD_{\text{base}}, the net optical density DnetD_{\text{net}} is obtained through channel-wise subtraction:

Dnet=Draw−Dbase=[Draw,R−Dbase,RDraw,G−Dbase,GDraw,B−Dbase,B]D_{\text{net}} = D_{\text{raw}} - D_{\text{base}} = \begin{bmatrix} D_{\text{raw}, R} - D_{\text{base}, R} \\ D_{\text{raw}, G} - D_{\text{base}, G} \\ D_{\text{raw}, B} - D_{\text{base}, B} \end{bmatrix}

Within the net optical density space, the developed dye mass exhibits a predictable inverse relationship with original scene exposure. Provided the photographic emulsion operates between the toe underexposure threshold and the shoulder saturation plateau, net density adheres closely to the classic Hurter-Driffield sensitometric formulation:

Dnet,c≈γc⋅log⁡10(Ec)+Cc,c∈{R,G,B}D_{\text{net}, c} \approx \gamma_c \cdot \log_{10}(E_c) + C_c, \quad c \in \{R, G, B\}

where γc\gamma_c denotes the photographic development contrast factor for dye layer cc. Within this optical density domain, essential darkroom operations reduce to elementary linear algebra:

Density Operation Physical Analog & Darkroom Practice Governing Mathematical Formulation
Film Base Subtraction Eliminating polyester support and unexposed orange coupler absorption Dnet=Draw−DbaseD_{\text{net}} = D_{\text{raw}} - D_{\text{base}}
Printer Lights Grading Emulating red, green, and blue additive/subtractive optical enlarger head filtration Dgraded=Dnet+ΔPlightD_{\text{graded}} = D_{\text{net}} + \Delta P_{\text{light}}
Density Window Normalization Mapping scene negative density span to target display luminance bounds Dnorm=(Dhigh−D)/(Dhigh−Dlow)D_{\text{norm}} = (D_{\text{high}} - D) / (D_{\text{high}} - D_{\text{low}})
Spectral Crosstalk Decoupling Correcting magenta secondary absorption in high-density regions Dcalibrated=Mcrosstalk⋅DnetD_{\text{calibrated}} = M_{\text{crosstalk}} \cdot D_{\text{net}}

# Positive Print & Output Domain: Linear ProPhoto to Display Rendering

Even after film base subtraction and printer lights balance, the net density vector represents an analytical measurement of physical absorption rather than a displayable positive image. The positive print and output domain is responsible for mapping inverted relative exposures into a standardized, colorimetrically defined linear workspace, followed by aesthetic tone reproduction and display-referred encoding.

The NexFilm Engine utilizes Linear ProPhoto RGB (ROMM RGB with an identity linear transfer function) as its universal internal positive working space. Once inverted relative exposures are placed within this wide-gamut linear framework, subsequent grading and mastering proceed systematically:

  1. Working Space Linearization: Converting normalized logarithmic density into linear positive exposure Epos=10−α⋅DgradedE_{\text{pos}} = 10^{-\alpha \cdot D_{\text{graded}}}, restoring radiant proportionality to the positive scene estimate.
  2. Per-Channel and Master Tone Curves: Applying discrete red, green, and blue tone curves to shape shadow and highlight color balance, followed by a composite luminance curve modeling traditional print paper D-log-H characteristics.
  3. Print Film Emulation 3D LUTs: Evaluating verified three-dimensional lookup tables calibrated against motion picture print stocks (such as Kodak 2383 or Vision Premier 2393), conferring characteristic deep shadow d-max and rich dye separation.
  4. Target Color Space Transform & OETF Encoding: Projecting positive color coordinates into target output profiles (sRGB, Display P3, Adobe RGB, or ACEScg) and applying corresponding optical-electro transfer functions.
Note

Contrast adjustments, shadow recovery, and saturation balancing conducted in the positive print domain reflect perceptual aesthetics. Under no circumstances should these display-referred transforms be allowed to perturb optical density measurements.

# Non-Commutative Matrix Proof: The Invalidation of Density Color Space Transforms

A widespread architectural defect in legacy film inversion software is the confusion between transmittance-domain matrices and density-domain matrices. Several heuristic implementations attempt to apply standard monitor color space matrices directly to logarithmic density vectors, asserting that this approximates optical calibration. This section presents a formal proof demonstrating why such operations are mathematically invalid.

Let x=[T1,T2,T3]T∈R>03x = [T_1, T_2, T_3]^T \in \mathbb{R}_{>0}^3 represent a strictly positive trichromatic transmittance vector. Let A∈R3×3A \in \mathbb{R}^{3 \times 3} denote an optical sensor channel separation matrix with coefficients aija_{ij}.

In the physical transmittance domain, matrix AA acts as a linear operator over radiant flux, decoupling optical channel crosstalk:

ytrans=Ax,yi=∑j=13aijxjy_{\text{trans}} = A x, \quad y_i = \sum_{j=1}^3 a_{ij} x_j

Mapping this physically corrected transmittance vector into the optical density domain yields the true density vector:

Dcorrect=−log⁡10(Ax)=[−log⁡10(∑j=13a1jxj)−log⁡10(∑j=13a2jxj)−log⁡10(∑j=13a3jxj)]D_{\text{correct}} = -\log_{10}(A x) = \begin{bmatrix} -\log_{10}\left(\sum_{j=1}^3 a_{1j} x_j\right) \\ -\log_{10}\left(\sum_{j=1}^3 a_{2j} x_j\right) \\ -\log_{10}\left(\sum_{j=1}^3 a_{3j} x_j\right) \end{bmatrix}

Now consider the flawed implementation that applies matrix AA after the logarithmic transformation, multiplying raw densities Draw=−log⁡10(x)D_{\text{raw}} = -\log_{10}(x) by AA:

Dwrong=A[−log⁡10(x)]=[∑j=13a1j[−log⁡10(xj)]∑j=13a2j[−log⁡10(xj)]∑j=13a3j[−log⁡10(xj)]]=[−log⁡10(∏j=13xja1j)−log⁡10(∏j=13xja2j)−log⁡10(∏j=13xja3j)]D_{\text{wrong}} = A [-\log_{10}(x)] = \begin{bmatrix} \sum_{j=1}^3 a_{1j} [-\log_{10}(x_j)] \\ \sum_{j=1}^3 a_{2j} [-\log_{10}(x_j)] \\ \sum_{j=1}^3 a_{3j} [-\log_{10}(x_j)] \end{bmatrix} = \begin{bmatrix} -\log_{10}\left(\prod_{j=1}^3 x_j^{a_{1j}}\right) \\ -\log_{10}\left(\prod_{j=1}^3 x_j^{a_{2j}}\right) \\ -\log_{10}\left(\prod_{j=1}^3 x_j^{a_{3j}}\right) \end{bmatrix}

For Dcorrect≡DwrongD_{\text{correct}} \equiv D_{\text{wrong}} to hold identically across all valid inputs xx, the arguments of the logarithms must satisfy:

∑j=13aijxj≡∏j=13xjaij,∀i∈{1,2,3}\sum_{j=1}^3 a_{ij} x_j \equiv \prod_{j=1}^3 x_j^{a_{ij}}, \quad \forall i \in \{1, 2, 3\}

Taking the partial derivative of both sides with respect to arbitrary component xkx_k:

The partial derivative of the left-hand summation evaluates to a constant:

∂∂xk(∑j=13aijxj)=aik\frac{\partial}{\partial x_k} \left(\sum_{j=1}^3 a_{ij} x_j\right) = a_{ik}

The partial derivative of the right-hand product yields:

∂∂xk(∏j=13xjaij)=aikxkaik−1∏j≠kxjaij\frac{\partial}{\partial x_k} \left(\prod_{j=1}^3 x_j^{a_{ij}}\right) = a_{ik} x_k^{a_{ik}-1} \prod_{j \neq k} x_j^{a_{ij}}

Equating these partial derivatives across all x∈R>03x \in \mathbb{R}_{>0}^3 requires that matrix AA degrade strictly to the identity matrix II or a purely diagonal scaling matrix. Whenever matrix AA incorporates off-diagonal cross-coupling terms (where aij≠0a_{ij} \neq 0 for j≠kj \neq k), this identity collapses:

−log⁡10(Ax)≠A[−log⁡10(x)]-\log_{10}(A x) \neq A [-\log_{10}(x)]

Conclusion: Physical radiant flux sums linearly before the logarithm, whereas dye optical absorbance sums algebraically after the logarithm. Attempting to apply a standard chromaticity matrix in the density domain fails to decouple capture hardware variations and introduces severe chromatic distortion across highlight roll-offs and deep shadow transitions.

# Signal Flow Diagram & Concrete Technical Boundaries

To assist engineers and technical colorists in tracing data flow throughout the codebase, the diagram below outlines the NexFilm v1.1.0 signal pipeline across all three mathematical domains:

Transmittance Domain (Pre-Log) Radiant Photon Flux · Linear Light RAW / Scanner RGB Black level, demosaic, bad pixels Dark Subtraction & Flat Field T = (I - dark) / (open - dark) Capture Separation 3x3 Sensor x backlight decoupling Log Transform with Epsilon D_raw = -log10(max(T, eps)) Density Domain (Post-Log) Beer-Lambert Absorbance Space Base Sampling & Subtraction D_net = D_raw - D_base Printer Lights Grading Logarithmic additive color shift Bounded Channel Span Response 1.15x deadzone, 1.35x / 3x caps Inversion & Positive Exposure E_pos = 10^(-alpha * D) Positive & Output Domain Linear ProPhoto · Color Transform Linear ProPhoto Working Space Universal linear-light positive buffer Four-Channel Curves & LUTs RGB curves and Kodak 2383 Spatial Spatial Enhancements High-pass mask sharpening, shadows Display & Master Delivery sRGB / P3 / ACEScg / 16-bit TIFF

NexFilm v1.1.0 maintains an explicit, verifiable boundary regarding implemented capabilities versus ongoing research:

  1. Implemented Capabilities: Strict mathematical isolation of the three operational domains; dark frame subtraction and open-gate flat-field relative transmittance normalization; transmission target patch fitting with SVD condition number safety guards; bounded channel span response for cross-platform color stability; and 16-bit linear mastering alongside CFA camera RAW DNG encapsulation.
  2. Current Technical Boundaries: The v1.1.0 release does not incorporate an optical Status M spectral integration library, and historical matrix estimates are retained solely for legacy backward compatibility; furthermore, batch-specific nonlinear photographic H-D emulsion curves are not inverted. Inversion relies entirely on verifiable relative transmittance and rigorous logarithmic density algebra.