To remove unwanted parts in an image

3 views (last 30 days)
I ran a code to remove to unwanted parts in an image but it does not fully remove the unwanted parts i want.
How do i remove the rest unwanted parts?
the code i ran -
%Filling holes
image_holes = imfill(image_bw,'holes');
%Removing unwated parts
P = sum(image_holes(:));
image_wanted=bwareaopen(image_holes,P/2);
%Image filtering
image_filter = uint8(double(image_original).*repmat(image_wanted,[1 1 3]));
imshowpair(image_original,image_filter,'montage');
  3 Comments
Aye Thein Maung
Aye Thein Maung on 6 Jul 2022
By removing i meant filtering out all other parts except the main image itself

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 11 Jul 2022
I probably would have suggested regionfill
mask = grayImage == 255;
grayImage = regionfill(grayImage, mask);
but I like @Akira Agata's suggestion of inpaintCoherent better.

More Answers (0)

Categories

Find more on Images 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!