Colors: Desktop Monitor to the Big Screen (& back) Alan Edelman Dept of Mathematics: MIT MIT Laboratory for Computer Science Frank Wang Arun Rao (Pixar) Graphics Lunch April 25, 2003 Other Topics Not Covered Today • Parallel MATLAB • The Bohemian Dome Horizontal A=QQT Vertical A=QQ Villarceau A=QR Hopf Fibration Outline • The Data • The Problem • Step 1: Finding the right three dimensional basis • Step 2: Inverting onto that basis • Step 3: Forming the model Outline • The Data • The Problem • Step 1: Finding the right three dimensional basis • Step 2: Inverting onto that basis • Step 3: Forming the model The data (101 points x 1000 frames) wavelength vs density Reds Greens Grays film density = log(no film / with film) Blues Film Recording and measurements • Solid colors sent to film recorder, e.g. reds • Negative is produced: film appears as cyans • Negative sent through projector to spectrometer • Energy data at each wavelength Reds • Log ratio with no film (only bulb) film density = log(no film / with film) Outline • The Data • The Problem • Step 1: Finding the right three dimensional basis • Step 2: Inverting onto that basis • Step 3: Forming the model Movie Making Step I: The artists PixarArtists choose colors on their desktop computer monitors Step II: Color Recording Digital Images Recorded on Film 1. http://www.pixar.com/companyinfo/press/1999/pr99-0204a.html 2. Film Developed Step III: Color Reproduction Film Projected Onto Screen at a movie theatre near you Problem: Colors on the big screen just do not look the same. The Two Stages color recording stage color reconstruction stage The Two Stages color recording stage color reconstruction stage Models, Algorithms, Numerics • physically based models • numerical techniques To invert the color reproduction & recording steps. Outline • The Data • The Problem • Step 1: Finding the right three dimensional basis • Step 2: Inverting onto that basis • Step 3: Forming the model SVD of the data • • • • Inputs (r,g,b) for 1r,g,b 10 scaled (1000 frames) Output Space: Densities at 400:3:700 nm’s Data Structure: 101 x 1000 matrix “A” Compute SVD(A) •Project onto best 3 space svd Three significant singular values index SVD Basis = no physical meaning Orthogonality Constraint too strong The NNMF Basis = primary colors Non-Negative Matrix Factorization •The NNMF (Lee, Seung 1999) •V WH Input: Vij>0 Output: Wij>0 Hij>0 (low rank) Algorithm: H H .* (W’V)./(W’WH) W W .* (VH’)./(WHH’) •Original Application: Eigenfaces •New Algorithm: Project SVD Into Cone using Convex Hull Algorithm Errors of two NNMF implementations • More than 1Mflop per NNMF iteration. Error flattens after 50000 iteration. • Accuracy of new algorithm improves as samples increase, but not for NNMF. • NNMF can easily generalize to higher dimension. SVD with a geometry tweak Compare bases extracted by the two methods Projection of 1000 spectra onto the basis 101x1000 3x1000 10x10x10 Input and output for stage 1 • Find a functional relationship between laser input and output of concentration vectors by either interpolation or a physical model. Outline • The Data • The Problem • Step 1: Finding the right three dimensional basis • Step 2: Inverting onto that basis • Step 3: Forming the model Color matching functions CIERGB CIEXYZ chromaticity diagram (XYZ) spectrum locus purple line CIELAB color space Obtain coefficients from Color • Given a color as (x,y,z) in CIEXYZ coordinates compute c1,c2,c3 such that (x,y,z)=∫λ (x(λ),y(λ),z(λ)) I0(λ) * -(c1b1(λ)+c2b2(λ)+c3b3(λ)) e dλ Newton’s Method The Physical Model I out c I in Bear’s Law I out I inc m y c1 c2 c3 I out ( ) d ( ) log( ) c1b1 ( ) c2b2 ( ) c3b3 ( ) I in ( ) c1 b1 ( ) b2 ) b 3 ( )c2 c3 Outline • The Data • The Problem • Step 1: Finding the right three dimensional basis • Step 2: Inverting onto that basis • Step 3: Forming the model The Two Stages color recording stage color reconstruction stage The Two Stages color recording stage color reconstruction stage The tri-pack structure of color film Exposing Color Light yellow filter blue-sensitive layer yellow filter green-sensitive layer red-sensitive layer yellow filter Film development process HD curve of film: density v.s. exposure Physical effects motivates co-linear fit • Inter-layer effects are at play: cross-layer inhibition, cross-layer exposure and crosslayer absorption. • Possible diminishing cross layer exposure effect motivates a bilinear basis in the model. (1,•logThe R, log model G, log B, log G, logsquare G log B, log log the R, logdata R log G log B) is Ralog least fitBof involving only co-linear bases: Summary • Expose 1000 frames of color film to 1000 colors sampled from a RGB color cube. • Collect 1000 spectra by measuring the output color light of the 1000 frames of film. • Invert the second stage: – From the spectra data, extract three bases, i.e. the absorption functions of three dye layers using either NNMF or a geometrical approach involving SVD. – From a given intended color specified in XYZ color coordinates, solve for density vectors using Newton's method. • Invert the first stage: – Compute all 1000 concentration vectors of the 1000 spectra. – Build a functional relationship between the 1000 colors from a RGB cube and the 1000 density vectors using either interpolation or a physical model. • Solve this function for a set of RGB inputs that will give the density vector obtained from previous stage.