How to smooth the rough edge on 2D image?

I tried erode followed by a dilate.
The effect is not good as I want it to be.
I want the edge without any curve. It better can remove the curve and use straight line to represent those curve
I remember that there are some filter for smoothing the edge,right?

2 commentaires

Michael Haderlein
Michael Haderlein le 22 Août 2014
Did you check imfilter and fspecial?
tabw
tabw le 25 Août 2014
No. thanks for your advice

Connectez-vous pour commenter.

Réponses (1)

Image Analyst
Image Analyst le 22 Août 2014

0 votes

You can try activecontour(). You can set parameters to control how smooth the boundary is. See attached demo.

4 commentaires

tabw
tabw le 25 Août 2014
Thank you! I would try it
tabw
tabw le 25 Août 2014
Modifié(e) : tabw le 26 Août 2014
I guess it is the same function inside the link below? http://www.mathworks.com/help/images/ref/activecontour.html
But I tried
activecontour(I,mask,300);
it said too many input arguments.
You said I can set some parameters,right?
isn't it like how to set the parameters inside the link?
Image Analyst
Image Analyst le 25 Août 2014
It's the same function. You forgot to give the error message. Please copy and paste ALL THE RED TEXT. Don't snip or paraphrase like you did. Did my demo run? That should run with no errors whatsoever.
I guess Yes. If I directly run your run, it popped up a interface-liked stuff. it showed the sample image and its histogram. and came up
??? Undefined function or method 'bwconvhull' for input arguments of type
'char'.
Error in ==> Untitled at 59
mask = bwconvhull(mask, 'Union');
So, i tried to follow the example inside the link. But it said too many input arguments

Connectez-vous pour commenter.

Question posée :

le 22 Août 2014

Modifié(e) :

le 26 Août 2014

Community Treasure Hunt

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

Start Hunting!

Translated by