Borrar filtros
Borrar filtros

how to show background in original color after segmented ??

1 visualización (últimos 30 días)
nina merina
nina merina el 3 de Dic. de 2014
Respondida: Sammit Jain el 28 de Nov. de 2017
how to show background in original color after be segmented ??

Respuestas (3)

Meshooo
Meshooo el 3 de Dic. de 2014

Image Analyst
Image Analyst el 3 de Dic. de 2014
I have several color segmentation methods in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 They segment the image into "foreground" (the objects of the color you want), and "background" (the colors you don't want). You can use the invert the foreground mask to give an image of just the background:
backgroundMask = ~foregroundMask;
% Mask the image using bsxfun() function
backgroundOnlyImage = bsxfun(@times, rgbImage, cast(backgroundMask, class(rgbImage)));

Sammit Jain
Sammit Jain el 28 de Nov. de 2017
If you have the background portion of the image, then just binarize it, and take logical product with the original image.
outImg = origImg.*(backImg>0.5);
Here make sure that your dimensions are in order.

Community Treasure Hunt

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

Start Hunting!

Translated by