how to remove the tiny white pixels around the rectangles
7 views (last 30 days)
Kevin Holly on 29 Sep 2022
Img = imread('originalImage.png');
You can also filter based on area of objects
Img = bwareafilt(imbinarize(Img),4,'largest'); % keep the 4 largest objects
More Answers (2)
Image Analyst on 29 Sep 2022
Depends on exactly what that means.
- Do you want to simply remove small blobs?
- Or do you also want to remove a small protrusion that is sticking out of the side of a much larger rectangle.
For case 2 you might try imopen, though be careful for changes to the shape you don't want, especially near the corners or protruding blobs.