Borrar filtros
Borrar filtros

How to remove unwanted tiny objects (blobs) in colored segmented image?

3 visualizaciones (últimos 30 días)
Nusrat Jahan
Nusrat Jahan el 13 de En. de 2021
Respondida: BC el 28 de Feb. de 2021
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
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 Get Started with Image Processing Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by