-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestProjectToMapLooper.m
More file actions
67 lines (56 loc) · 2.35 KB
/
testProjectToMapLooper.m
File metadata and controls
67 lines (56 loc) · 2.35 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function [Twist,WetBdy,Offsets] = testProjectToMapLooper(Config,TestImage1,TestImage2,WL,SurveyPoints)
% get screensize for plot setups
ScrSz = get(groot, 'ScreenSize');
% Measure pole twist
Twist = MeasureTwist1(TestImage1,Config.Cam1.k,Config.Cam1.Resolution,true);
% find wet edges
[WetMask1, WetBdy1] = WetDry2(TestImage1, Config.FgBgMask1, ...
Config.SeedPixel1, Twist, false);
[WetMask2, WetBdy2] = WetDry2(TestImage2, Config.FgBgMask2, ...
Config.SeedPixel2, ...
[Twist(1),-Twist(2),-Twist(3)], false);
% convert WetBdys to easting northing
[BdyEasting1, BdyNorthing1] = ...
ProjectToMap(Config.Cam1, WL, Twist, WetBdy1(:,1), WetBdy1(:,2));
[BdyEasting2, BdyNorthing2] = ...
ProjectToMap(Config.Cam2, WL, ...
[Twist(1),-Twist(2)*Config.Cam2.ViewWidth/Config.Cam1.ViewWidth,-Twist(3)], ...
WetBdy2(:,1), WetBdy2(:,2));
WetBdy1 = [BdyEasting1, BdyNorthing1];
WetBdy2 = [BdyEasting2, BdyNorthing2];
% Remove backshore part of WetBdy polygon to leave polyline along barrier
WetBdy1 = cleanWetBdy(WetBdy1);
WetBdy2 = cleanWetBdy(WetBdy2);
% display projected image as surface
figure('Position', [(ScrSz(3)/2)-700, ScrSz(4)/2-300, 1400, 400]);
MapAx = plotProjected(TestImage1,Twist,WL,Config.Cam1,...
Config.FgBgMask1,[],true);
hold(MapAx,'on')
plotProjected(TestImage2, ...
[Twist(1),-Twist(2)*Config.Cam2.ViewWidth/Config.Cam1.ViewWidth,-Twist(3)], ...
WL,Config.Cam2, Config.FgBgMask2, MapAx, true);
% overlay surveyed waters edge
hold(MapAx,'on')
SurveyH = plot(MapAx,SurveyPoints(:,1), SurveyPoints(:,2), 'c-');
hold(MapAx,'off')
% calculate offsets along transects and add them and WetBdy to plot
WetBdy = [WetBdy1; ...
nan(1,2); ...
WetBdy2];
hold(MapAx,'on')
[Offsets, OffsetsH] = measureOffsets(WetBdy,Config.Transects,true,MapAx);
hold(MapAx,'off')
% Tidy up the plot for export
view(MapAx,45,90)
xlim(MapAx,[1622800,1624300])
ylim(MapAx,[5248600,5250200])
set(MapAx,'Position',[-0.6 -2.1 2.2 5])
axis(MapAx,'off')
legend(MapAx, [SurveyH;OffsetsH([1,2,4])], ...
{'Surveyed waters edge', ...
'Image analysis waters edge', ...
'Measurement transects', ...
'Measured offset'}, ...
'Position',[0.81 0.06 0.17 0.28], ...
'FontSize',11)
end