LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you change the scan order in vision count objects step?

Hi,
 
I am working on a vision inspection. In VBAI with the detect objects step you can specify the scan order. How do you do something like this in labview with the vision development module. So far I have added the count objects step, fed it an image and set up the settings cluster. Everything works okay so far except that I need to detect the objects in a particular sequence, left to right would work, but if there is a way to specify left to right, then bottom to top, then left to right, etc. that would be great.
 
Your help is greatly appreciated.
 
Joel
0 Kudos
Message 1 of 2
(2,527 Views)
Hi kapium,

Thank you for posting on the National Instruments discussion forums.

In VBAI, the Detect Objects step allows you to specify the order of the detected objects.  This does not modify the order in which the objects are scanned.  This is set by the algorithm used by the step; it always detects the object from top left to bottom right, line by line.  When you specify the order, VBAI will take the detected objects, then rearrange them so that, instead of being ordered by their scan order, they will be ordered by the criteria that you specify (size, X position, etc.).

This is important to note because it explains how something similar to this would be done in LabVIEW.  Basically, you would need to take the cluster returned by the IMAQ Count Objects 2 VI and rearrange the objects in the cluster based on the property of your choice.  By migrating a VBAI inspection to LabVIEW, you can see the LabVIEW code that VBAI generates to do this.  Here is a screenshot of this code:



To reproduce this, you will need to create a VBAI inspection that uses the Detect Objects step and is set to sort the objects by something other than the scan order.  Next, in VBAI, select Tools -> Migrate Inspection to LabVIEW...  This will generate the LabVIEW code, but the sorting code that you want is buried a little bit.  First, you will need to open Inspect State Exec 1.vi which is located in the Inspect case inside of the while loop.  Next, open IVB Detect Objects Code.vi, then IVB Detect Objects Exec.vi in the Exec case, then IVB Detect Objects Algorithm.vi in stack #1 of the stacked sequence structure.  The code you want will then be located in the stack #9 of the stacked sequence structure in this VI.

I hope this helps.  Please reply if you have any questions about implementing this.  Thanks.


Rishee B.
Applications Engineer
National Instruments



Message Edited by risheeb on 12-27-2007 09:07 AM
0 Kudos
Message 2 of 2
(2,501 Views)