MATLAB CODE - for Morphological Image Processing

clc;
close all;
clear all;


% Read the test Image
% Convert the image to binary image

myorigimg = imread('test.jpg');
myorigimg = im2bw(rgb2gray(myorigimg));
subplot(3, 3, 1);
imshow(myorigimg);title('Originalimage');


% Create Structuring Element
se = strel('disk', 9);

% Perform dilation operation using imdilate command
% Display the dilated image

mydilatedimg = imdilate(myorigimg, se);
subplot(3, 3, 2);
imshow(mydilatedimg);title('Dilated image');

% Perform Erosion operation using imerode command
% Display the Eroded image

myerodedimg = imerode(myorigimg, se);
subplot(3, 3, 3);
imshow(myerodedimg);title('Eroded image');


% Find Internal Boundary
% Internal Boundary = Dilated Image AND Not of Eroded Image
% Display Internal Boundary

internalboundimg = mydilatedimg & ~ myerodedimg;
subplot(3, 3, 4);
imshow(internalboundimg,[]);title('Internal Boundary');


% Find External Boundary
% External Boundary = Dilated Image AND Not of Eroded Image
% Display External Boundary

externalboundimg = mydilatedimg & ~myorigimg;
subplot(3, 3, 5);
imshow(externalboundimg,[]);title('External Boundary');

% Find Morphological Gradient
% Morphological Gradient = Dilated Image AND Not of Eroded Image
% Display External Boundary

mymorphgradimg = imsubtract(myorigimg,myerodedimg);
subplot(3, 3, 6);
imshow(mymorphgradimg,[]);title('Morphological Gradient');

% Perform Thinning operation using bwmorph() command
% Display the dilated image

thinf = bwmorph(myorigimg,'thin');
subplot(3,3,7);
imshow(thinf);title('Thinning of the Image');

% Perform Thickening operation using bwmorph()command
% Display the dilated image

thickf = bwmorph(myorigimg,'thicken');
subplot(3,3,8);
imshow(thickf);title('Thickening of the Image');


% Perform Skeletonozation operation using bwmorph()command
% with 8 iterations and display the dilated image

skelf100 = bwmorph(myorigimg,'skel',9);
subplot(3,3,9);
imshow(skelf100);title('Skeletonization - 9 iterations');
MATLAB CODE - for Morphological Image Processing MATLAB CODE - for Morphological Image Processing Reviewed by Suresh Bojja on 10/21/2015 09:51:00 PM Rating: 5

Subjects & Labs

AC (6) ADS (2) ATMEL (6) AWP (5) C- Language (3) CAO (5) CDAC (1) Cloud Computing (1) CMC (6) CN (10) CONSERVATION & MANAGEMENT Complete Notes (1) Control Sys (2) CVSM (2) Data Analytics (1) DC (5) Digital System Design (3) DIP (17) DLD (10) DLD Lab Manual (1) DS (4) DSD&DICA (9) DSP (6) EDC (45) Electonic Components (2) Embedded (7) EMWTL (6) ENERGY AUDIT (1) Engg. Mechanics (2) Engg.Chemistry (11) Faculty Files (6) Faculty Labs (1) Fuzzy (3) II MID (1) Job Exam Papers (4) LICA (1) Linux OS (1) Materials (1) MATLAB (27) MCU IDE 8051 (1) MEMS (4) MPMC (57) MPMC LAB Manual (3) MTECH (6) MWE (2) OC (1) PDC (9) Projects (8) RADAR (1) Research (9) RVSP (3) SC (1) Softwares (1) SS (1) STLD (18) TCSS (1) TSSN (1) TV Engg (1) VHDL (4) VLSI (8) VLSI Lab manual (1) WCN (1) Wireless Commu. (1) WSN (2)

Contact Form :

Name

Email *

Message *

Theme images by enjoynz. Powered by Blogger.