SpotFlow: Tracking Method Calls and States at Runtime
DIGITAL IMAGE PROCESSING TECHNIQUES
1. DIGITAL IMAGE PROCESSING
1
Dr.S.SHAJUN NISHA, MCA.,M.Phil.,M.Tech.,MBA.,Ph.D
Assistant Professor & Head
PG and Research Dept. of Computer Science
Sadakathullah Appa College
shajunnisha78@gmail.com
+91 99420 96220
7. Reading and displaying an Image
Syntax
A = imread(filename)
imshow(A)
Example
rgb=imread(‘peppers.png’)
imshow(rgb)
7
8. Displaying output with caption
Syntax
A = imread(filename)
imshow(A)
title(‘caption of the output image')
Example
rgb=imread(‘cameraman.tif’)
imshow(rgb)
title(‘cameraman')
8
9. Displaying pair of images
Syntax
imshowpair(I,J,'montage’)
Example
I = imread('cameraman.tif’);
J = imread(‘peppers.png’)
imshowpair(I,J,'montage')
9
10. Displaying multiple images using subplot
Syntax
subplot(x,y,z)
Example
I = imread('cameraman.tif');
figure,subplot(3,3,1),imshow(I),title('Cameraman');
J = imread('peppers.png');
subplot(3,3,2),imshow(J),title('Peppers');
k = imread('eight.tif');
subplot(3,3,3),imshow(k),title('eight');
L = imread('rice.png');
subplot(3,3,4),imshow(L),title('rice');
M = imread('onion.png');
subplot(3,3,5),imshow(M),title('onion');
N = imread('pears.png');
subplot(3,3,6),imshow(N),title('pears');
10
11. Reading and saving a file
Syntax
f=imread(filename)
imshow(f)
imwrite(f,’filename’)
Example
rgb=imread(‘peppers.png’)
imshow(rgb)
imwrite(rgb,’newrgbfile.jpg’)
11
18. Absolute difference of image
Syntax
K = imabsdiff(I,J);
Example
I = imread('cameraman.tif');
J=imread('rice.png');
K = imabsdiff(I,J);
imshow(K)
18
19. Mathematical operations
I = imread('rice.png’);
J = imread('cameraman.tif’);
K = imadd(I,J,'uint16’);
figure,subplot(3,3,1),imshow(K),title(‘Addition’);
L = imsubtract(I,J);
subplot(3,3,2),imshow(L),title('Subtraction’);
M = immultiply(J,0.5);
subplot(3,3,3),imshow(M),title('Multiplication');
O = imdivide(J,2);
subplot(3,3,4),imshow(O),title('Division');
P= imcomplement(J);
subplot(3,3,5),imshow(P),title('Complement');
Q = imabsdiff(I,J);
subplot(3,3,6),imshow(Q),title('Absolute difference');
19
21. Adjusting intensity of an image
Syntax
I=imadjust(filename)
Example
I = imread('cameraman.tif');
J=imadjust(I,[0.5 0.75],[0,1]);
imshowpair(I,J,'montage');
21
22. Histogram equalization of an image
Syntax
J=histeq(I)
Example
I = imread('cameraman.tif’);
J=histeq(I,50)
imshowpair(I,J,'montage');
22
28. Pre defined 2D filter
Syntax
h = fspecial(type)
Example
I= imread('cameraman.tif’);
imshow(I);
H = fspecial('disk',10);
blurred = imfilter(I,H,'replicate’);
imshow(blurred);
28
29. 2-D order-statistic filtering
Syntax
B = ordfilt2(A,order,domain)
Example
A = imread('snowflakes.png’);
figure imshow(A)
B = ordfilt2(A,25,true(5));
figure imshow(B)
29
30. 2-D median filtering
Syntax
J = medfilt2(I)
Example
I = imread('eight.tif’);
figure, imshow(I)
J = imnoise(I,'salt & pepper',0.02);
K = medfilt2(J);
imshowpair(J,K,'montage')
30
59. Global image threshold using Otsu's method
Syntax
T = graythresh(I)
Example
I = imread('coins.png');
level = graythresh(I)
BW = imbinarize(I,level);
imshowpair(I,BW,'montage')
59