next up previous
Next: About this document Up: Finding Anti-Personnel Mines in Previous: neural.m: Generates the training

 

rap_images.m: Generates all the Matlab pictures shown in this report

%--------------------------------------------------------------------
% Create image ssand3.eps
figure;
load ssand3;
ssand3 = normalize( ssand3 ) * 64;
image( [0 3], [0 15], ssand3 );
colormap( gray( 64 ));
title( 'sand3' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );
set( gcf, 'InvertHardCopy', 'off' );
print ssand3 -deps

%--------------------------------------------------------------------
% Create ssand3_b.eps
figure;
I_backgr = normalize( background_removal( ssand3 )) * 64;
image( [0 3], [0 15], I_backgr );
colormap( gray( 64 ));
title( 'sand3_br' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );
set( gcf, 'InvertHardCopy', 'off' );
print ssand3_b -deps

%--------------------------------------------------------------------
% Create the images hor_filt.eps and ssand3_h.eps
hor_remove;
figure;
plot( filtre_hor );
title( 'Horizontal Filter Mask' );
xlabel( 'Pixel' );
ylabel( 'Factor' );
print hor_filt -deps

figure;
I_hr = conv2( ssand3, filtre_hor, 'valid' );
I = medfilt2( I_hr, [5 3] );
I = normalize( I ) * 64;
image( [0 3], [0 15], I );
colormap( gray( 64 ));
title( 'sand3_hr' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );
set( gcf, 'InvertHardCopy', 'off' );
print ssand3_h -deps

%--------------------------------------------------------------------
% Create lami.eps
% plot the image appearing in the LAMI report

figure;
ssand3 = normalize( ssand3 ) * 64;
subplot(1,2,1), image( [0 3], [0 15], ssand3 );
colormap( gray( 64 ));
title( 'sand3' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );

subplot(1,2,2), image( [0 3], [0 15], I );
title( 'sand3_hr' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );

set( gcf, 'InvertHardCopy', 'off' );
print lami -deps

%--------------------------------------------------------------------
% Create iffa.eps et iffp.eps
% Montres les transformees de Fourier, le module et la phase

Iff=fft(I);
Iffa=fftshift_1d(abs(Iff));
Iffp=fftshift_1d(angle(Iff));

[m, n] = size(Iffa);
Iffa = Iffa( 1:4:m, 1:4:n );
Iffp = Iffp( 1:4:m, 1:4:n );
figure;
mesh(Iffa);
xlabel( 'Matrix index' );
ylabel( 'Matrix index' );
zlabel( 'Absolute value' );
print iffa -deps

figure;
pcolor(Iffp);
xlabel( 'Matrix index' );
ylabel( 'Matrix index' );
print iffp -deps

%--------------------------------------------------------------------
% Create hist_st1.eps
% plot the image with the histogram stretching for ssand3
figure;
subplot(2,2,1), image( [0 3], [0 15], ssand3 );
colormap(gray(64));
title( 'sand3' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );

subplot(2,2,3), hist(ssand3(:), 64);
title( 'Histogram of sand3' );

hs = hist_stretch( ssand3 );
hss = hist_stretch( hs );
hsss = hist_stretch( hss );
hsss = normalize( hsss ) * 64;

subplot(2,2,2), image( [0 3], [0 15], hsss );
colormap( gray(64) );
title( 'sand3 with hist stretch' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );

subplot(2,2,4), hist(hsss(:), 64);
title( 'Histogram of stretched sand3' );

set( gcf, 'InvertHardCopy', 'off' );
print hist_st1 -deps

%--------------------------------------------------------------------
% Create hist_st2.eps
% plot the image with the histogram stretching for ssand3_hr = I
figure;
subplot(2,2,1), image( [0 3], [0 15], I );
colormap(gray(64));
title( 'sand3_hr' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );

subplot(2,2,3), hist( I(:), 64);
title( 'Histogram of sand3_hr' );
xlabel( 'Intensity' );
ylabel( 'Nb. of Pixels' );

hs = hist_stretch( I );
hss = hist_stretch( hs );
hsss = hist_stretch( hss );
hsss = hist_stretch( hsss );
hsss = normalize( hsss ) * 64;

subplot(2,2,2), image( [0 3], [0 15], hsss );
colormap( gray(64) );
title( 'sand3_hr with hist stretch' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );

subplot(2,2,4), hist(hsss(:), 64);
title( 'Histogram of stretched sand3_hr' );
xlabel( 'Intensity' );
ylabel( 'Nb. of Pixels' );

set( gcf, 'InvertHardCopy', 'off' );
print hist_st2 -deps

%--------------------------------------------------------------------
% Create hist_st3.eps
% plot the image with the histogram stretching for ssand3_br
figure;
subplot(2,2,1), image( [0 3], [0 15], I_backgr );
colormap(gray(64));
title( 'sand3_br' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );

subplot(2,2,3), hist( I_backgr(:), 64);
title( 'Hist of sand3_br' );
xlabel( 'Intensity' );
ylabel( 'Nb. of Pixels' );

hs = hist_stretch( I_backgr );
hs = hist_stretch( hs );
hs = hist_stretch( hs );
hs = hist_stretch( hs );
hs = hist_stretch( hs );
hs = normalize( hs ) * 64;

subplot(2,2,2), image( [0 3], [0 15], hs );
colormap( gray(64) );
title( 'sand3_br with hist stretch' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );

subplot(2,2,4), hist(hs(:), 64);
title( 'Histogram of stretched sand3_br' );
xlabel( 'Intensity' );
ylabel( 'Nb. of Pixels' );

set( gcf, 'InvertHardCopy', 'off' );
print hist_st3 -deps

%--------------------------------------------------------------------
% Create sigmoid.eps, showing the sigmoid function

figure;
t = [-4:0.1:4];
plot( t, 1./(1+exp(-t)));
xlabel( 'Intensity' );
ylabel( 'Factor' );

print sigmoid -deps

%--------------------------------------------------------------------
% Create hyper.eps

figure;
hy = normalize(hyperbola(1,1,0.5,2,-1,1)) * 16;
image( hy );
title( 'Hyperbola a=1 b=1' );
colormap( gray( 16 ));
set( gcf, 'InvertHardCopy', 'off' );
print hyper -deps

%--------------------------------------------------------------------
% Create hyper_qu.eps

figure;
ha = adjust(hy);
[m n] = size( hy );
hax = ha( : , 1:2:2*n-1 );
hay = ha( : , 2:2:2*n );
[x y] = meshgrid(1:n, 1:m);
quiver(x, y, hax, hay);
title( 'Linear Symmetry Plot of Hyperbola' );
print hyper_qu -deps

%--------------------------------------------------------------------
% Create reps.eps, showing different representations

figure;
J = hist_stretch( I );
J = hist_stretch( J );
% J = hist_stretch( J );
J = normalize( J ) * 64;
subplot(2,2,1), image( [0 3], [0 15], J );
colormap(gray(64));
title( 'sand3_hr' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );

J = normalize( J ) * 16;
subplot(2,2,2), contour( J );
J = normalize( J ) * 64;
title( 'Contour plot' );
xlabel( 'matrix indices' );
ylabel( 'matrix indices' );

[m n] = size( J );
Jt = J( 1:9:m, 1:9:n );
[m n] = size( Jt );
[mx my] = gradient( Jt );
[gx gy] = meshgrid( 1:n, 1:m );
subplot(2,2,3), quiver( gx, gy, mx, my );
title( 'Gradient plot' );
xlabel( 'matrix indices' );
ylabel( 'matrix indices' );

J = normalize( J ) * 4;
subplot(2,2,4), image( [0 3], [0 15], round(J) * 16 );
title( '4 color plot' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );
set( gcf, 'InvertHardCopy', 'off' );
print reps -deps

%--------------------------------------------------------------------
% Create neuract1.eps

load res
figure;
res = normalize( res ) * 64;
image( [0 2.8], [0 12], res );
colormap(gray(64));
title( 'NN activaiton' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );
set( gcf, 'InvertHardCopy', 'off' );
print neuract1 -deps

%--------------------------------------------------------------------
% Create neurhil1.eps

figure;
[m n] = size( res );
mesh( res( 1:4:m, 1:4:n ));
title( 'NN activaiton' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );
% set( gcf, 'InvertHardCopy', 'off' );
print neurhil1 -deps

%--------------------------------------------------------------------
% Create neuract2.eps

load neuract2
figure;
neuract2 = normalize( neuract2 ) * 64;
image( [0 2.8], [0 12], neuract2 );
colormap(gray(64));
title( 'NN activaiton' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );
set( gcf, 'InvertHardCopy', 'off' );
print neuract2 -deps

%--------------------------------------------------------------------
% Create neurhil2.eps

figure;
[m n] = size( neuract2 );
mesh( neuract2( 1:4:m, 1:4:n ));
title( 'NN activaiton' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );
% set( gcf, 'InvertHardCopy', 'off' );
print neurhil2 -deps

%--------------------------------------------------------------------
% Create neurhi2.eps Shows the square containing the highest activation

figure;
size_x = 40;
size_y = 30;
% try to find the highest activation
max_val = max( res(:));
[maxi, maxj] = find( res >= max_val );
% and draw a square around the spot in the first image
I_hi = ssand3;
max_s = max( I_hi(:));
I_hi( maxi(1), maxj(1):maxj(1)+size_x-1 ) = 
  max_s * ones( 1, size_x );
I_hi( maxi(1)+size_y-1, maxj(1):maxj(1)+size_x-1 ) =
  max_s * ones( 1, size_x );
I_hi( maxi(1):maxi(1)+size_y-1 , maxj(1)) =
  max_s * ones( size_y, 1 );
I_hi( maxi(1):maxi(1)+size_y-1 , maxj(1)+size_x-1 ) =
  max_s * ones( size_y, 1 );
I_hi = normalize( I_hi ) * 64;
image( [0 3], [0 15], I_hi );
colormap(gray(64));
title( 'Maximum activaiton' );
xlabel( 'distance [m]' );
ylabel( 'time [ns]' );
set( gcf, 'InvertHardCopy', 'off' );
% print neurhi2 -deps

%--------------------------------------------------------------------
% Create .eps



Adrian Perrig
Wed Jun 5 22:28:55 MET DST 1996