-
Notifications
You must be signed in to change notification settings - Fork 4
/
hl_score.m
27 lines (22 loc) · 1.12 KB
/
hl_score.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
% function [hl_homo, ortho_ modes_left, modes_right, results] = hl_score(hl_samp, infiniteVPs_homo, seglines, xres, yres, focal, zeniths_homo, zengroups, params)
function [hl_homo, results] = hl_score(hl_samp, ls_homo, z_homo, params)
candidates = repmat(struct(), size(hl_samp,2),1);
nhvps = [];
for i = 1:size(hl_samp,2)
helpfulIds = filter_verhor_lines(ls_homo, z_homo, params);
initialIds = 1:numel(helpfulIds);
candidates(i).horizon_homo = hl_samp(:,i);
[candidates(i).sc, candidates(i).hvp_homo, hvp_groups] = vp_predict(ls_homo(:,helpfulIds), initialIds, candidates(i).horizon_homo, params);
candidates(i).hvp_groups = cellfun(@(x) helpfulIds(x), hvp_groups, 'UniformOutput', false);
nhvps(i) = size(candidates(i).hvp_homo,2);
end
%% decide the horizon line
horCandidateScores = [candidates.sc];
[~,maxHorCandidateId] = max(horCandidateScores);
hl_homo = candidates(maxHorCandidateId).horizon_homo;
%% output results
results = struct();
results.hvp_groups = candidates(maxHorCandidateId).hvp_groups;
results.hvp_homo = candidates(maxHorCandidateId).hvp_homo;
results.score = candidates(maxHorCandidateId).sc;
end