Here is the original picture
I have and I need to smooth edges and get something more like this.
I tried many methods but neither gives me a smooth shape like this.
Anyone else have any idea how to approach this kind of problem?
Thanks in advance.

2 commentaires

Image Analyst
Image Analyst le 17 Fév 2016
Huh? Your "this" looks way more craggy and jagged and tortuous than the "original picture". Did you reverse them?
Younes Nejahi
Younes Nejahi le 18 Fév 2016
Yes, sorry I didn't realize I messed it up. I've fixed the images.

Connectez-vous pour commenter.

 Réponse acceptée

Image Analyst
Image Analyst le 17 Fév 2016
Modifié(e) : Image Analyst le 17 Fév 2016

0 votes

Assuming you reverses your original and output images, I'd start with the one with craggy arms and do an morphological opening on it with imopen(). then, if it's still not smooth enough and you know what you want one smooth curve from top to bottom, I'd use find() to get the edge column and use conv() or sgolayfilt() to smooth the edge to a nice slowly varying curve. Or you could use polyfit() if you want a global curve rather than a locally varying one.

8 commentaires

Younes Nejahi
Younes Nejahi le 18 Fév 2016
Thanks, I will try it and let you know how it goes.
Younes Nejahi
Younes Nejahi le 18 Fév 2016
Thank you so much, it worked perfectly as I expected.
Francesco Pignatelli
Francesco Pignatelli le 4 Avr 2022
Hello,
I have a similar issue as yours. According to this comment I get the edges of my binary image using find() which returns a column of points but I do not know how to apply conv() or sgolayfilt(). I have tried sgolayfilt() and it seems working but I still I have a column of point while I would like to have a matrix to show with imshow() or imagesc() for visualization. It is not clear to me how to proper use the interpolating tools after catching the edges. Could you share with me your knowledges?
Image Analyst
Image Analyst le 4 Avr 2022
@Francesco Pignatelli see attached demo.
Attach your image if you need more help.
Francesco Pignatelli
Francesco Pignatelli le 25 Juil 2022
Thank you Image Analyst, it worked very well!
Francesco Pignatelli
Francesco Pignatelli le 26 Juil 2022
Hello Image Analyst, although your script worked, now I am facing another issue. Basically I want to connect the edges after detected them. How can I do that? I attach a picture and the quantity to display.
Image Analyst
Image Analyst le 26 Juil 2022
@Francesco Pignatelli the "other issue" should be discussed in a new discussion thread, not here in @Younes Nejahi's question. Attach your original image there (not here) and code for getting the edges. Chances are, you got the edges incorrectly (like using edge function instead of the bwboundary function).
Francesco Pignatelli
Francesco Pignatelli le 26 Juil 2022
@Image Analyst you are right. I made a new question:
https://se.mathworks.com/matlabcentral/answers/1767990-make-a-continuous-line-from-an-edge

Connectez-vous pour commenter.

Plus de réponses (1)

Brattv
Brattv le 17 Fév 2016

0 votes

Hi,
Did you try to convert to gray and use imgaussfilt?
G = imread('YourImage.png');
grayIm = rgb2gray(G);
test = imgaussfilt(grayIm,4);
imshow(test)
The last parameter in imgaussfilt is the standard deviation. The higher the more blurred.

1 commentaire

Younes Nejahi
Younes Nejahi le 18 Fév 2016
Thanks for your response, but I meant the other way. I reversed the pictures.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by