LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find 'set of pixels' inside each blob of a AVI.

Solved!
Go to solution

Hello All!

I want to find the set of pixels inside each blob(in my case: they are circles) in an AVI file/ a image. I am aware that by using IMAQ Particle Analysis VI, I can get the number of particles detected and also a 2D Array of requested measurements of the particles. From there, I can easily exrtract the 'First Pixel X and Y' , 'Centre of Mass X and Y' ,'Area' and also the 'Perimeter' of the particles. But,I also want all the pixel coordinates inside each blob .

Can someone give me a hint or help me out how to extract all the coordinates of the blob? 

0 Kudos
Message 1 of 12
(4,253 Views)

Might not be the most high-performance solution, but when you have your binarized image, you could go through your image pixel by pixel and check if it's 1 or 0 and output the coordinate accordingly. You can remove all but 1 blob to get the coordinates for just 1 blob.

 

Also, to increase the performance of this function you could cut out the part of the image with the blob, and use the bounding rect +5 px or so to determine what needs to be cut.

 

Maybe there's a function that I don't know, though.



Remember Cunningham's Law
0 Kudos
Message 2 of 12
(4,215 Views)

Look at the example and the code it calls I have attached here. I think this does what you are asking?

0 Kudos
Message 3 of 12
(4,208 Views)

wrote:

Look at the example and the code it calls I have attached here. I think this does what you are asking?


Thank you. But, I am not able to open your VI since I am having an older version of LabVIEW 2014. It would be great if you can convert our VI into an older Version (preferable 14 or older) and sent me?

0 Kudos
Message 4 of 12
(4,189 Views)

 


wrote:

Might not be the most high-performance solution, but when you have your binarized image, you could go through your image pixel by pixel and check if it's 1 or 0 and output the coordinate accordingly. You can remove all but 1 blob to get the coordinates for just 1 blob.

 

Also, to increase the performance of this function you could cut out the part of the image with the blob, and use the bounding rect +5 px or so to determine what needs to be cut.

 

Maybe there's a function that I don't know, though.


Thanks for the information. I will look into it.

0 Kudos
Message 5 of 12
(4,188 Views)
Solution
Accepted by topic author enthusiast4

This should be compiled in 2014 I think.

Message 6 of 12
(4,151 Views)
Solution
Accepted by topic author enthusiast4

So, I finally got my LabVIEW back up and running and did a little example. It should give you all the Pixels, but you will need to check if the x- and y- coordinates are ok. 

 



Remember Cunningham's Law
Download All
Message 7 of 12
(4,138 Views)

wrote:

So, I finally got my LabVIEW back up and running and did a little example. It should give you all the Pixels, but you will need to check if the x- and y- coordinates are ok. 

 


Yes, the x and y coordinates are fine.  I would be grateful if you could explain what exactly the two inner for-loops are trying to accomplish. I meant if you could explain how the coordinates of a particle are read i.e how the coordinates are displayed in the 'coordinates array indicator'. Also, how the values of the input clusters in the 'unbundle by name' are added/considered.  Thanks again.

0 Kudos
Message 8 of 12
(4,122 Views)

Sure!

 

The basic idea is exactly what I described before: Enter all pixel coordinates into the array, that are 1 in the binarized image. Now, since you have 2 M pixels and probably around 30 images per second, performance optimization is a good idea and the best way to achieve it is by limiting the evaluated area in the image.

 

So, after you filtered twice by bounding rect coordinates you have an image with only one particle in it (not in 100% of cases, as there could be a smaller particle at the upper left corner of the larger rect, so you should probably filter by bounding rect right and bottom also). After filtering you cut out the image, get the pixels and pass them to the two for loops. In the two for loops, the index represents the coordinates of the pixels within that cutout. So 0,0 is the bottom left pixel in the cut out, but if the cutout itself isn't in the bottom left corner of the image you need to add the coordinate of the cutout to the local coordinates.

I didn't quite get the last part of your question. I don't use unbundle in my code.

In case you mean the values for range lower/upper: I have to filter by something to get rid of all the other particles before evaluating the image parts. Again, this isn't necessary if performance isn't an issue. Then you could just iterate through the entire image and the algorithm gets a lot simpler, since you don't need any filtering, image copies and basic math...



Remember Cunningham's Law
0 Kudos
Message 9 of 12
(4,118 Views)

wrote:

Sure!

 

The basic idea is exactly what I described before: Enter all pixel coordinates into the array, that are 1 in the binarized image. Now, since you have 2 M pixels and probably around 30 images per second, performance optimization is a good idea and the best way to achieve it is by limiting the evaluated area in the image.

 

So, after you filtered twice by bounding rect coordinates you have an image with only one particle in it (not in 100% of cases, as there could be a smaller particle at the upper left corner of the larger rect, so you should probably filter by bounding rect right and bottom also). After filtering you cut out the image, get the pixels and pass them to the two for loops. In the two for loops, the index represents the coordinates of the pixels within that cutout. So 0,0 is the bottom left pixel in the cut out, but if the cutout itself isn't in the bottom left corner of the image you need to add the coordinate of the cutout to the local coordinates.

I didn't quite get the last part of your question. I don't use unbundle in my code.

In case you mean the values for range lower/upper: I have to filter by something to get rid of all the other particles before evaluating the image parts. Again, this isn't necessary if performance isn't an issue. Then you could just iterate through the entire image and the algorithm gets a lot simpler, since you don't need any filtering, image copies and basic math...


Thanks for explaining it. Sorry, I meant the constant values of the input Clusters in  'Bundle by name'.

I still have confusion in what the other coordinates of the pixels within the cutout means (in the attached images). What exactly does it convey when N2=50 and N3=56? 

PS: Please check the attached image of the front panel.

Download All
0 Kudos
Message 10 of 12
(4,112 Views)