Skip to content

Instantly share code, notes, and snippets.

@jordanwesthoff
Created March 17, 2015 20:29
Show Gist options
  • Save jordanwesthoff/8efc680ba53b994d5cab to your computer and use it in GitHub Desktop.
Save jordanwesthoff/8efc680ba53b994d5cab to your computer and use it in GitHub Desktop.
MATLAB Script to generate CIEPlot of the REC.709 OETF Function
% Basic single use script to plot the correct CIE REC.709 OETF function
% Jordan Westhoff, RIT 2014
% Use exposure math to calculate the first portion of the OETF
G = 1.099;
B = 1 - G;
L = (G/10)^(20/11);
% Use some more exposure math to calculate the second portion of the OETF
x = [-5:.01:20];
y = zeros(1,length(x));
y(1:500) = 10;
x = 0:0.001:L; y = 4.5*x;
% String these two dependency subsets together to plo the full OETF
x_2 = 0.018:0.001:1;
y_2 = 1.099*(x_2.^(0.45)) - 0.099;
% Plot everything, add labels, legend and colors to differentiate segments.
plot(x,y,'r-')
hold on
plot(x_2,y_2,'b-')
title('Test plot of the OETF curve from slides, using derived data')
legend('4.5L -> 0.0=<L=<0.018', '1.099L^0.45-0.99 -> 0.018=<L=<1')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment