Class AssociateNearestNeighbor<D>
- All Implemented Interfaces:
Associate<D>
,AssociateDescription<D>
- Direct Known Subclasses:
AssociateNearestNeighbor_MT
,AssociateNearestNeighbor_ST
Matches features using a NearestNeighbor
search from DDogleg. The source features are processed
as a lump using NearestNeighbor.setPoints(List, boolean)
while destination features
are matched one at time using NearestNeighbor.Search.findNearest(Object, double, NnData)
.
Typically the processing of source features is more expensive and should be minimized while looking up
destination features is fast. Multiple matches for source features are possible while there will only
be a unique match for each destination feature.
An optional ratio test inspired from [1] can be used. The ratio between the best and second best score is found. if the difference is significant enough then the match is accepted. This this is a ratio test, knowing if the score is squared is important. Please set the flag correctly. Almost always the score is Euclidean distance squared.
[1] Lowe, David G. "Distinctive image features from scale-invariant keypoints." International journal of computer vision 60.2 (2004): 91-110.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionList of associated features.double
Specifies the type of score which is returned.Indexes of features in the destination set which are not associated.Indexes of features in the source set which are not associated.boolean
void
setDestination
(FastAccess<D> listDst) Sets the list of destination features NOTE: A reference to the input list might be saved internally until the next call to this function.void
setMaxScoreThreshold
(double score) Associations are only considered if their score is less than or equal to the specified threshold.void
setRatioUsesSqrt
(boolean ratioUsesSqrt) void
setScoreRatioThreshold
(double scoreRatioThreshold) void
setSource
(FastAccess<D> listSrc) Sets the list of source features.boolean
If at most one match is returned for each destination feature.boolean
If at most one match is returned for each source feature.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface boofcv.abst.feature.associate.Associate
associate, getDescriptionType
-
Field Details
-
matchesAll
-
-
Constructor Details
-
AssociateNearestNeighbor
-
-
Method Details
-
setSource
Description copied from interface:AssociateDescription
Sets the list of source features. NOTE: A reference to the input list might be saved internally until the next call to this function.- Specified by:
setSource
in interfaceAssociateDescription<D>
- Parameters:
listSrc
- List of features
-
setDestination
Description copied from interface:AssociateDescription
Sets the list of destination features NOTE: A reference to the input list might be saved internally until the next call to this function.- Specified by:
setDestination
in interfaceAssociateDescription<D>
- Parameters:
listDst
- List of features
-
getMatches
Description copied from interface:Associate
List of associated features. Indexes refer to the index inside the input lists.- Specified by:
getMatches
in interfaceAssociate<D>
- Returns:
- List of associated features.
-
getUnassociatedSource
Description copied from interface:Associate
Indexes of features in the source set which are not associated. WARNING: In some implementations the unassociated list is recomputed each time this function is invoked. In other implementations it was found virtually for free while the matches are found.- Specified by:
getUnassociatedSource
in interfaceAssociate<D>
- Returns:
- List of unassociated source features by index.
-
getUnassociatedDestination
Description copied from interface:Associate
Indexes of features in the destination set which are not associated. WARNING: In some implementations the unassociated list is recomputed each time this function is invoked. In other implementations it was found virtually for free while the matches are found.- Specified by:
getUnassociatedDestination
in interfaceAssociate<D>
- Returns:
- List of unassociated destination features by index.
-
setMaxScoreThreshold
public void setMaxScoreThreshold(double score) Description copied from interface:Associate
Associations are only considered if their score is less than or equal to the specified threshold. To remove any threshold test set this value to Double.MAX_VALUE- Specified by:
setMaxScoreThreshold
in interfaceAssociate<D>
- Parameters:
score
- The threshold.
-
getScoreType
Description copied from interface:Associate
Specifies the type of score which is returned.- Specified by:
getScoreType
in interfaceAssociate<D>
- Returns:
- Type of association score.
-
uniqueSource
public boolean uniqueSource()Description copied from interface:Associate
If at most one match is returned for each source feature.- Specified by:
uniqueSource
in interfaceAssociate<D>
- Returns:
- true for unique source association
-
uniqueDestination
public boolean uniqueDestination()Description copied from interface:Associate
If at most one match is returned for each destination feature.- Specified by:
uniqueDestination
in interfaceAssociate<D>
- Returns:
- true for unique destination association
-
isRatioUsesSqrt
public boolean isRatioUsesSqrt() -
setRatioUsesSqrt
public void setRatioUsesSqrt(boolean ratioUsesSqrt) -
getScoreRatioThreshold
public double getScoreRatioThreshold() -
setScoreRatioThreshold
public void setScoreRatioThreshold(double scoreRatioThreshold)
-