-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexactSunModel.m
31 lines (26 loc) · 1.09 KB
/
exactSunModel.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function lum = exactSunModel(c, d, e, f, up, vp, vh, phi, phiSun, thetaSun)
% Synthesizes the sun contribution to the sky model
%
% Input parameters:
% - c, d, e: Perez sky model parameters
% - f: camera focal length (in pixels)
% - up: x-coordinates of pixels in image
% - vp: y-coordinates of pixels in image
% - theta: camera zenith angle
% - phi: camera azimuth angle (in radians)
% - phiSun: sun azimuth angle (in radians)
% - thetaSun: sun zenith angle (in radians)
%
% Output parameters:
% - lum: luminance map in image coordinates (same dimensions as up and up)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function lum = exactSunModel(c, d, e, f, up, vp, theta, phi, phiSun, thetaSun)
phic = phi;
thetap = pixelZenithAngle(theta, f, up, vp);
phip = pixelAzimuthAngle(theta, phic, f, up, vp);
deltaPhi = abs(phiSun - phip);
gamma = acos(cos(thetaSun) .* cos(thetap) + sin(thetaSun) .* sin(thetap) .* cos(deltaPhi));
% plug in Perez sky model
lum = perezSunModel(c, d, e, gamma);