How do I find the pixel size of connected components in an image and then compare pixel size of each connected component with the pixel size of connected components of the next frame and choose the approximately similar size connected components?

1 visualización (últimos 30 días)
So,I am reading a video and then saving its frames and in each frame I am finding the connected components and then labelling them.Now lets say I have the image below.In this the pixel size of green cloud on left will be compared with pixel size of both green and red cloud in the second image.If the pixel size of red cloud in second image matches with the pixel size of green cloud in first image then they should save as a pair.Similar procedure needs to be followed for the red cloud in first frame.I have saved these frames but I don't know how to find the pixel size of these green and red clouds separately and then compare them with the next frame's clouds.How can I do that?

Respuesta aceptada

Image Analyst
Image Analyst el 22 de Oct. de 2016
It looks like you've already segmented the image into regions and then have labeled the image with bwconncomp() or bwlabel() already, and then are displaying with a color map or perhaps created an RGB image with
% Let's assign each blob a different color to visually show the user the distinct blobs.
coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle'); % pseudo random color labels
So, just put your labeled image into regionprops(), and get the areas
props = regionprops(labeledImage, 'Area');
allAreas = [props.Area];
Now that is just the areas. You don't know what area it corresponds to because as the blobs move around, what was blob #1 in one frame might suddenly become blob #2 or #9 or some other ID number. This is because of how the blobs are found. So you're going to have to do tracking if your blobs move around. You can do this if you also find the centroids and if the blob doesn't move very much from one frame to the next so you can just assign the blob numbers to the closest blob from the prior frame.
  13 comentarios
Image Analyst
Image Analyst el 25 de Oct. de 2016
Attach your lab array in a .mat file and I'll see what I can do later today with it to figure it out.
Prachi Sharma
Prachi Sharma el 25 de Oct. de 2016
Editada: Prachi Sharma el 25 de Oct. de 2016
Below attached is my whole code,you can run it for any cloud video.Also I have attached lab and CC matrix.I need to find the centroid and area of blobs in every frame and save them for further comparison in future code.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Computer Vision 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