Filter löschen
Filter löschen

change the output representation

1 Ansicht (letzte 30 Tage)
Elysi Cochin
Elysi Cochin am 21 Mär. 2013
In this code for convex hull.... the output image has a white border around the image.... as i have shown in the link....
what should i do to the code so that i dont want the border.... i want the output as
The code i used is...
function convexhull
a=imread('impcon.bmp');
a=a(:,:,3);
o=a;
subplot(2,2,1)
imshow(o)
title('original image');
[r,c]=size(a);
c=[1 0 0;1 0 0;1 0 0 ]
c1=[1 1 1;0 0 0;0 0 0 ];
c2=[0 0 1; 0 0 1;0 0 1];
c3=[0 0 0;0 0 0;1 1 1];
b=a;
for u=1:10
d=(imerode(b,c))|a;
if(b==d)
break;
end
b=d;
end
%-------------
m=a;
for u=1:10
n=(imerode(m,c1))|a;
if(m==n)
break;
end
m=n;
end
%-------------
p=a;
for u=1:10
l=(imerode(p,c2))|a;
if(p==l)
break;
end
p=l;
end
%-------------
z=a;
for u=1:10
v=(imerode(z,c3))|a;
if(z==v)
break;
end
z=v;
end
%-------------
H=z|p|m|b;
subplot(2,2,2)
imshow(H)
title('convex Hull of image');
Please show me where to change the code.... so that i get the output as shown in the second link.....please do reply....

Akzeptierte Antwort

Image Analyst
Image Analyst am 21 Mär. 2013
Why aren't you using bwconvhull()? If you don't have a new enough version, then you can use imclearborder() to get rid of foreground touching the border.
  2 Kommentare
Elysi Cochin
Elysi Cochin am 21 Mär. 2013
thank u sir.... i used imclearborder()
Image Analyst
Image Analyst am 21 Mär. 2013
You're welcome, though it's not the preferred solution - bwconvhull() is.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by