g_viz_lab.m 1.48 KB
Newer Older
1
function g_viz_lab(imgFname,rectFile);
Daniel Bourgault's avatar
Daniel Bourgault committed
2

3
4
figure

Daniel Bourgault's avatar
Daniel Bourgault committed
5
6
7
8
9
% Set some plotting parameters
ms = 10;  % Marker Size
fs = 10;  % Font size
lw = 2;  % Line width

10
load(rectFile);
Daniel Bourgault's avatar
Daniel Bourgault committed
11

12
13
% 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
14
fac = 0.1;
15
16
17
18
19
20
21
22
23
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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

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);
39
pcolor(LON,LAT,int);
Daniel Bourgault's avatar
Daniel Bourgault committed
40
41
42
43
44
45
shading('flat');

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

%% Plot GCPs and ICPs.
for n=1:length(i_gcp)
46
47
48
49
50
51
52
53
54
    
    % 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
55
end
56

57
58
axis([lon_min lon_max lat_min lat_max]);
daspect([1 1 1]);