Fit a broken, wavy object outline in image processing
11 views (last 30 days)
Show older comments
Hello everyone, I would like to get the outline of a tennis racket from a top view photograph. The attached picture shows my result so far. The problem is that the outline is broken and is a bit too wavy (for example near the thorat of the racket), so I would like to fit and smooth it, if possible.
I am currently segmenting the image basing on color (the background is supposed to be white), but due to some properties (shadows, light reflections, racket label, etc) the outline is not continuous and there are some isolated dots that do not belong to the racket. I tried to remove the dots/noise with bwareaopen and some of them disappear, but this can increase the probelm that the outline is broken.
However, it looks to me that I am almost there, as I just have to fit the outline in order to connect the broken edges, and smooth the outline. Yet, I haven't been able to figure out a way to solve this problem, so it seems very simple but very difficult at the same time.
Is there a way to fit the red outline following the silhouette of the racket, so that it is continuous and smoother? Or should I act on the segmentation process and avoid these problems in the post-processing?
Thanks a lot for your help,
Luca

2 Comments
Answers (1)
Matt J
on 13 Aug 2020
Edited: Matt J
on 13 Aug 2020
A smoothing spline may work well,
If you convert the points to polar coordinates r, theta, relative to some origin in the interior of the racket, you could use the smoothing spline to fit the polar curve r(theta). You might also try sgolayfilt to do the same,
See Also
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!