MATLAB Answers


How to remove small connected parts in the image without smoothing the others?

Asked by wei zhang on 13 Jun 2019
Latest activity Commented on by wei zhang on 14 Jun 2019
I would like to remove the "triangle protuberance" in the belowing image, but I don't want to change the other part of the image. As the "triangle protuberance" is connected to the main "ellispe" like part, I could not use "bwareopen" function to remove it. I have tried the " watershed", but don't have a good output. Besides, I also have tried "imclose" and "imopen" combination, it smoothed the other part unintendly. I need some suggestion in how to deal with this problem. Any advise in processing procedure, matlab function or algorithm will be appreciated. Thank you.
The original image has been attached.


Attach yopur original image...
I have done as your command. Thank you for advice.

Sign in to comment.




1 Answer

Answer by KSSV
on 13 Jun 2019

  1. Read the image
  2. Get the locations of black pixels
  3. Fit the ellipse for the data
  4. Plot the ellipse on the image
  5. Use inpolygon and remove the unwanted points.
Check in fileexchange for fitellipse functions. Read about inpolygon.


Sign in to comment.