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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList of associated features.doubleSpecifies 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.booleanvoidsetDestination(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.voidsetMaxScoreThreshold(double score) Associations are only considered if their score is less than or equal to the specified threshold.voidsetRatioUsesSqrt(boolean ratioUsesSqrt) voidsetScoreRatioThreshold(double scoreRatioThreshold) voidsetSource(FastAccess<D> listSrc) Sets the list of source features.booleanIf at most one match is returned for each destination feature.booleanIf 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, waitMethods inherited from interface boofcv.abst.feature.associate.Associate
associate, getDescriptionType
-
Field Details
-
matchesAll
-
-
Constructor Details
-
AssociateNearestNeighbor
-
-
Method Details
-
setSource
Description copied from interface:AssociateDescriptionSets 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:
setSourcein interfaceAssociateDescription<D>- Parameters:
listSrc- List of features
-
setDestination
Description copied from interface:AssociateDescriptionSets 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:
setDestinationin interfaceAssociateDescription<D>- Parameters:
listDst- List of features
-
getMatches
Description copied from interface:AssociateList of associated features. Indexes refer to the index inside the input lists.- Specified by:
getMatchesin interfaceAssociate<D>- Returns:
- List of associated features.
-
getUnassociatedSource
Description copied from interface:AssociateIndexes 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:
getUnassociatedSourcein interfaceAssociate<D>- Returns:
- List of unassociated source features by index.
-
getUnassociatedDestination
Description copied from interface:AssociateIndexes 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:
getUnassociatedDestinationin interfaceAssociate<D>- Returns:
- List of unassociated destination features by index.
-
setMaxScoreThreshold
public void setMaxScoreThreshold(double score) Description copied from interface:AssociateAssociations 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:
setMaxScoreThresholdin interfaceAssociate<D>- Parameters:
score- The threshold.
-
getScoreType
Description copied from interface:AssociateSpecifies the type of score which is returned.- Specified by:
getScoreTypein interfaceAssociate<D>- Returns:
- Type of association score.
-
uniqueSource
public boolean uniqueSource()Description copied from interface:AssociateIf at most one match is returned for each source feature.- Specified by:
uniqueSourcein interfaceAssociate<D>- Returns:
- true for unique source association
-
uniqueDestination
public boolean uniqueDestination()Description copied from interface:AssociateIf at most one match is returned for each destination feature.- Specified by:
uniqueDestinationin 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)
-