Presentation is loading. Please wait.

Presentation is loading. Please wait.

Prof. Muhammad Saeed With. Contents Fundamentals Spatial Domain Processing Frequency Domain Processing Color Image Processing Image Restoration Image.

Similar presentations


Presentation on theme: "Prof. Muhammad Saeed With. Contents Fundamentals Spatial Domain Processing Frequency Domain Processing Color Image Processing Image Restoration Image."— Presentation transcript:

1 Prof. Muhammad Saeed With

2 Contents Fundamentals Spatial Domain Processing Frequency Domain Processing Color Image Processing Image Restoration Image Compression Morphological Image Processing Image Segmentation Representation and Description Object Recognition MS Image Processing2

3 Fundamentals Read: kid=imread('kid02.jpg'); Display: figure; imshow(kid); imshow(kid, [low high]); Image Info: info=imfinfo('kid02.jpg'); or whos kid; Filename: [1x64 char] FileModDate: '24-Oct :51:40' FileSize: Format: 'jpg' FormatVersion: ' Width: 344 Height: 401 BitDepth: 24 ColorType: 'truecolor' FormatSignature: '' NumberOfSamples: 3 CodingMethod: 'Huffman' CodingProcess: 'Sequential' Comment: {} ImageDescription: 'OLYMPUS DIGITAL CAMERA Make: 'OLYMPUS OPTICAL CO.,LTD' Model: 'C4040Z' Orientation: 1 Software: 'v552u-A80' DateTime: '2001:01:02 06:01:42' YCbCrPositioning: 'Co-sited' DigitalCamera: [1x1 struct] UnknownTags: [3x1 struct] Filename: [1x64 char] FileModDate: '24-Oct :51:40' FileSize: Format: 'jpg' FormatVersion: ' Width: 344 Height: 401 BitDepth: 24 ColorType: 'truecolor' FormatSignature: '' NumberOfSamples: 3 CodingMethod: 'Huffman' CodingProcess: 'Sequential' Comment: {} ImageDescription: 'OLYMPUS DIGITAL CAMERA Make: 'OLYMPUS OPTICAL CO.,LTD' Model: 'C4040Z' Orientation: 1 Software: 'v552u-A80' DateTime: '2001:01:02 06:01:42' YCbCrPositioning: 'Co-sited' DigitalCamera: [1x1 struct] UnknownTags: [3x1 struct] [r c]=size(kid) ; Introduction to Image: Image as matrix Image Type Image Class Image Size Image Resolution MS Image Processing 3

4 Write on Disk: imwrite(kid,'kid02gray.png'); imwrite(kid,'kid02gray.jpg,quality,75); % (0:100) imwrite(kid,'kid02gray.tif,compression,none,resolution,[m n]); % (packbits, ccitt), (dpi) Conversion of Class and Type: B=logical(A); C=im2bw(T); D=mat2gray(P,[Pmin Pmax]); F=Im2double(g); G=im2uint8(H); Image Arithmatic: C=imadd(A,B); C=imsubtract(A,B); C=immultiply(A,B); C=imdivide(A,B); C=imabsdiff(A,B);C=imcomplement(A); C=imlincomb(A,B); MS Image Processing4

5 Image Flipping and Sizing: C=F(end:-1:1,:); C=F(:, end:-1:1); C=F(1:2:end,1:2:end); Color Image to Gray: C=rgb2gray(F); Image Cropping: C=F(50:end-20, 50:end-40); Pixel Information Direct: impixelinfo; imdistline; MS Image Processing5

6 Spatial Domain Processing Intensity Transformation: S=imadjust(A,[inL inH],[outL outH],gamma); S=imadjust(A,[0 1],[1 0]); %image complement S=imadjust(A,[],[],2); Logarithmic and Contrast Stretching Transform i) ii) Histograms H=imhist(A,nbins); H=imhist(A,nbins)/numel(A); % normalized histogram H=histeq(A,nbins); % histogram equalization MS Image Processing6

7 Linear Spatial Filtering: C=imfilter(A, w, mode, boundary opts, size opts); % w is the filter % modes= corr, conv % boundary options=p, replicate, symmetric, circular % size options=full, same w=fspecial(type, parameters); type parameters default average[r, c]3x3 disk R (radius, square of 2R+1)5 gaussian [r, c],sig(STD)3x3, 0.5 laplacian(3x3) alpha(0-1)0.5 log(laplacian[r, c],sig(STD)5x5, 0.5 of a gaussian) motion len(pixel), theta(degrees)CCW9, 0 prewitt(3x3, verticle gradient, transpose for horizontal) sobel(3x3, verticle gradient, transpose for horizontal) unsharp(3x3)alpha(0-1)0.2 7MS Image Processing

8 Sobel: I, and II, Mathematical Form of Filters: Prewitt: I, and II, Gaussian Filter: Laplacian Filter: Unsharp Filter: 8MS Image Processing

9 Linear Spatial Filters in action: kid=imread('kid02.jpg'); w=[1 1 1;1 -8 1;1 1 1]; C=imfilter(kid, w,'corr', 'replicate', 'same'); subplot(1,2,1);imshow(kid);title('Original','FontSize',20); subplot(1,2,2);imshow(4*C);title(mat2str(w),'FontSize',20); chboard=(checkerboard(90)>0.1); w=[0 1 0;1 -4 1;0 1 0]; C=imfilter(chboard, w,'conv','replicate', 'full'); subplot(1,2,1);imshow(chboard);title('Original','FontSize',20); subplot(1,2,2);imshow(4*C);title(mat2str(w),'FontSize',20); 3. kid=imread('kid02.jpg'); w=fspecial('average',[10 10]); C=imfilter(kid, w,'conv','replicate','same'); subplot(1,2,1);imshow(kid);title('Original','FontSize',20); subplot(1,2,2);imshow(C);title('Average','FontSize',20); average 9MS Image Processing

10 4. kid=imread('kid02.jpg'); w=fspecial('disk', 6); C=imfilter(kid, w); subplot(1,2,1);imshow(kid);title('Original','FontSize',20); subplot(1,2,2);imshow(C);title('Disk','FontSize',20); disk 5. kid=imread('kid02.jpg'); w=fspecial('gaussian',10, 0.8); C=imfilter(kid, w); subplot(1,2,1);imshow(kid);title('Original','FontSize',20); subplot(1,2,2);imshow(C);title('Gaussian','FontSize',20); gaussian 6. kid=imread('kid02.jpg'); w=fspecial('laplacian', 0.6); C=imfilter(kid, w,'conv','replicate','same'); subplot(1,2,1);imshow(kid);title('Original','FontSize',20); subplot(1,2,2);imshow(6*C);title('Laplacian','FontSize',20); laplacian 10MS Image Processing

11 7. kid=imread('kid02.jpg'); w=fspecial('log',5,0.2); C=imfilter(kid, w,'conv','replicate','same'); subplot(1,2,1);imshow(kid);title('Original','FontSize',20); subplot(1,2,2);imshow(4*C);title('Log','FontSize',20); log 8. kid=imread('kid02.jpg'); w=fspecial('motion',20,10); C=imfilter(kid, w); subplot(1,2,1);imshow(kid);title('Original','FontSize',20); subplot(1,2,2);imshow(C);title('Motion','FontSize',20); motion 9. kid=imread('kid02.jpg'); w=fspecial('prewitt'); C=imfilter(kid, w); subplot(1,2,1);imshow(kid);title('Original','FontSize',20); subplot(1,2,2);imshow(C);title('Prewitt','FontSize',20); prewitt 11MS Image Processing

12 10. kid = imread('kid02.jpg'); w = fspecial('sobel'); C=imfilter(kid, w); subplot(1,2,1);imshow(kid);title('Original','FontSize',20); subplot(1,2,2);imshow(C);title('Sobel','FontSize',20); sobel 11. kid = imread('kid02.jpg'); w = fspecial('unsharp',0.5); C=imfilter(kid, w); subplot(1,2,1);imshow(kid),title('Original','FontSize',20); subplot(1,2,2);imshow(C),title('Unsharp','FontSize',20); unsharp 12. kid=imread('kid02Gray.jpg'); C=filter2('sobel',kid); subplot(1,2,1);imshow(kid);title('Original','FontSize',20); subplot(1,2,2);imshow(C,[]);title('Filtered Red','FontSize',20); filter2 12MS Image Processing

13 13. kid=imread('kid02darkgray.jpg'); subplot(2,2,1); imshow(kid);title('Original','FontSize',20); subplot(2,2,2); imhist(kid,64);title('Histogram I','FontSize',20); subplot(2,2,3); heq=histeq(kid,64); imshow(heq,[]); title(Equalized','FontSize',20); subplot(2,2,4); imhist(heq,64); title('Eq. Histogram','FontSize',20); histeq 13MS Image Processing

14 Nonlinear Spatial Filters: kid=imread('kid02darkgray.jpg'); kidfilt=ordfilt2(kid,25,true(7)); subplot(1,2,1);imshow(kid); title('Original','FontSize',20); subplot(1,2,2);imshow(kidfilt); title(Filtered','FontSize',20); 1)ordfilt2 (f, order, domain) kid=imread('kid02Gray.jpg'); kidnoise=imnoise(kid,'salt & pepper',0.2); kid2=medfilt2(kidnoise,[5 5],'symmetric'); %symmetric, zeros, indexed %kid2=medfilt2(kid2,'symmetric'); subplot(1,2,1);imshow(kidnoise);title('Original','FontSize',20); subplot(1,2,2);imshow(kid2);title('Filtered','FontSize',20); 2)medfilt2 (f, symmetric) 14MS Image Processing

15 END 15MS Image Processing


Download ppt "Prof. Muhammad Saeed With. Contents Fundamentals Spatial Domain Processing Frequency Domain Processing Color Image Processing Image Restoration Image."

Similar presentations


Ads by Google