Matlab Basic Operations

someOperations

Contents

a = imread('aa.jpg');
b = imread('bb.jpg');

a1  = rgb2gray(a);
b1  = rgb2gray(b);

a2 = im2bw(a1);
b2 = im2bw(b1);

a3 = imcomplement(a2);
b3 = imcomplement(b2);

images for operation

figure; imshow(a2); title('image T blackand white image');
figure; imshow(b2); title('image T blackand white image');

% figure; imshow(b3); title('Image As complement');

monusImage = a2 - b2;
% figure; imshow(monusImage); title('A Minus B');

addImage = a2+b2;
% figure; imshow(addImage); title('A + B');

orImge = a2 | b2;
% figure; imshow(orImge); title('A | B');

andImge = a2 & b2;
% figure; imshow(andImge); title('A & B');
Warning: Image is too big to fit on screen; displaying at 67%
Warning: Image is too big to fit on screen; displaying at 67%

Testing with irosion and dialation

seDisk    = strel('disk', 10);
seDiamond = strel('diamond', 10);
% seOctagon = strel('octagon', 10);

erodeImageDisk = imerode(a2, seDisk);
figure; imshow(erodeImageDisk); title('Erode Image with Disk');

erodeImageDiamond = imerode(a2, seDiamond);
figure; imshow(erodeImageDiamond); title('Erode Image with Diamad');

dilalateImage1 = imdilate(a2, seDisk);
figure; imshow(dilalateImage1); title('Dialate Image with disk');

dilalateImage2 = imdilate(a2, seDiamond);
figure; imshow(dilalateImage2); title('Dialate Image with Diamend');
Share on Google Plus

About Mahinda Jayasundara

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment

0 comments :

Post a Comment