segmentation using the color thresholder in YCbCr color space

8 visualizaciones (últimos 30 días)
Hello everyone,
I am working on the fire detection using the combined tecniques of color and motion detection. what I want to do is first apply the color thresholding step and use the output from the first step as the input for the motion detection. Can anyone help me on how to remove the background without changing it into the binary image.
my main aim is turning the non-fire colored region into black without changing foreground so that I can reduce errors during the motion detection phase as the following image:

Respuesta aceptada

DGM
DGM el 28 de Mzo. de 2021
Editada: DGM el 28 de Mzo. de 2021
If I get your question correctly, you already have a means of generating a mask; you're asking how to apply the mask.
Consider this example:
% i have a mxnx3 rgb image that i want to reduce
inpict=imread('sources/colorballs.jpg');
% i have a mxnx1 mask generated by some means
mask=multimask(inpict,{'ge','le'},[0.85 0.33 0.05; 1 1 0.63]*255,'and');
% despite the mismatched number of channels,
% i can use the mask to remove content from the image like so:
outpict=im2double(inpict);
outpict=bsxfun(@times,outpict,mask);
If you're running R2016b or newer, you don't even need to do that. Implicit expansion will take care of it:
outpict2=im2double(inpict);
outpict2=outpict2.*mask;
  2 comentarios
Micky Elias
Micky Elias el 28 de Mzo. de 2021
Thank you very much sir. This is the explanation I was looking for. yes although I didn't get enough information about the funcition "multimask", now i am able to do the masking.
DGM
DGM el 28 de Mzo. de 2021
Editada: DGM el 28 de Mzo. de 2021
Multimask is an old simple tool from the MIMT.
There are definitely better tools to use. I just used it as an example because I had it and already had an existing demo. You can generate your mask however you choose.

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 28 de Mzo. de 2021
Here is a way to apply a mask to an image. Works for gray scale or color, and multiple class types.
% Mask the image using bsxfun() function to multiply the mask by each channel individually. Works for gray scale as well as RGB Color images.
maskedRgbImage = bsxfun(@times, rgbImage, cast(mask, 'like', rgbImage));

Categorías

Más información sobre Image Processing Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by