Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How binary objects are sorted

Solved!
Go to solution

Image Processing VIs 'IMAQ Particle Analysis.vi' and 'IMAQ MaskToROI.vi' returns the features of detected binary objects in a sorted order. My question is how objects are sorted before results are returned. 

 

Look at the following example. I am totally confused why both VIs returned the second object in the first row first? 

 

I was trying to get the centers of each object (and their contours), and assuming they were sorted by their positions on Y axis first and then positions on X. It was, most of the time, until what you see here on the first row. What happened here? Why the second object was sorted as the first object? HOW binary objects are sorted any way?

 

How Sorted.png

0 Kudos
Message 1 of 3
(4,576 Views)
Solution
Accepted by topic author MengHuiHanTang

I got it. It must be sorted by the top and left corner of the object rectangle. 

 

 

0 Kudos
Message 2 of 3
(4,566 Views)

I am pretty sure they are sorted by the order the pixels are encountered as the algorithm scans from left to right, going down one row at a time.

 

Bruce

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