Text Figure (3.4) : Negative Transform
Text Figure (3.4) : Negative Transform
= double(img).^(0.4); img4 =
max(img2(:) - min(img2(:)));
max(img3(:) - min(img3(:)));
max(img4(:) - min(img4(:)));
250
200
150
100
50
0
0
50
100
150
200
Input Gray Level, r
Contrast-Stretched Image
250
Thresholded Image
200
200
150
100
50
150
100
50
50
100
150
Input Gray Level, r
Original Aerial Road Image
200
250
50
100
150
Input Gray Level, r
200
250
=
=
=
=
double(bitand(img,128));
double(bitand(img,32));
double(bitand(img,8));
double(bitand(img,2));
img6
img4
img2
img0
=
=
=
=
double(bitand(img,64));
double(bitand(img,16));
double(bitand(img,4));
double(bitand(img,1));
figure;
subplot(2,2,1);
subplot(2,2,2);
subplot(2,2,3);
subplot(2,2,4);
imshow(img7);
imshow(img6);
imshow(img5);
imshow(img4);
title('Bit-plane
title('Bit-plane
title('Bit-plane
title('Bit-plane
7');
6');
5');
4');
figure;
subplot(2,2,1);
subplot(2,2,2);
subplot(2,2,3);
subplot(2,2,4);
imshow(img3);
imshow(img2);
imshow(img1);
imshow(img0);
title('Bit-plane
title('Bit-plane
title('Bit-plane
title('Bit-plane
3');
2');
1');
0');
Bit-plane 7
Bit-plane 6
Bit-plane 5
Bit-plane 4
Bit-plane 3
Bit-plane 2
Bit-plane 1
Bit-plane 0
50
Bright Image
100
150
Gray Level, r
200
250
200
250
50
100
150
Gray Level, r
Low-contrast Image
High-contrast Image
50
100
150
Gray Level, r
200
250
50
100
150
Gray Level, r
200
250
bins1] = hist(double(img1(:)),0:255);
bins2] = hist(double(img2(:)),0:255);
bins3] = hist(double(img3(:)),0:255);
bins4] = hist(double(img4(:)),0:255);
hist1./length(img1(:)); hist2 = hist2./length(img2(:));
hist3./length(img3(:)); hist4 = hist4./length(img4(:));
img2eq = zeros(size(img2));
img4eq = zeros(size(img4));
CDF1(i+1);
CDF2(i+1);
CDF3(i+1);
CDF4(i+1);
0.1
0.08
0.06
0.04
0.02
0
100
200
Gray Level, r
0.1
0.08
0.06
0.04
0.02
0
Low-contrast Image
100
200
Gray Level, r
High-contrast Image
100
200
Gray Level, r
100
200
Gray Level, r
200
150
100
50
0
50
100
150
Gray Level, r
200
250
4
x 10Phobos Image Equalized Histogram
6
Number of Pixels
250
5
4
3
2
1
0
50
100
150
Gray Level, r
200
250
x 10
200
150
(1) - G(z)
100
(2) - G-1(z)
50
50
100
150
Gray Level, r
200
250
50
x 10
100
150
Input Gray Level, r
200
250
Number of Pixels
Number of Pixels
50
100
150
Gray Level, r
200
250
Multiplication Mask
These are two consecutive images from a video sequence with the camera fixed
while there is traffic moving across the scene. The two images were subtracted,
and the error image thresholded to create a mask image that contains
significant differences. The false-color of these differences are marked in
red. Notice in the original images the van moving across the scene, which has
been successfully detected.
%Matlab Code
clear all; close all;
imga = im2double(imread('scene1.jpg'));
imgb = im2double(imread('scene2.jpg'));
img1 = imga(10:size(imga,1)-9, 10:size(imgb,2)-9);
img2 = imgb(10:size(imga,1)-9, 10:size(imgb,2)-9);
idff = abs(img1 - img2); idx = find(idff>.2);
mask = zeros(size(idff)); mask(idx) = 1;
red = img1; green = img1; blue = img1;
red(idx) = 1; green(idx) = 0; blue(idx) = 0;
img3 = cat(3, cat(3,red,green), blue);
figure;
subplot(2,2,1); imshow(img1); title('Scene Image 1');
subplot(2,2,2); imshow(img2); title('Scene Image 2');
Scene Image 1
Scene Image 2
Difference Mask
=
=
=
=
=
=
[img1
[icor
[avg8
[avg16
[avg64
[avg128
min(img1(:))]
min(icor(:))]
min(avg8(:))]
min(avg16(:))]
min(avg64(:))]
min(avg128(:))]
./
./
./
./
./
./
max(img1(:)
max(icor(:)
max(avg8(:)
max(avg16(:)
max(avg64(:)
max(avg128(:)
min(img1(:)));
min(icor(:)));
min(avg8(:)));
min(avg16(:)));
min(avg64(:)));
min(avg128(:)));
figure;
subplot(3,2,1); imshow(img1); title('Original Galaxy Image');
subplot(3,2,2); imshow(icor); title('Corrupted Galaxy Image w/ Gaussian
Noise');
subplot(3,2,3); imshow(avg8); title('Galaxy Image After Averaging 8
Corrupted Images');
subplot(3,2,4); imshow(avg16); title('Galaxy Image After Averaging 16
Corrupted Images');
subplot(3,2,5); imshow(avg64); title('Galaxy Image After Averaging 64
Corrupted Images');
subplot(3,2,6); imshow(avg128); title('Galaxy Image After Averaging 128
Corrupted Images');
title('Moon Image');
title('Laplacian Filtered Moon Image');
title('Laplacian Image Scaled to Full
title('Laplacian-enhanced Original
Moon Image
title('SEM Image');
title('Laplacian Image');
title('Laplacian Enhanced Image');
title('High Boost Laplacian Enhanced
SEM Image
Laplacian Image
Sobel Image
=
=
=
=
=
=
=
=
=
im2double(imread('bonescan.jpg'));
conv2(img1, lap, 'same');
img1 + img2;
abs(conv2(img1, soba, 'same')) + abs(conv2(img1, sobb, 'same'));
conv2(img4, h, 'same');
img3.*img5;
img1 + img6;
img7.^.5;
[img2 - min(img2(:))] ./ max(img2(:) - min(img2(:)));
figure;
subplot(2,2,1);
subplot(2,2,2);
subplot(2,2,3);
subplot(2,2,4);
figure;
subplot(2,2,1);
subplot(2,2,2);
subplot(2,2,3);
subplot(2,2,4);
imshow(img1);
imshow(img2);
imshow(img3);
imshow(img4);
imshow(img5);
imshow(img6);
imshow(img7);
imshow(img8);
Laplacian Image
Sobel Image
Mask Image
Sharpened Image
Power-law Image