You are on page 1of 12

LIST OF EXPERIMENTS

1. To create the following images:-


a] a rectangular image of red colour

b] an image with vertical stripes of blue colour.

c] an image with horizontal stripes of green colour.

2. To load the image and scale that image by doubling its width and height.

3. To obtain grayscale of an image.

4. To obtain the histogram of an image.

5. To perform following grayscale transformations:-


a] Negative of an image.

b] Contrast of an image.

6. To perform thresholding of an image.

7. To perform image smoothing using average and median filter.

8. To perform edge detection using Prewitt and Sobel operator.

9. To perform basic image processing operations using MATLAB.

10. To perform morphological operations using MATLAB.

Page | 1
BASIC IMAGE PROCESSING OPERATIONS USING MATLAB

AIM: To perform basic image processing operations using MATLAB.

IMPLEMENTATION:
1) LOADING IMAGE:

>>p=imread('me99.jpg');
>> figure, imshow(p);
>> title('Original image');

2) GRAYSCALE OF AN IMAGE:

Page | 2
>>I = imread('me99.jpg');
>> J = rgb2gray(I);
>> figure, imshow(I), figure, imshow(J);

3) NEGATIVE OF AN IMAGE:

>>X=imread('let3.jpg');
>> BW10 = imcomplement(X);
>> figure, imshow(BW10);

4) ROTATING:

>>BW9 = imrotate(I,35,'bilinear');
Page | 3
>> figure, imshow(BW9);

5) HISTOGRAM & HISTOGRAM EQUALIZATION:


>>I = imread('med.gif');
>> figure,imhist(I);
>> figure, histeq(I,100);
>> figure, imshow(I);

Page | 4
6) FILTERING:

>> I= imread('med.gif');
>> figure, imshow(I);
>> J = imnoise(I,'salt & pepper',0.02);
>> figure, imshow(J);
>> K = filter2(fspecial('average',3),J)/255;
>> figure, imshow(K);
>> L = medfilt2(J,[3 3]);
>> figure, imshow(L);

Page | 5
7) CONVOLUTION:

>>s = [1 2 1; 0 0 0; -1 -2 -1]
s=
1 2 1
0 0 0
-1 -2 -1

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

1 2 3
4 5 6
7 8 9
>> H = conv2(f,s)

H=
1 4 8 8 3
4 13 20 17 6
6 18 24 18 6
-4 -13 -20 -17 -6
-7 -22 -32 -26 -9

>> mesh(H)

Page | 6
CONCLUSION:
Basic image processing operations are implemented using MATLAB.

EXPERIMENT NO. 10 DATE:

Page | 7
BASIC MORPHOLOGICAL OPERATIONS USING MATLAB

AIM: To perform basic morphological operations using MATLAB.

IMPLEMENTATION:

>> SE = strel('ball',10,5);

ORIGINAL IMAGE

>> BW1= imread('morph1.jpg');

>> figure, imshow(BW1);

DILATED IMAGE

>> BW2 = imdilate(BW1,SE);


Page | 8
>> figure, imshow(BW2);

ERODED IMAGE

>> BW3 = imerode(BW1,SE);

>> figure, imshow(BW3);

OPENING

>> BW1= imread('morph1.jpg');


Page | 9
>> figure, imshow(BW1);
>> BW4=imerode(BW1,SE);
>> BW5 = imdilate(BW4,SE);
>> figure, imshow(BW5);

BW1= imread('morph1.jpg');

>> figure, imshow(BW1);

>> BW7=imopen(BW1,SE);

Page | 10
>> figure, imshow(BW7);

CLOSING

>> BW1= imread('morph1.jpg');


>> figure, imshow(BW1);
>> BW2 = imdilate(BW1,SE);
>> BW6=imerode(BW2,SE);
>> figure, imshow(BW6);

Page | 11
BW1= imread('morph1.jpg');
>> figure, imshow(BW1);
>> BW8=imclose(BW1,SE);
>> figure, imshow(BW8);

CONCLUSION:

Basic morphological operations are implemented using MATLAB.

Page | 12

You might also like