Presentation is loading. Please wait.

Presentation is loading. Please wait.

MATLAB(Matrix Laboratory). Introduction Developed by MathWorks Numerical Computing Environment Fourth-generation Programming Language.

Similar presentations


Presentation on theme: "MATLAB(Matrix Laboratory). Introduction Developed by MathWorks Numerical Computing Environment Fourth-generation Programming Language."— Presentation transcript:

1 MATLAB(Matrix Laboratory)

2 Introduction Developed by MathWorks Numerical Computing Environment Fourth-generation Programming Language

3 Applications Matrix manipulation Data visualization Function visualization User Interfaces Algorithm development Mathematical modeling

4 Window Layout

5 WINDOWS IN MATLAB Command Window M-file editor Workspace Command history Current directory

6 Command window To give input To Display result To execute intermediate command

7 M-file editor Write Script files Write functions Displaying other format files  C –files  Java files  HDL files

8 Workspace For watching all the variables To plot intermediate variables Debugging

9 Image Processing in Matlab Image Processing toolbox Nearly 500 built in functions are available Advanced sinks are available for image analysis and enhancement Very user friendly when compared to the other numerical image processing softwares

10 Reading and Display RGB Image clc; clear all; close all; i=imread('peppers.png'); imshow(i);axis on;grid on imtool(i) whos i

11 Output

12 Converting colour image to gray clc; clear all; close all; i=imread('peppers.png'); i_gray=rgb2gray(i); imshow(i_gray);axis on;grid on imtool(i_gray) whos i_gray

13 Output

14 Formula for RGB to gray intensity = 0.2989*red + 0.5870*green + 0.1140*blue

15 Converting Gray image to Binary clc; clear all; close all; i=imread('peppers.png'); i_gray=rgb2gray(i); i_binary=im2bw(i_gray); imshow(i_binary);axis on;grid on imtool(i_binary)

16 Output

17 For loop in MATLAB for var=0:100 your command; end here 0  Starting value 100  End value

18 Accessing pixels using for loop clc; clear all; close all; i=imread('peppers.png'); i_gray=rgb2gray(i); rows=size(i_gray,1); cloumns=size(i_gray,2); for m=1:rows for n=1:cloumns if (i(m,n)>128) i_binary(m,n)=1; else i_binary(m,n)=0; end imshow(i_binary);getframe; end

19 Histogram clc; clear all; close all; i=imread('peppers.png'); i_gray=rgb2gray(i); h=imhist(i_gray); plot(h);grid on;xlabel ('Intensity');ylabel('Number of Pixels')

20 Output

21 Histogram(RGB) clc; clear all; close all; i=imread('peppers.png'); r_h=imhist(i(:,:,1)); r_g=imhist(i(:,:,2)); r_b=imhist(i(:,:,3)); plot(r_h,'r');grid on;hold on; plot(r_g,'g'); plot(r_b,'b'); xlabel ('Intensity');ylabel ('Number of Pixels') legend('R','G','B')

22 Output

23 Histogram equalization clc; clear all; close all; i=imread('peppers.png'); i_gray=rgb2gray(i); h_eq_image=histeq(i_gray); figure;imhist(i_gray);grid on;title('Before Histogram Equalization') figure;imshow(i_gray);grid on;title('Before Histogram Equalization') figure;imhist(h_eq_image);grid on;title('After Histogram Equalization') figure;imshow(h_eq_image);grid on;title('After Histogram Equalization')

24 output

25 Fourier Transform clc; clear all; close all; i=rgb2gray(imread('peppers.png')); fft_out=fft2(i); shifted_fft=log(abs(fftshift(fft_out))); imshow(shifted_fft,[])

26 output

27 Wavelet Transform clc; clear all; close all; i=rgb2gray(imread('peppers.png')); [hh,hl,lh,ll]=dwt2(i,'db1'); wavelet_out=[hh,hl;lh,ll]; imshow(wavelet_out,[])

28 Output

29 PSNR Formula Here R=255(for 8 bit image)

30 Matlab Implementation function psnr = calculate_psnr(I1,I2) R=255; mse=sum(sum((I1-I2)^(2))); psnr=abs(10*log10(R^2/mse)); end

31 Image Filtering(average) clc; clear all; close all; i=rgb2gray(imread('peppers.png')); h = fspecial('average'); f_out=imfilter(i,h); figure,imshow(i);title('Original Image') figure,imshow(f_out);title('Filtered Image') calculate_psnr(i,f_out)

32 Image de-noising by filtering clc; clear all; close all; i=rgb2gray(imread('peppers.png')); i_noise=imnoise(i,'salt & pepper',0.001); f_out = medfilt2(i_noise); figure,imshow(i_noise);title('Original Image') figure,imshow(f_out);title('Filtered Image') calculate_psnr(i,f_out)

33 output

34 Gaussian Low pass filter clc; clear all; close all; i=rgb2gray(imread('peppers.png')); h = fspecial('gaussian',[3,3],0.9); i_noise=imnoise(i,'gaussian'); f_out = imfilter(i_noise,h); figure,imshow(i_noise);title('Original Image') figure,imshow(f_out);title('Filtered Image') figure,freqz2(h)

35 Convolution Operation clc; clear all; close all; h=[0 0.25 0 0.25 0 0.25 0 0.25 0]; i=im2double(rgb2gray(imread('peppers.png'))); conv_out=conv2(i,h); figure,imshow(i);title('Original Image') figure,imshow(conv_out);title('Convolution Output')


Download ppt "MATLAB(Matrix Laboratory). Introduction Developed by MathWorks Numerical Computing Environment Fourth-generation Programming Language."

Similar presentations


Ads by Google