필터 지우기
필터 지우기

How to smooth the edges

조회 수: 68 (최근 30일)
Younes Nejahi
Younes Nejahi 2016년 2월 17일
댓글: Francesco Pignatelli 2022년 7월 26일
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
Image Analyst
Image Analyst 2016년 2월 17일
Huh? Your "this" looks way more craggy and jagged and tortuous than the "original picture". Did you reverse them?
Younes Nejahi
Younes Nejahi 2016년 2월 18일
Yes, sorry I didn't realize I messed it up. I've fixed the images.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2016년 2월 17일
편집: Image Analyst 2016년 2월 17일
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
Image Analyst
Image Analyst 2022년 7월 26일
@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 2022년 7월 26일
@Image Analyst you are right. I made a new question:
https://se.mathworks.com/matlabcentral/answers/1767990-make-a-continuous-line-from-an-edge

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Brattv
Brattv 2016년 2월 17일
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
Younes Nejahi
Younes Nejahi 2016년 2월 18일
Thanks for your response, but I meant the other way. I reversed the pictures.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by