Skip to content

Instantly share code, notes, and snippets.

@ProjectEli
Created May 9, 2021 09:52
Show Gist options
  • Save ProjectEli/693d0c8df199959552356e5a10fed4f6 to your computer and use it in GitHub Desktop.
Save ProjectEli/693d0c8df199959552356e5a10fed4f6 to your computer and use it in GitHub Desktop.
[MATLAB] RGB gamma interpolation 3D
close all; clear; clc;
color_raw=0:0.05:1;
RGB_Lift_raw=(0:0.05:2).';
Ncolor = length(color_raw); vcolor=ones(1,Ncolor);
NLift = length(RGB_Lift_raw); vLift = ones(NLift,1);
color = vLift * color_raw;
RGB_Lift = RGB_Lift_raw * vcolor;
color_final = color .* (1.5 - 0.5 * RGB_Lift) + 0.5 * RGB_Lift - 0.5;
figure(1);surf(color_raw,RGB_Lift_raw,color_final);
xlabel('Original RGB');
ylabel('Lift value');
zlabel('New RGB');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment