public class AssociateNearestNeighbor<D> extends java.lang.Object implements AssociateDescription<D>
Matches features using a NearestNeighbor search from DDogleg. The source features are processed
as a lump using NearestNeighbor.setPoints(java.util.List, boolean) while destination features
are matched one at time using NearestNeighbor.findNearest(Object, double, org.ddogleg.nn.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.
| Constructor and Description |
|---|
AssociateNearestNeighbor(org.ddogleg.nn.NearestNeighbor<D> alg) |
| Modifier and Type | Method and Description |
|---|---|
void |
associate()
Finds the best match for each item in the source list with an item in the destination list.
|
org.ddogleg.struct.FastQueue<AssociatedIndex> |
getMatches()
List of associated features.
|
double |
getScoreRatioThreshold() |
MatchScoreType |
getScoreType()
Specifies the type of score which is returned.
|
org.ddogleg.struct.GrowQueue_I32 |
getUnassociatedDestination()
Indexes of features in the destination set which are not associated.
|
org.ddogleg.struct.GrowQueue_I32 |
getUnassociatedSource()
Indexes of features in the source set which are not associated.
|
boolean |
isRatioUsesSqrt() |
void |
setDestination(org.ddogleg.struct.FastQueue<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(org.ddogleg.struct.FastQueue<D> listSrc)
Sets the list of source features.
|
boolean |
uniqueDestination()
If at most one match is returned for each destination feature.
|
boolean |
uniqueSource()
If at most one match is returned for each source feature.
|
public AssociateNearestNeighbor(org.ddogleg.nn.NearestNeighbor<D> alg)
public void setSource(org.ddogleg.struct.FastQueue<D> listSrc)
AssociateDescriptionsetSource in interface AssociateDescription<D>listSrc - List of featurespublic void setDestination(org.ddogleg.struct.FastQueue<D> listDst)
AssociateDescriptionsetDestination in interface AssociateDescription<D>listDst - List of featurespublic void associate()
Associatepublic org.ddogleg.struct.FastQueue<AssociatedIndex> getMatches()
AssociategetMatches in interface Associatepublic org.ddogleg.struct.GrowQueue_I32 getUnassociatedSource()
AssociategetUnassociatedSource in interface Associatepublic org.ddogleg.struct.GrowQueue_I32 getUnassociatedDestination()
AssociategetUnassociatedDestination in interface Associatepublic void setMaxScoreThreshold(double score)
AssociatesetMaxScoreThreshold in interface Associatescore - The threshold.public MatchScoreType getScoreType()
AssociategetScoreType in interface Associatepublic boolean uniqueSource()
AssociateuniqueSource in interface Associatepublic boolean uniqueDestination()
AssociateuniqueDestination in interface Associatepublic boolean isRatioUsesSqrt()
public void setRatioUsesSqrt(boolean ratioUsesSqrt)
public double getScoreRatioThreshold()
public void setScoreRatioThreshold(double scoreRatioThreshold)