filmov
tv
Simple Algorithm to detect End-Points of a Skeleton of an Image | Digital Image Processing | MATLAB

Показать описание
Code:
%Reading the Image & get the skeleton of the image
clc
clear all
close all
warning off
x=imbinarize(rgb2gray(imread('Capture.JPG')));
k=(bwmorph(x,'skel',Inf));
imshow(k);
title('Input Image');
%Apply the algo
[a b]=size(k);
output=zeros(a,b);
for i=2:a-1
for j=2:b-1
ws=[k(i-1,j-1),k(i-1,j),k(i-1,j+1),k(i,j-1),k(i,j)...
,k(i,j+1),k(i+1,j-1),k(i+1,j),k(i+1,j+1)];
kg=sum(ws);
if(k(i,j)==1 && kg==2)
output(i,j)=1;
end
end
end
figure;
output=imdilate(output,strel('disk',5));
imshow(output+k);
Learn Image Processing using MATLAB:
#DigitalImageProcessing #MATLAB #ComputerVision
%Reading the Image & get the skeleton of the image
clc
clear all
close all
warning off
x=imbinarize(rgb2gray(imread('Capture.JPG')));
k=(bwmorph(x,'skel',Inf));
imshow(k);
title('Input Image');
%Apply the algo
[a b]=size(k);
output=zeros(a,b);
for i=2:a-1
for j=2:b-1
ws=[k(i-1,j-1),k(i-1,j),k(i-1,j+1),k(i,j-1),k(i,j)...
,k(i,j+1),k(i+1,j-1),k(i+1,j),k(i+1,j+1)];
kg=sum(ws);
if(k(i,j)==1 && kg==2)
output(i,j)=1;
end
end
end
figure;
output=imdilate(output,strel('disk',5));
imshow(output+k);
Learn Image Processing using MATLAB:
#DigitalImageProcessing #MATLAB #ComputerVision