g_viz_lab.m 1.45 KB
Newer Older
1
function g_viz_lab(imgFname,rectFile);
Daniel Bourgault's avatar
Daniel Bourgault committed
2
3
4
5
6
7

% Set some plotting parameters
ms = 10;  % Marker Size
fs = 10;  % Font size
lw = 2;  % Line width

8
load(rectFile);
Daniel Bourgault's avatar
Daniel Bourgault committed
9

10
11
% Determine the region to plot, delimited by the GCP and the camera
% position. Add a factor (fac) all around
Daniel Bourgault's avatar
Daniel Bourgault committed
12
fac = 0.1;
13
14
15
16
17
18
19
20
21
lon_min = min([lon_gcp,LON0]);
lon_max = max([lon_gcp,LON0]);
lat_min = min([lat_gcp,LAT0]);
lat_max = max([lat_gcp,LAT0]);

lon_min = lon_min - fac*abs(lon_max - lon_min);
lon_max = lon_max + fac*abs(lon_max - lon_min);
lat_min = lat_min - fac*abs(lat_max - lat_min);
lat_max = lat_max + fac*abs(lat_max - lat_min);
Daniel Bourgault's avatar
Daniel Bourgault committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

rgb0 = double(imread(imgFname))/255;

[mm nn pp] = size(rgb0);
if pp == 3
  int = (rgb0(:,:,1)+rgb0(:,:,2)+rgb0(:,:,3))/3; 
else
  int = rgb0;     
end
clear rgb0;
int = int';

hold on;

colormap(gray);
37
pcolor(LON,LAT,int);
Daniel Bourgault's avatar
Daniel Bourgault committed
38
39
40
41
42
43
shading('flat');

plot(LON0,LAT0,'kx','markersize',ms,'linewidth',lw);  % Camera location

%% Plot GCPs and ICPs.
for n=1:length(i_gcp)
44
45
46
47
48
49
50
51
52
    
    % Plot the original GCPs that may have elevations
    plot(lon_gcp0(n),lat_gcp0(n),'ko','markersize',ms,'linewidth',lw);
    
    % Plot the projected GCPs that are actually used for the minimization
    plot(lon_gcp(n),lat_gcp(n),'bo','markersize',ms,'linewidth',lw);
    
    % Plot the Image Control Points once georectified
    plot(LON(i_gcp(n),j_gcp(n)),LAT(i_gcp(n),j_gcp(n)),'rx','MarkerSize',ms,'linewidth',lw);
Daniel Bourgault's avatar
Daniel Bourgault committed
53
end
54
55

axis([lon_min lon_max lat_min lat_max]);