Skip to content

Commit

Permalink
support min_inlier_factor throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanPreibisch committed May 3, 2024
1 parent 1bdd9fb commit daef07a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class GeometricHashingGUI extends PairwiseGUI
public static int defaultModel = 2;
public static boolean defaultRegularize = true;
public static int defaultRANSACIterationChoice = 1;
public static float min_inlier_factor = 3f;
protected TransformationModelGUI model = null;

protected RANSACParameters ransacParams;
Expand Down Expand Up @@ -81,6 +82,7 @@ public void addQuery( final GenericDialog gd )
gd.addMessage( "" );

gd.addSlider( "Allowed_error_for_RANSAC (px)", 0.5, 100.0, RANSACParameters.max_epsilon );
gd.addSlider( "Inlier_factor (minimal amount of inliers)", 1, 20, min_inlier_factor );
gd.addChoice( "Number_of_RANSAC_iterations", RANSACParameters.ransacChoices, RANSACParameters.ransacChoices[ defaultRANSACIterationChoice ] );
}

Expand All @@ -105,6 +107,7 @@ public boolean parseDialog( final GenericDialog gd )
final int redundancy = GeometricHashingParameters.redundancy = (int)Math.round( gd.getNextNumber() );
final float ratioOfDistance = GeometricHashingParameters.ratioOfDistance = (float)gd.getNextNumber();
final float maxEpsilon = RANSACParameters.max_epsilon = (float)gd.getNextNumber();
final float inlierFactor = min_inlier_factor = (float)gd.getNextNumber();
final int ransacIterations = RANSACParameters.ransacChoicesIterations[ defaultRANSACIterationChoice = gd.getNextChoiceIndex() ];

final float minInlierRatio;
Expand All @@ -116,13 +119,14 @@ else if ( ratioOfDistance >= 1.5 )
minInlierRatio = RANSACParameters.min_inlier_ratio / 100;

this.ghParams = new GeometricHashingParameters( model.getModel(), GeometricHashingParameters.differenceThreshold, ratioOfDistance, redundancy );
this.ransacParams = new RANSACParameters( maxEpsilon, minInlierRatio, RANSACParameters.min_inlier_factor, ransacIterations );
this.ransacParams = new RANSACParameters( maxEpsilon, minInlierRatio, inlierFactor, ransacIterations );

IOFunctions.println( "Selected Paramters:" );
IOFunctions.println( "model: " + defaultModel );
IOFunctions.println( "redundancy: " + redundancy );
IOFunctions.println( "ratioOfDistance: " + ratioOfDistance );
IOFunctions.println( "maxEpsilon: " + maxEpsilon );
IOFunctions.println( "inlierFactor: " + inlierFactor );
IOFunctions.println( "ransacIterations: " + ransacIterations );
IOFunctions.println( "minInlierRatio: " + minInlierRatio );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class RGLDMGUI extends PairwiseGUI
public static int defaultModel = 2;
public static boolean defaultRegularize = true;
public static int defaultRANSACIterationChoice = 1;
public static float min_inlier_factor = 3f;
protected TransformationModelGUI model = null;

protected RGLDMParameters parameters;
Expand Down Expand Up @@ -88,6 +89,7 @@ public void addQuery( final GenericDialog gd )
gd.addMessage( "" );

gd.addSlider( "Allowed_error_for_RANSAC (px)", 0.5, 100.0, RANSACParameters.max_epsilon );
gd.addSlider( "Inlier_factor (minimal amount of inliers)", 1, 20, min_inlier_factor );
gd.addChoice( "RANSAC_iterations", RANSACParameters.ransacChoices, RANSACParameters.ransacChoices[ defaultRANSACIterationChoice ] );
}

Expand All @@ -113,6 +115,7 @@ public boolean parseDialog( final GenericDialog gd )
final int redundancy = RGLDMParameters.redundancy = (int)Math.round( gd.getNextNumber() );
final float ratioOfDistance = RGLDMParameters.ratioOfDistance = (float)gd.getNextNumber();
final float maxEpsilon = RANSACParameters.max_epsilon = (float)gd.getNextNumber();
final float inlierFactor = min_inlier_factor = (float)gd.getNextNumber();
final int ransacIterations = RANSACParameters.ransacChoicesIterations[ defaultRANSACIterationChoice = gd.getNextChoiceIndex() ];

final float minInlierRatio;
Expand All @@ -124,14 +127,15 @@ else if ( ratioOfDistance >= 1.5 )
minInlierRatio = RANSACParameters.min_inlier_ratio / 100;

this.parameters = new RGLDMParameters( model.getModel(), RGLDMParameters.differenceThreshold, ratioOfDistance, numNeighbors, redundancy );
this.ransacParams = new RANSACParameters( maxEpsilon, minInlierRatio, RANSACParameters.min_inlier_factor, ransacIterations );
this.ransacParams = new RANSACParameters( maxEpsilon, minInlierRatio, inlierFactor, ransacIterations );

IOFunctions.println( "Selected Paramters:" );
IOFunctions.println( "model: " + defaultModel );
IOFunctions.println( "numNeighbors: " + numNeighbors );
IOFunctions.println( "redundancy: " + redundancy );
IOFunctions.println( "ratioOfDistance: " + ratioOfDistance );
IOFunctions.println( "maxEpsilon: " + maxEpsilon );
IOFunctions.println( "inlierFactor: " + inlierFactor );
IOFunctions.println( "ransacIterations: " + ransacIterations );
IOFunctions.println( "minInlierRatio: " + minInlierRatio );

Expand Down

0 comments on commit daef07a

Please sign in to comment.