Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

particle analysis ordering

Hi, I would like to know which parameters "particle analysis" uses to "number" the particles in an image? I am trying to locate 8 points in my image by doing some pre-processing (thresholding-filtering-eroding) then I use particle analysis to obtain the particles that are left. From there I need to measure 6 distances using the caliper function. These distances are dependent on the number LabVIEW gives my particles, however this number is not always fixed, thus the caliper function is not giving me the desired result. I have attached an image with my eight particles, the top 4 are the ones that vary, from left to right they are sometimes numbered (1,2,3,4) and most other times (2,1,3,4). Is there any way for me to control this numbering? The bottom ones are always labeled (5,6,7,8).

 

Thank you in advance for you help.


 

 

0 Kudos
Message 1 of 6
(4,361 Views)

The particle detection locates particles by scanning the image from left to right, starting at the top row and going to the bottom row.  The particles are numbered in the order they are encountered.  This order can be fairly random if the particles are lined up in a row.

 

I usually look at the X and Y coordinates of particles to determine which are which.  If you know you are going to have two rows of four, take the first four found and sort them by X coordinate, then do the same with the last four.

 

Another way is to rotate the camera slightly so the leftmost particle is always encountered first.  This forces all the particles to be encountered in the order you expect.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 2 of 6
(4,356 Views)
Sorry, my previous image showed only a black image, attached is the new image with the explanation added.
0 Kudos
Message 3 of 6
(4,355 Views)

Rotating the camera is not an option for me in this case, but going from what you told me I thought of rotating the image before calling particle analysis then rotating the image in the opposite direction after particle analysis is done and before calling the caliper function and it works like a charm, however it kills my performance since rotating each image takes a long time, can I sort by x and y coordinates (the solution you proposed) programatically?

 

Thank you.

0 Kudos
Message 4 of 6
(4,351 Views)
I should have tested the complete idea, rotating the image before does the trick, however rotating back the image does not work, since the coordinates are set at the first rotation of the image. Back to trying to sort by x coordinates. 😞
0 Kudos
Message 5 of 6
(4,343 Views)

Method 1:  Bundle all the information you need into a cluster for each spot, with the X coordinate as the first item in the cluster.  Sort the cluster array using 1D sort.  Extract the information you need from the cluster array.

 

Method 2:  Bundle the X coordinate and the original index into a cluster.  Sort the cluster array.  Extract the sorted index and use it to get the info you need in the order you want.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 6 of 6
(4,314 Views)