Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Handling variable number of detected ojects in VBAI calculator

Solved!
Go to solution

I have an inspection that searches for bright objects (holes) in a product, and typically it does not find any (good), but when it does I need to know the locations of each hole, to determine xy-boundaries of the region of holes, i.e., the mins and maxes of the xy-coordinates of each hole. To do this, I'd like to use a caclulator step and interate through all the holes found.....but I don't believe the calculator can handle a variable number of holes..or can it?

 

Thanks,

Eric

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

Hi Eric,

 

The calculator step does not support arrays. We got numerous requests about better array support in VBAI and we're going to address it.

In the meantime, you can iterate through the results of a step that produces arrays by building a slightly more complex state diagram. Index Measurements Example.vbai and Classify Objects Example.vbai for examples on how to do that.

 

Hope this helps.

 

Best regards,

 

Christophe

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

It can if you put it in a loop with the index step indexing through each detected object and getting the center X, Y for hole[i], passing these results to caluclator, incrementing i, and using index step to get coordinates for next hole, and leave this state when no holes left.

 

Hope that  helps,

Brad

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

Christophe/Brad,

Thanks, that did the trick.

Eric

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