Vous êtes sur la page 1sur 72

%%%%%%%% -------------DAY 1---------%%%%%%%%

%%%%%%Some basic programs on images%%%%%%

>> zeros(3) ans = 0 0 0 0 0 0 0 0 0

>> ones(3) ans = 1 1 1 1 1 1 1 1 1

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

>> eye(3) ans = 1 0 0 0 1 0 0 0 1

>> ones(3)*2 ans = 2 2 2 2 2 2 2 2 2

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

>> a = [1 2 3] a= 1 2 3

>> b = [1,2,3] b= 1 2 3

>> c = [1;2;3] c= 1 2 3

>> d = [1 2;3 4]

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

d= 1 3 2 4

>> e = [1 2 3;4 5 6;7 8 9] e= 1 4 7 2 5 8 3 6 9

>> magic(3) ans = 8 3 1 5 6 7

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

>> pascal(3) ans = 1 1 1 1 2 3 1 3 6

>> rand(3,4) ans = 0.9501 0.2311 0.6068 0.4860 0.8913 0.7621 0.4565 0.0185 0.8214 0.4447 0.6154 0.7919

>> randint(3) ans = 1 0 0

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

1 0

1 1

1 0

>> randn(3,4)%%Displays +ve and -ve values ans = -0.4326 0.2877 1.1892 0.1746

-1.6656 -1.1465 -0.0376 -0.1867 0.1253 1.1909 0.3273 0.7258

>> A = [1 2 3;4 5 6; 7 8 9] A= 1 4 7 2 5 8 3 6 9

>> B = size(A) B=

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

>> C = length(A) C= 3

>> A = [11 12 13;14 15 16;17 18 19] A= 11 14 17 12 15 18 13 16 19

>> B = sum(A) B= 42 45 48

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

>> C = sum(B) C= 135

>> D = diag(A) D= 11 15 19

>> E = diag(A, -1) E= 14

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

18

>> F = det(A) F= 0 >> G = norm(A) G= 45.6601 >> H = inv(A) Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.387779e-017. H= 1.0e+014 * 1.8765 -3.7530 -3.7530 1.8765

7.5060 -3.7530 1.8765

1.8765 -3.7530

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

>> J = A' J= 11 12 13 14 15 16 17 18 19

>> K = A/2 K= 5.5000 7.0000 8.5000 6.0000 7.5000 9.0000 6.5000 8.0000 9.5000

>> L = mod(A,4) L= 3 2 1 0 3 2 1 0 3

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

%%%%%%%%%Matrix Indexing%%%%%%%%%

>> A = [1 2 3;4 5 6; 7 8 9] A= 1 4 7 2 5 8 3 6 9

>> A(3, 2) ans = 8 >> A(end,end-2) ans = 7

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

>> A(1,:) ans = 1 2 3

>> A(2,:) ans = 4 5 6

>> A(:,1) ans = 1 4 7 >> A(:,3) ans =

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

3 6 9

>> A(:,:,:) ans = 1 4 7 2 5 8 3 6 9

>> A(:,2,:) ans = 2 5 8 >> A(1,:,:)

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

ans = 1 2 3

>> A(1,2,:) ans = 2 >> A(0+[1 2],1+[1 2]) ans = 2 5 3 6

%%%%%%%-------- Arithmetic Operators---------%%%%%%%%%% MATLAB provides these arithmetic operators.

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Day 2

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

%%%%%%%% -------------DAY 2---------%%%%%%%%

%%%%%%%%%------Image Processing------%%%%%%%%%%%

% How to read an image A=imread (filename);

% To display the image imshow (A); imview(A); X=imread(Path); imshow(X);

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

X=imread(Path); imshow(X);

% Add a constant to an image. I = imread('rice.png'); J = imadd(I,50); subplot(1,2,1), imshow(I) subplot(1,2,2), imshow(J)

OUTPUT:

% Subtract a constant value from an image:


Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

I = imread('rice.png'); Iq = imsubtract(I,50); imview(I),imview(Iq) OUTPUT:

% Scale an image by a constant factor: I = imread('moon.tif'); J = immultiply(I,0.5); subplot(1,2,1), imshow(I) subplot(1,2,2), imshow(J) OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% Divide by a constant of the rice image. I = imread('rice.png'); J = imdivide(I,2); subplot(1,2,1), imshow(I) subplot(1,2,2), imshow(J)

OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% Adjust a low-contrast grayscale image. I = imread('pout.tif'); J = imadjust(I); imview(I), imview(J) OUTPUT:

% A low-contrast image with its histogram.

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

I = imread('pout.tif'); imshow(I) figure, imhist(I,64) OUTPUT:

500 0

400 0

300 0

200 0

100 0

0 0 50 100 1 50 20 0 250

%Entropy
%Entropy is used to characterize the texture of the input image. I = imread('circuit.tif'); J = entropy(I) OUTPUT: J= 6.9439

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

%A high-contrast image with its histogram. I = imread('cameraman.tif'); figure; imshow(I); imhist(I,64); OUTPUT:
4000 3500 3000 2500 2000 1500 1000 500 0 0 50 100 150 200 250

%Add two images together and specifies an output class. I = imread('rice.png'); J = imread('cameraman.tif'); K = imadd(I,J,'uint16'); imshow(K,[])

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% To display the r, g, b components of an color image a=imread('football.jpg'); subplot(2,2,1),imshow(a);title('rgb image'); b=a(:,:,1); subplot(2,2,2),imshow(b);title('r component image'); c=a(:,:,2); subplot (2,2,3),imshow(c);title('g component image'); d=a(:,:,3); subplot(2,2,4),imshow(d);title('b component image');

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

rgb image

r component image

g component image

b component image

2) a=imread('peppers.png'); subplot(2,2,1),imshow(a);title('rgb image');

b=rgb2gray(a); subplot(2,2,2),imshow(b);title('gray scale image ');

c=rgb2ind(a,234);%tolerance value between (0 to 255)

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

subplot(2,2,3),imshow(c);title('indexed image');

d=im2bw(a); subplot(2,2,4),imshow(d);title('binary image');

e=rgb2ntsc(a);figure, subplot(2,2,1),imshow(e);title('national television systems commitee image');

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

rgb image

gray scale image

indexed image

binary image

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% To convert an indexed image to the gray scale image [a,map]=imread('trees.tif'); imshow(a,map); f=ind2gray(a,map);figure, subplot(2,2,2),imshow(f);title('gray scale image');
o r ig in a l im a g e g ra y s c a le im a g e

a=imread('peppers.png'); subplot(2,2,1),imshow(a);title('rgb image');

b=rgb2ycbcr(a);

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

subplot(2,2,2),imshow(b);title('ycbcr image ');

c= ycbcr2rgb(b); subplot(2,2,3),imshow(c);title('rgb image');


rgb image ycbcr image

indexed image

% To rotate an image 35 counterclockwise and use bilinear interpolation. I = imread('circuit.tif'); J = imrotate(I,35,'bilinear');


Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

imshow(I) figure, imshow(J)

OUTPUT:

% Crop an image clc; close all; clear all; I = imread('circuit.tif'); I2 = imcrop(I,[75 68 130 112]);

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

imview(I), imview(I2)

OUTPUT:

% To increases the size of the image I = imread('circuit.tif'); J = imresize(I,1.25); imshow(I) figure, imshow(J) OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

IMAGE TRANSFORMS Image transforms

Fourier transform

a=imread('peppers.png'); subplot(2,2,1),imshow(a);title('original image'); b=fft(a); subplot(2,2,2),imshow(b);title('transformed image'); c=ifft(b); subplot(2,2,3),imshow(c,[]);title('restored image');

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

original image

transformed image

restored image

% Create geometric transformation structure I = imread('cameraman.tif'); tform = maketform('affine',[1 0 0; .5 1 0; 0 0 1]); J = imtransform(I,tform); imshow(I), figure, imshow(J)
OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

DAY 3

%%%%%%%% -------------DAY 3---------%%%%%%%% Image enhancement

Image enhancement

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% Add gaussian noise to an image I = imread('eight.tif'); J = imnoise(I, 'gaussian'); imshow(I); figure, imshow(J); OUTPUT:

% Add salt & pepper noise to an image I = imread('eight.tif'); J = imnoise(I,'salt & pepper',0.02); imshow(I) figure, imshow(J) OUTPUT:
Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% Filter the noisy image with an averaging filter and display the results. I = imread('eight.tif'); imshow(I) J = imnoise(I,'salt & pepper',0.02); figure, imshow(J) K = filter2(fspecial('average',3),J)/255; figure, imshow(K)

OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% Median filters to filter the noisy image and display the results. I = imread('eight.tif'); imshow(I) J = imnoise(I,'salt & pepper',0.02); figure, imshow(J)
Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

L = medfilt2(J,[3 3]); figure, imshow(L) OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% Filtering of images, either by correlation or convolution I = imread('coins.png'); h = ones(5,5) / 25; I2 = imfilter(I,h); imshow(I), title('Original Image'); figure, imshow(I2), title('Filtered Image')

OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Original Image

Filtered Image

% Blurred image. I = imread('cameraman.tif'); subplot(2,2,1); imshow(I); title('Original Image');

H = fspecial('motion',20,45); MotinBlur = imfilter(I,H,'replicate'); subplot(2,2,2); imshow(MotionBlur); title('Motion Blurred Image');


Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

H = fspecial('disk',10); blurred = imfilter(I,H,'replicate'); subplot(2,2,3); imshow(blurred); title('Blurred Image');

H = fspecial('Unsharp'); sharpeneded = imfilter(I,H,'replicate'); subplot(2,2,4); imshow(sharpened); title('Sharpened Image'); OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Original Image

Motion Blurred Image

Blurred Image

Sharpened Image

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

DAY 4 Image restoration

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

%To blur an image using a function psf. I = imread('peppers.png'); I = I(10+[1:256],222+[1:256],:); figure;imshow(I);title('Original Image'); LEN = 31; THETA = 11; PSF = fspecial('motion',LEN,THETA); Blurred = imfilter(I,PSF,'circular','conv'); figure; imshow(Blurred);title('Blurred Image');

OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Original Image

Blurred Im age

%Deblurring with the Wiener Filter: I = imread('peppers.png'); I = I(10+[1:256],222+[1:256],:); figure;imshow(I);title('Original Image'); LEN = 31; THETA = 11; PSF = fspecial('motion',LEN,THETA); Blurred = imfilter(I,PSF,'circular','conv'); figure; imshow(Blurred);title('Blurred Image');

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

wnr1 = deconvwnr(Blurred,PSF); figure;imshow(wnr1); title('Restored, True PSF');

OUTPUT:
Original Image

Blurred Image

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Restored, True PSF

% Deblurring with a Regularized Filter I = imread('tissue.png'); I = I(125+[1:256],1:256,:); figure; imshow(I); title('Original Image'); PSF = fspecial('gaussian',11,5); Blurred = imfilter(I,PSF,'conv'); V = .02; BlurredNoisy = imnoise(Blurred,'gaussian',0,V); figure;imshow(BlurredNoisy);title('Blurred and Noisy Image'); NP = V*prod(size(I));

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

[reg1 LAGRA] = deconvreg(BlurredNoisy,PSF,NP); figure,imshow(reg1),title('Restored Image');


Original Image

Blurred and Noisy Image

Restored Image

Restoration algorithms % deblurring with the lucy richardson filter I = imread('football.jpg'); subplot(2,2,1),imshow(I);title('Original Image'); PSF = fspecial('gaussian',5,5); % Create a simulated blur in the image and add noise. Blurred = imfilter(I,PSF,'circular','conv'); V = .02; BlurredNoisy = imnoise(Blurred,'gaussian',0,V); subplot(2,2,2),imshow(BlurredNoisy);title('Blurred and Noisy ');

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

luc1 = deconvlucy(BlurredNoisy,PSF,5); subplot(2,2,3); imshow(luc1); title('Restored Image');


Original Image Blurred and Noisy

Restored Image

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

DAY 5 COMPRESSIO N
%%%%%%%%%%%%%%%%day 5 %%%%%%%%%% Compression

a = im2double(imread('cameraman.tif')); imshow(a);title('original image');


Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

v = dctmtx(size(a,1)); dct = v*a*v'; figure, imshow(dct);title('dct image');


o rig in a l im a g e
dct image

I = imread('coins.png'); imshow(I);title('original image'); I = im2double(I); T = dctmtx(8); B = blkproc(I,[8 8],'P1*x*P2',T,T'); mask = [1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0


Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; B2 = blkproc(B,[8 8],'P1.*x',mask); I2 = blkproc(B2,[8 8],'P1*x*P2',T',T); imshow(I), figure, imshow(I2);title('dct compressed image'); OUTPUT:

dct compressed image

% Un sharp contrast enhancement filter I = imread('cameraman.tif'); subplot(2,2,1); imshow(I); title('Original Image'); H = fspecial('unsharp');
Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

sharpened = imfilter(I,H,'replicate'); subplot(2,2,4); imshow(sharpened); title('Sharpened Image'); OUTPUT:

Wavelets

a=imread('cameraman.tif'); subplot(3,2,1),imshow(a);title('original image'); [ca,ch,cv,cd]=dwt2(a,'haar');

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

subplot(3,2,2),imshow(mat2gray(ca));title('approximation coefficents image'); subplot(3,2,3),imshow(ch);title('horizontal coefficients image'); subplot(3,2,4),imshow(cv);title('vertical coefficients image'); subplot(3,2,5),imshow(cd);title('diagnol coefficients image'); c=idwt2(ca,ch,cv,cd,'haar'); subplot(3,2,6),imshow(mat2gray(c));title('reconstructed image');
original image approximation coefficents image

horizontal coefficients image

vertical coefficients image

diagnol coefficients image

reconstructed image

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

DAY 6

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

%%%%%%%%%%day 6 %%%%%%%%%%

segmentation
% Edge-detection method that edge provides is the Sobel and Canny method I = imread('coins.png'); imshow(I) BW1 = edge(I,'sobel'); BW2 = edge(I,'canny'); imshow(BW1); figure, imshow(BW2); OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% edge-detection method that edge provides is the prewitt and Canny method z= imread('cameraman.tif'); BW1 = edge(z,'prewitt'); BW2 = edge(z,'canny'); imshow(BW1);title('prewitt image'); figure, imshow(BW2);title('canny image'); OUTPUT:
prewitt image

canny image

Segmentation
Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% applying the watershed transform a=imread('football.jpg'); imshow(a);title('original image'); b=watershed(a); figure,imshow(b);title('transformed image');

original image

transformed image

%bwmorph means Morphological operations on binary images % Morphological operations are create connectivity array, % reconstruction morphologically etc.

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

%remove-removes interior pixels. BW = imread('circles.png'); imshow(BW); BW2 = bwmorph(BW,'remove'); figure, imshow(BW2);


OUTPUT:

%SKELETONIZATION
%To reduce all objects in an image to lines, without changing the essential structure of the image is known as skeletonization.

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

BW1 = imread('circbw.tif'); BW2 = bwmorph(BW1,'skel',Inf); imshow(BW1); figure, imshow(BW2)


OUTPUT:

%Matrix to grayscale image convertion %filter2- 2-D digital filter %fspecial- Create predefined 2-D filter %mat2gray- Convert matrix to grayscale image I = imread('rice.png'); J = filter2(fspecial('sobel'),I); K = mat2gray(J); imshow(I), figure, imshow(K)
Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

OUTPUT:

%Reverse black and white in a binary image. %imcomplement- Complement image bw = imread('text.png'); bw2 = imcomplement(bw); subplot(1,2,1),imshow(bw) subplot(1,2,2),imshow(bw2)
OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

% To plot the border on the image. I=imread(cameraman.tif); imshow(I) BW = im2bw(I); imshow(BW) dim = size(BW) col = round(dim(2)/2)-90; row = min(find(BW(:,col))) boundary = bwtraceboundary(BW,[row, col],'N'); imshow(I) hold on; plot(boundary(:,2),boundary(:,1),'g','LineWidth',10);
Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

OUTPUT:

%To rotate an image 35 counterclockwise and use bilinear interpolation. I = imread('circuit.tif'); J = imrotate(I,35,'bilinear'); imshow(I) figure, imshow(J)
OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

%creating a mask to an image. I = imread('cameraman.tif'); BW = imread('text.png'); mask = BW(1:256,1:256); f = inline('imadjust(x,[],[],0.3)'); I2 = roifilt2(I,mask,f); imshow (I2)

OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

%Edgetapering
original = imread('cameraman.tif'); PSF = fspecial('gaussian',60,10); edgesTapered = edgetaper(original,PSF); figure, imshow(original,[]); figure, imshow(edgesTapered,[]);

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

OUTPUT:

Flat No,#G-5,103,305,502,Rathna Coimplex,Beside Image Hospital,Ameerpet,Hyderabad Ph: 9885112363

Vous aimerez peut-être aussi