How to remove unwanted tiny objects (blobs) in colored segmented image?
Mostrar comentarios más antiguos
I have a color image obtained after applying segmentation operation, but there are some tiny unwanted bolbs which needed to remove. Most of the codes that I seen are only applied for grayscale images, not for colored image. It will be highly appreciated if anybody provide me the code for removing unwanted tiny objects (blobs) for colored segmented image please.
Respuestas (1)
BC
el 28 de Feb. de 2021
You can convert the image to grayscale, and then once you've made adjustments to it, you can overlay the mask on top of the original colour image.
image = imread("sample.jpg"); % read image
grayImage = rgb2gray(image); % convert to grayscale
imageOpen = bwareaopen(grayImage,6000); % remove blobs smaller than 6000 pixels. Adjust the number to change this.
imageOverlay = imoverlay(image,~imageOpen,"k"); % overlay the original image with the mask, fill with black (k).
imshowpair(image,imageOverlay,"montage") % display image side by side to compare
Categorías
Más información sobre Image Arithmetic en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!