Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

count objects from left to right

hi...

im using the VI count objects2...

when i get the results... the objects are labeled sequentially from top to bottom...

but u want the objects to be labeled from left to right .. can anyone show me how to do that?? is there any settings i can change?

my work..

after thresholding .. i have two objects in the image side by side. sometimes the objects are labeled 0 and 1 and sometimes 1 and 0 depends on which one has a y position ?? is there any way i can make it label from left to right??

thanks
0 Kudos
Message 1 of 4
(3,315 Views)

I would just post process the results.  Since the first element in the Objects output is the X coordinate of the center, you could just run the Objects output array through Sort 1D Array.  This will always put the leftmost object first.

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 4
(3,308 Views)
hi bruce,

it worked..

i never knew it could sort only the x value..

thanks .

0 Kudos
Message 3 of 4
(3,298 Views)

When you sort an array of clusters, it sorts by the first element in the cluster.  If there are identical elements, it sorts the second elements, etc.

You just got lucky that the X coordinate was the first element.

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 4
(3,295 Views)