Connected Components on Input Image

Hi all
I want to visualize my compnents on original input image. I have performed foregorund detection by some background subtraction algorithm. Let say I have foregorund mask fgmask and input frame I.I have performed the connected component analysis like that
I=input Image;
FgMask=binary Image;
labelImage=bwlabel(FgMask,8);
blobMeasurements = regionprops(labeledImage, I, 'all');
numberOfBlobs = size(blobMeasurements, 1);
Now what I want to do, actually I do not need bounding box on foreground region, I want to label foregorund region into original input Image (foregorund region should be labeled from red colours) instead of bounding box.HOw can I perform that??
Every help is appreciated.

 Respuesta aceptada

Image Analyst
Image Analyst el 21 de Feb. de 2014
You can tint your image red in the foreground regions
redChannel = grayImage; % Initialize.
redChannel(binaryImage) = 255; % Max out red in foreground pixels.
% Create an RGB image.
tintedImage = cat(3, redChannel, grayImage, grayImage);
imshow(tintedImage);

4 comentarios

Algorithms Analyst
Algorithms Analyst el 21 de Feb. de 2014
Thank you very much Dear Image Analyst.
How can I make a bounding box in the resultant red region in input Image after that I mean
tintedImage=cat(3,redChannel,grayImage,grayImage);
Thanks
Image Analyst
Image Analyst el 21 de Feb. de 2014
You can use the plot() function to plot lines between the 4 corners. Or use the rectangle() function.
Algorithms Analyst
Algorithms Analyst el 21 de Feb. de 2014
How can I get the coodinates of the bounding box rectangle from tintedImage?
Originally you said you didn't need it. Anyway, you can just use regionprops
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'BoundingBox');
allBoundingBoxes = [measurements.BoundingBox];

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 21 de Feb. de 2014

Comentada:

el 21 de Feb. de 2014

Community Treasure Hunt

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

Start Hunting!

Translated by