System.out.println("LMA: iter="+iter+", full RMS="+last_rms[0]+" ("+initial_rms[0]+"), pure RMS="+last_rms[1]+" ("+initial_rms[1]+") + lambda="+lambda);
}
}
}
if((debug_level>-2)&&!rslt[0]){// failed
if((debug_level>1)||(iter==1)||last_run){
System.out.println("LMA failed on iteration = "+iter);
}
System.out.println();
}
returnrslt[0]?iter:-1;
}
privateboolean[]lmaStep(
doublelambda,
doublerms_diff,
intdebug_level){
boolean[]rslt={false,false};
// maybe the following if() branch is not needed - already done in prepareLMA !
if(this.last_rms==null){//first time, need to calculate all (vector is valid)
last_rms=newdouble[2];
if(debug_level>1){
System.out.println("lmaStep(): first step");
}
double[]fx=getFxDerivs(
parameters_vector,// double [] vector,
last_jt,// final double [][] jt, // should be null or initialized with [vector.length][]
debug_level);// final int debug_level)
last_ymfx=getYminusFxWeighted(
fx,// final double [] fx,
last_rms);// final double [] rms_fp // null or [2]
this.initial_rms=this.last_rms.clone();
this.good_or_bad_rms=this.last_rms.clone();
if(debug_level>-1){// temporary
/*
dbgYminusFxWeight(
this.last_ymfx,
this.weights,
"Initial_y-fX_after_moving_objects");
*/
}
if(last_ymfx==null){
returnnull;// need to re-init/restart LMA
}
// TODO: Restore/implement
if(debug_level>3){
doubledelta=this.delta;
doubledelta_err=compareJT(
parameters_vector,// double [] vector,
delta,// double delta,
last3only);// boolean last3only); // do not process samples - they are tested before
@@ -175,6 +175,13 @@ public class IntersceneMatchParameters {
...
@@ -175,6 +175,13 @@ public class IntersceneMatchParameters {
publicdoublealt_outliers=0.1;// remove outliers when fitting planes
publicdoublealt_outliers=0.1;// remove outliers when fitting planes
publicintalt_refine=1;// refine plane after removing outliers (0 - no outlier removal, 1 - remove outliers and refine once, ...)
publicintalt_refine=1;// refine plane after removing outliers (0 - no outlier removal, 1 - remove outliers and refine once, ...)
publicdoublealt_weight_rot=1.0;// >0 weight of pairs errors in qn3
publicdoublealt_weight_tilt=0.3;// >0 weight of pairs errors in qn1, qn2
publicdoublealt_weight_scale=0.1;// >0 weight in pairs scale-1.0 errors
publicdoublealt_pull=0.2;// 0 <= pull <1 - fraction of all RMS contributors
publicdoublealt_pull_rots=1.0;// >=0 weight of sum of rotations, may be 0, normalized by pull value
publicdoublealt_pull_tilts=0.3;// >=0 weights of sum of qn1 and qn2 of scenes, normalized by pull value
publicdoublealt_pull_scales=0.1;// >=0 weights of scales of scenes, normalized by pull value
publicbooleanpmap_move_only=false;
publicbooleanpmap_move_only=false;
publicbooleanpmap_ignore_affines=false;
publicbooleanpmap_ignore_affines=false;
...
@@ -930,6 +937,15 @@ min_str_neib_fpn 0.35
...
@@ -930,6 +937,15 @@ min_str_neib_fpn 0.35
gd.addNumericField("Fraction of ouliers",this.alt_outliers,3,7,"","Remove outliers when fitting planes, removed fraction.");
gd.addNumericField("Fraction of ouliers",this.alt_outliers,3,7,"","Remove outliers when fitting planes, removed fraction.");
gd.addNumericField("Number of alt plane refines",this.alt_refine,0,3,"","Refine altitude difference plane after removing outliers (0 - no outlier removal, 1 - remove outliers and refine once, ...)");
gd.addNumericField("Number of alt plane refines",this.alt_refine,0,3,"","Refine altitude difference plane after removing outliers (0 - no outlier removal, 1 - remove outliers and refine once, ...)");
gd.addMessage("Parameters for scenes orientation LMA fitting");
gd.addNumericField("Rotation mismatches weights",this.alt_weight_rot,3,7,"","Weights of rotation mismatches.");
gd.addNumericField("Tilt mismatches weights",this.alt_weight_tilt,3,7,"","Weights of tilt mismatches.");
gd.addNumericField("Scale mismatches weights",this.alt_weight_scale,3,7,"","Weights of scale mismatches.");
gd.addNumericField("Pull strength",this.alt_pull,3,7,"","Relative weight of combined regularization pull (0<=pull<1.0)");
gd.addNumericField("Rotations pull",this.alt_pull_rots,3,7,"","Weight of sum of all rotations pull to zero - will be normalized to make sum of pulls a specified fraction of totla weights ");
gd.addNumericField("Tilts pull",this.alt_pull_tilts,3,7,"","Weight of sum of all tilts pull to zero - will be normalized to make sum of pulls a specified fraction of totla weights ");
gd.addNumericField("Scales pull",this.alt_pull_scales,3,7,"","Weight of sum of all scales pull to zero - will be normalized to make sum of pulls a specified fraction of totla weights ");
gd.addMessage("Build map with LMA from pairwise matches");
gd.addMessage("Build map with LMA from pairwise matches");
gd.addCheckbox("Moves only",this.pmap_move_only,"Moves only, no affine transform.");
gd.addCheckbox("Moves only",this.pmap_move_only,"Moves only, no affine transform.");
gd.addCheckbox("Ignore existing affines",this.pmap_ignore_affines,"Start from unity matrices, ignore saved affines.");
gd.addCheckbox("Ignore existing affines",this.pmap_ignore_affines,"Start from unity matrices, ignore saved affines.");