Fit a broken, wavy object outline in image processing

11 views (last 30 days)
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
KSSV
KSSV on 13 Aug 2020
How about getting the pixel locations of the racket...and using boundary ?
Luca
Luca on 13 Aug 2020
I can get the pixel locations of the racket with my segmentation based on colors, but it easily happens that I get also areas that don't belong to the racket (like the brown label on the top of the picture), or I skip some part of the racket due to light reflections or white spots on the picture. Would you suggest to change the segmentation? Thanks a lot

Sign in to comment.

Answers (1)

Matt J
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,
  1 Comment
Luca
Luca on 13 Aug 2020
Thank you very much Matt J, I will try the function that you suggested

Sign in to comment.

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!