Professional Documents
Culture Documents
2. To load the image and scale that image by doubling its width and height.
b] Contrast of an image.
Page | 1
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);
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.
Page | 7
BASIC MORPHOLOGICAL OPERATIONS USING MATLAB
IMPLEMENTATION:
>> SE = strel('ball',10,5);
ORIGINAL IMAGE
DILATED IMAGE
ERODED IMAGE
OPENING
BW1= imread('morph1.jpg');
>> BW7=imopen(BW1,SE);
Page | 10
>> figure, imshow(BW7);
CLOSING
Page | 11
BW1= imread('morph1.jpg');
>> figure, imshow(BW1);
>> BW8=imclose(BW1,SE);
>> figure, imshow(BW8);
CONCLUSION:
Page | 12