NumberToFind Property

Applies To
Vision Objects: ArcInspector, Blob, CodeReader, Contour, Correlation, DefectFinder, Edge, Geometric, LineInspector

Description
Defines the number of features to search for within a single search window.

Usage

VGet  Sequence.Object.NumberToFind, var
VSet  Sequence.Object.NumberToFind, value
Sequence
Name of a sequence or string variable containing a sequence name.
Object
Name of an object or string variable containing an object name. The object must exist in the specified sequence.
var
Integer variable that will contain the value of the property.
value
Integer value or expression for the new value of the property.

Values
Valid entries are from 0 (All) to maximum detection number of each object (refer to Remarks).

Default:

  • 0 - All(Contour object)
  • 1(Other objects)

Remarks
The ArcInspector, Blob, Correlation, DefectFinder, Edge, Geometric, and LineInspector objects support finding multiple features within a single Search Window. The NumberToFind property defines how many.

Since many applications require that only 1 feature be found within a Search Window, for objects other than Contour, the default value of NumberToFind property is 1.

When working in the Vision Guide Development Environment, you will notice that the Results List on the Object window will display a heading like “Result (1 of 15)”. This means that the system tried to find 15 features (as defined by the NumberToFind property) and the Result List will display the results for item 1.

If you want to see the results for one of the other results, just change the CurrentResult property value to indicate which result you want to examine.

Blob results are ordered according to the SizeToFind and Sort properties.

If NumberToFind is set to “0 - All”, then all possible results are found, up to the maximum detection number. The maximum detection number varies for each object as shown below.

Object name Max. detection number
CodeReader 8
Contour 1000
Blob, Edge 4000
Other 100

Correlation and Geometric results are ordered by highest Score result to lowest Score result when Sort is “None”. (i.e. result Record 1 (CurrentResult =1) contains the results for the feature with the highest score.)

See Also
ArcInspector Object, Blob Object, Contour Object, Correlation Object, CurrentResult property, DefectFinder Object, Edge Object, Found Result, Geometric Object, LineInspector Object, NumberFound Result

Example
The following SPEL+ language example runs a vision sequence called mtest which contains a Correlation object called Corr01. The NumberToFind value for Corr01 is set using VSet.

The following program will run the sequence and make sure that the proper number of features (3) was found for Corr01 and then print the Score result in descending order.

Function main

  # define NUM_TO_FIND 3
	
  Boolean numfound
  Integer score

  VSet mtest.Corr01.NumberToFind, NUM_TO_FIND
  VRun mtest
  VGet mtest.Corr01.NumberFound, numfound
  If numfound = NUM_TO_FIND Then
    Print "The Proper Number of features(3) were found"
  Else
    Print "Only (", numfound, ") features were found"
    Exit Function
  EndIf
  VGet mtest.Corr01.Score(1), score
  Print "1st feature score (Best):   ", score

  VGet mtest.Corr01.Score(2), score
  Print "2nd feature score (Medium): ", score

  VGet mtest.Corr01.Score(3), score
  Print "3rd feature score (Worst):  ", score
Fend