Hello, I am trying to extract Building Footprints From Satellite Imagery,I have applied Morphological functions. But i am not able to separate buildings from roads and trees Present in urban areas

8 views (last 30 days)
I=imread('rq_subset.tif'); %Read in image
im1=rgb2gray(I); % conversion frm RGB to Gray Image
figure,imshow(I);
level = graythresh(im1); % calculates threshold values using ostu's method
bw=im2bw(im1,level); %Convert image to binary image, based on threshold
figure,imshow(bw);
se = strel('square',2); %structure element Morphological unit
bw1 = imerode(bw,se); % morphological opening
figure, imshow(bw1);% display of image with structure element
bw3 = imdilate(bw1,se);
imshow(bw3);
b6=bwmorph(bw3,'remove'); % removes elements from inside the body
figure,imshow(b6);
B1=strel('rectangle',[4,2]);
B2=strel ('rectangle',[2,1]);
%se1=strel('square',4);
bw4=bwhitmiss(bw3,B1,B2);
figure,imshow(bw4);
se=strel('square',1);
bw5=imerode(bw4,se);
figure,imshow(bw5);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!