ShapeFinder (SF.dll) 14.0
TSearchAllParams Struct Reference

Structure that contains the parameters that control the extraction of solutions from the ShapeFinder accumulator. More...

Data Fields

int LocA
 Minimum rotation difference for two results. Set to a sufficiently large value to avoid co-located results that only differ in rotation.
 
int LocR
 Minimum scale difference for two results. Set to a sufficiently large value to avoid co-located results that only differ in scale.
 
int LocXY
 Minimum distance for solutions in the coarse layer before correlation hill climbing happens.
 
int MaxNumSolutions
 Maximal number of solutions to return. Set to a sufficiently high value to avoid loosing results because no available slots for potential candidates are left.
 
int MinimalThreshold
 Absolute quality threshold a result must exceed to make it into the result list. Depending on the value of Precision this is either an (open ended) feature count (Precision == 0) or a quality value from the range [0...100] (Precision > 0).
 
int Precision
 Defines how many and which search phases will be carried out. More...
 
int RelativeThreshold
 Defines the quality span between the best and the worst result candidate.
 

Related Functions

(Note that these are not member functions.)

cvbbool_t GetSF2SearchAllPars (SF sf, TSearchAllParams &SearchAllPars)
 Queries the currently set parameters that control the generation of a list of solutions during a ShapeFinder2 search operation. More...
 
cvbbool_t SetSF2SearchAllPars (SF sf, TSearchAllParams SearchAllPars)
 Sets the parameters that control the generation of a list of solutions during a ShapeFinder2 search operation. More...
 

Detailed Description

Structure that contains the parameters that control the extraction of solutions from the ShapeFinder accumulator.

At the end of the first search phase of a ShapeFinder2 model (functions SF2Search and SF2SearchEx), the preliminary candidates for further refinement are extracted from a ShapeFinder search accumulator according to the parameters defined in this structure (see also the chapter Preliminary Search):

  • A list is of all positions where the accumulator quality value exceeds the MinimalThreshold is generated and sorted by descending quality.
  • All entries in this list where the quality is less than RelativeThreshold percent of the highest entry are deleted (e.g. if the highest quality in the list is 60 and RelativeThreshold has been set to 50 then all list entries with a quality of less than 30 are discarded).
  • Then a locality check versus LocXY, LocA and LocR is made on all the remaining entries in the list: If a higher quality result has a lower quality result nearby in terms of position, rotation or scale that violates the LocXY, LocA or LocR threshold, the lower quality value(s) will be erased, making sure that LocXY is the minimum distance between nearby results and LocA and LocR are the minimum scale and rotation difference for nearby results (all three locality thresholds are checked simultaneously).
    Locality refers to the center points of the found objects and the distance calculated based on the L1 norm.
    Note that LocXY is being applied in the coarse layer of the first search phase. This means that the locality is not given in pixels of the original image, but in pixels of the coarse layer (which must be multiplied by a factor 2coarseScale to map to the original image. LocA and LocR are usually given in accumulator distances in the scale and range "direction", making it difficult to map these to useful values. Usually an extremely large positive integer value should therefore be assigned to these two thresholds.
    Also note that after the application of the locality a hill climbing step may occur (if Precision is greater than 0) which may lead to situations that two results ultimately end up closer to each other than the LocXY parameter would allow.
  • If the list is longer than MaxNumSolutions only the best MaxNumSolutions entries are kept.

The search parameters are a property of a ShapeFinder2 model and will be set to the following default values:

Parameter Default Value
LocXY 10
LocA 60
LocR 2147483647
MaxNumSolutions 100
RelativeThreshold 78
MinimalThreshold 10
Precision 2

The currently used values may be queried with the function GetSF2SearchAllPars and modified with the function SetSF2SearchAllPars.

The constant SAP_DefaultParams defines a useful set of default values.

Field Documentation

◆ Precision

int Precision

Defines how many and which search phases will be carried out.

Value Meaning
0 Only a ShapeFinder-like search will be performed giving only rough precision in location, rotation and scale.
1 The ShapeFinder search will be followed by a correlation step in the coarse layer giving good precision in location, rotation and scale.
2 The ShapeFinder search will be followed by a correlation step in the fine layer giving optimum precision in location, rotation and scale.

Higher values here will lead to an increase in processing time.