-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCalcG2.m
More file actions
22 lines (22 loc) · 695 Bytes
/
CalcG2.m
File metadata and controls
22 lines (22 loc) · 695 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function [gR, gG, gB] = CalcG2(mean_RF,mean_GF,mean_BF, T,verbose)
fun = @(x,T)x(1)*T.^(1/x(2));
x0 = [1600,1.5];
r = lsqcurvefit(fun,x0,T,mean_RF);
gR = r(2);
g = lsqcurvefit(fun,x0,T,mean_GF);
gG = g(2);
b = lsqcurvefit(fun,x0,T,mean_BF);
gB = b(2);
if verbose
figure('Name','Camera Compression Data Linearized');
plot(T,(mean_RF.^gR)/(255^gR/255),'r--x')
hold on
plot(T,(mean_BF.^gG)/(255^gG/255), 'b--x')
plot(T,(mean_GF.^gB)/(255^gB/255), 'g--x')
hold off
title('Camera Compression Data Linearized (B^g) and scaled')
xlabel('Exposure time [sec]')
ylabel('Brightness [au]')
legend('Red','Blue','Green')
end
end