Implimentation of Dip

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 19

Basics of image processing

How to read and display an image


a =imread('cameraman.tif'); imshow(a);

a =imread('peppers.png'); imshow(a);

writing an image and title


A=imread(peppers.png); Imshow(A); Imwrite(A,image.tif );

A=imread(peppers.png);

Imshow(A);
Title(input image)

Reading multiple images and display

A=imread(peppers.png);

B=imread(cameraman.tif );
figure,imshow(A);

figure,imshow(B);

converting to RGB to gray scale

A=imread(peppers.png);

B=rgb2gray(A);
figure,Imshow(A);

figure,imshow(B);

converting to rgb to black and white image


A=imread(peppers.png); B=rgb2gray(A); C=im2bw(A); D=im2bw(B); figure,Imshow(C);

figure,imshow(D);

plane saparation for rgb image


A=imread(peppers.png); Figure,imshow(A); r=A(:,:,1); g=A(:,:,2); b=A(:,:,3); figure,imshow(r); figure,imshow(g); figure,imshow(b);

colour saparation to rgb image


A=imread(peppers.png); figure,imshow(A); r=A; g=A; b=A; r(:,:,2:3)=0; g(:,:,1:2:3)=0; b(:,:,1:2)=0; figure,imshow(r); figure,imshow(g); figure,imshow(b);

imtool
Navigate image using overview Inspect pixel values Display image information Crop image Measure distance

a =imread('football.jpg'); Imtool(a);

adding two images


a =imread('football.jpg'); b=imread('peppers.png'); c=imresize(a,[200 200]); d=imresize(b,[200 200]);

e=imadd(c,d);
figure,imshow(a); figure,imshow(b); figure,imshow(e);

Subtract two images


a=imread('football.jpg'); b=imread('peppers.png'); c=imresize(a,[200 200]); d=imresize(b,[200 200]); e=imsubtract (c,d); figure,imshow(a);

figure,imshow(b);
figure,imshow(e);

rotating of an image
A=imread(peppers.png); B=imrotate(A,180); % 90,180,270,360 ext.. figure,imshow(A); figure,imshow(B);

image adjustment
I = imread('pout.tif'); J = imadjust(I);

figure, imshow(I),
figure, imshow(J)

Adding noise to an image


A=imread('peppers.png'); B=imnoise(A,'salt & pepper',0.05); figure,imshow(A); figure,imshow(B);

Remove Noise to an image


A=imread(peppers.png);
B=imnoise(A,salt & pepper,0.05); figure,imshow(A); figure,imshow(B); c=rgb2gray(B); d=medfilt2(c); figure,imshow(d);

Dwt process
a = imread('peppers.png'); figure,imshow(a,[]); b = rgb2gray(a); figure,imshow(b,[]); %DWT [ll lh hl hh] = dwt2(b,'haar'); c = [ll lh;hl hh]; figure,imshow(c,[]); %IDWT x = idwt2(ll,lh,hl,hh,'haar'); figure,imshow(x,[]);

Subplot
a=imread('peppers.png'); subplot(2,1,1); imshow(a); b=rgb2gray(a); subplot(2,1,2);

imshow(b);

Dialog box

warndlg('hello');
helpdlg('hello'); errordlg('hello');

msgbox('hello');

You might also like