Skip to content

Commit

Permalink
- Added ratio test to nearest neighbor association
Browse files Browse the repository at this point in the history
- changed function name to make clear which threshold we are talking about
  • Loading branch information
lessthanoptimal committed Jul 6, 2018
1 parent ca3caf7 commit c9537dc
Show file tree
Hide file tree
Showing 23 changed files with 325 additions and 259 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
* Copyright (c) 2011-2018, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand Down Expand Up @@ -84,8 +84,8 @@ public VisualizeAssociationAlgorithmsApp( Class<T> imageType ) {

addAlgorithm(0, "Greedy", FactoryAssociation.greedy(score, Double.MAX_VALUE, false));
addAlgorithm(0, "Greedy Backwards", FactoryAssociation.greedy(score, Double.MAX_VALUE, true));
addAlgorithm(0, "K-D Tree BBF", FactoryAssociation.kdtree(DOF, 75));
addAlgorithm(0, "Random Forest", FactoryAssociation.kdRandomForest(DOF, 75, 10, 5, 1233445565));
addAlgorithm(0, "K-D Tree BBF", FactoryAssociation.kdtree(null,DOF, 75));
addAlgorithm(0, "Random Forest", FactoryAssociation.kdRandomForest(null,DOF, 75, 10, 5, 1233445565));

image0 = GeneralizedImageOps.createSingleBand(imageType, 1, 1);
image1 = GeneralizedImageOps.createSingleBand(imageType, 1, 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
* Copyright (c) 2011-2018, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand Down Expand Up @@ -90,7 +90,7 @@ public static void main( String argsp[ ] ) {

ProfileOperation.printOpsPerSec(new General("Greedy", FactoryAssociation.greedy(score, Double.MAX_VALUE, false)),TEST_TIME);
ProfileOperation.printOpsPerSec(new General("Greedy Backwards", FactoryAssociation.greedy(score, Double.MAX_VALUE, true)),TEST_TIME);
ProfileOperation.printOpsPerSec(new General("Random Forest", FactoryAssociation.kdRandomForest(DOF,500,15,5,1233445565)),TEST_TIME);
ProfileOperation.printOpsPerSec(new General("Random Forest", FactoryAssociation.kdRandomForest(null,DOF,500,15,5,1233445565)),TEST_TIME);

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
* Copyright (c) 2011-2018, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand Down Expand Up @@ -121,7 +121,7 @@ public static void main( String argsp[ ] ) {
ProfileOperation.printOpsPerSec(app.createProfile("Greedy Backwards",
FactoryAssociation.greedy(score, Double.MAX_VALUE, true)),TEST_TIME);
ProfileOperation.printOpsPerSec(app.createProfile("Random Forest",
FactoryAssociation.kdRandomForest(DOF, 500, 15, 5, 1233445565)),TEST_TIME);
FactoryAssociation.kdRandomForest(null,DOF, 500, 15, 5, 1233445565)),TEST_TIME);

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
* Copyright (c) 2011-2018, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand Down Expand Up @@ -48,14 +48,14 @@ public interface Associate {
/**
* Finds the best match for each item in the source list with an item in the destination list.
*/
public void associate();
void associate();

/**
* List of associated features. Indexes refer to the index inside the input lists.
*
* @return List of associated features.
*/
public FastQueue<AssociatedIndex> getMatches();
FastQueue<AssociatedIndex> getMatches();

/**
* Indexes of features in the source set which are not associated.
Expand All @@ -65,7 +65,7 @@ public interface Associate {
*
* @return List of unassociated source features by index.
*/
public GrowQueue_I32 getUnassociatedSource();
GrowQueue_I32 getUnassociatedSource();

/**
* Indexes of features in the destination set which are not associated.
Expand All @@ -75,34 +75,34 @@ public interface Associate {
*
* @return List of unassociated destination features by index.
*/
public GrowQueue_I32 getUnassociatedDestination();
GrowQueue_I32 getUnassociatedDestination();

/**
* 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
*
* @param score The threshold.
*/
public void setThreshold( double score );
void setMaxScoreThreshold( double score );

/**
* Specifies the type of score which is returned.
*
* @return Type of association score.
*/
public MatchScoreType getScoreType();
MatchScoreType getScoreType();

/**
* If at most one match is returned for each source feature.
*
* @return true for unique source association
*/
public boolean uniqueSource();
boolean uniqueSource();

/**
* If at most one match is returned for each destination feature.
*
* @return true for unique destination association
*/
public boolean uniqueDestination();
boolean uniqueDestination();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
* Copyright (c) 2011-2018, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand Down Expand Up @@ -68,8 +68,8 @@ public GrowQueue_I32 getUnassociatedDestination() {
}

@Override
public void setThreshold(double score) {
alg.setThreshold(score);
public void setMaxScoreThreshold(double score) {
alg.setMaxScoreThreshold(score);
}

@Override
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
* Copyright (c) 2011-2018, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand Down Expand Up @@ -98,8 +98,8 @@ public GrowQueue_I32 getUnassociatedDestination() {
}

@Override
public void setThreshold(double score) {
association.setThreshold(score);
public void setMaxScoreThreshold(double score) {
association.setMaxScoreThreshold(score);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
* Copyright (c) 2011-2018, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand Down Expand Up @@ -103,7 +103,7 @@ public GrowQueue_I32 getUnassociatedDestination() {
}

@Override
public void setThreshold(double score) {
public void setMaxScoreThreshold(double score) {
alg.setMaxFitError(score);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
* Copyright (c) 2011-2018, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
Expand Down Expand Up @@ -73,8 +73,8 @@ public GrowQueue_I32 getUnassociatedDestination() {
}

@Override
public void setThreshold(double score) {
alg.getAssoc().setThreshold(score);
public void setMaxScoreThreshold(double score) {
alg.getAssoc().setMaxScoreThreshold(score);
}

@Override
Expand Down

This file was deleted.

Loading

0 comments on commit c9537dc

Please sign in to comment.