Commit f9ea6e08 authored by Andrey Filippov's avatar Andrey Filippov

Started OriantationSceneLMA

parent ecbbff57
...@@ -177,7 +177,7 @@ public class ComboMatch { ...@@ -177,7 +177,7 @@ public class ComboMatch {
boolean use_saved_collection = true; // false; boolean use_saved_collection = true; // false;
boolean save_collection = true; boolean save_collection = false; // true;
boolean process_correlation = true; // use false to save new version of data boolean process_correlation = true; // use false to save new version of data
int num_tries_fit = 10; int num_tries_fit = 10;
boolean update_match = true; // use false to save new version of data boolean update_match = true; // use false to save new version of data
......
...@@ -258,7 +258,6 @@ public class ERSTiltLMA { ...@@ -258,7 +258,6 @@ public class ERSTiltLMA {
weight_pure *= k; weight_pure *= k;
last_jt = new double [parameters_vector.length][]; last_jt = new double [parameters_vector.length][];
return weights.length; return weights.length;
} }
private double [] getFxDerivs( private double [] getFxDerivs(
...@@ -331,6 +330,8 @@ public class ERSTiltLMA { ...@@ -331,6 +330,8 @@ public class ERSTiltLMA {
ImageDtt.startAndJoin(threads); ImageDtt.startAndJoin(threads);
return fX; return fX;
} }
private double [][] getFxDerivsDelta( private double [][] getFxDerivsDelta(
double [] vector, double [] vector,
final double delta, final double delta,
......
...@@ -48,6 +48,13 @@ public class OrthoAltitudeMatch { ...@@ -48,6 +48,13 @@ public class OrthoAltitudeMatch {
double alt_outliers, // 0.05; Remove outliers when fitting planes, removed fraction. double alt_outliers, // 0.05; Remove outliers when fitting planes, removed fraction.
int alt_refine, // 1; Refine altitude difference plane after removing outliers (0 - no outlier removal, 1 - remove outliers and refine once, ...) int alt_refine, // 1; Refine altitude difference plane after removing outliers (0 - no outlier removal, 1 - remove outliers and refine once, ...)
double metric_error, double metric_error,
double weight_rot, // >0 weight of pairs errors in qn3
double weight_tilt, // >0 weight of pairs errors in qn1, qn2
double weight_scale, // >0 weight in pairs scale-1.0 errors
double pull, // 0 <= pull <1 - fraction of all RMS contributors
double pull_rots, // >=0 weight of sum of rotations, may be 0, normalized by pull value
double pull_tilts, // >=0 weights of sum of qn1 and qn2 of scenes, normalized by pull value
double pull_scales, // >=0 weights of scales of scenes, normalized by pull value
// log/save parameters // log/save parameters
boolean save_each, boolean save_each,
boolean log_append, boolean log_append,
...@@ -150,6 +157,7 @@ public class OrthoAltitudeMatch { ...@@ -150,6 +157,7 @@ public class OrthoAltitudeMatch {
Arrays.fill(weights_scenes, 1.0); Arrays.fill(weights_scenes, 1.0);
Arrays.fill(weights_pairs, 1.0); Arrays.fill(weights_pairs, 1.0);
double [][][] scene_tilts_pairs = new double [num_pairs][2][]; double [][][] scene_tilts_pairs = new double [num_pairs][2][];
double [][] quat_pairs = new double [num_pairs][]; // pairwise quaternions combining 2 axes from tilts, rotation and scale - from affine
double [][][] affine_pairs = new double [num_pairs][][]; double [][][] affine_pairs = new double [num_pairs][][];
double [] flat_err = new double[num_pairs]; double [] flat_err = new double[num_pairs];
double [] overlaps = new double [num_pairs]; double [] overlaps = new double [num_pairs];
...@@ -282,6 +290,10 @@ public class OrthoAltitudeMatch { ...@@ -282,6 +290,10 @@ public class OrthoAltitudeMatch {
affine_pairs[npair] = pairwiseOrthoMatch.getAffine(); // contains scale + rot affine_pairs[npair] = pairwiseOrthoMatch.getAffine(); // contains scale + rot
flat_err[npair] = Math.sqrt(tilt_err2); flat_err[npair] = Math.sqrt(tilt_err2);
overlaps[npair] = pairwiseOrthoMatch.getOverlap(); overlaps[npair] = pairwiseOrthoMatch.getOverlap();
quat_pairs[npair] = QuatUtils.sceneRelLocalGround(
alt_data, // double [] txy, differential tilts
affine_pairs[npair], // double [][] affine,
y_down_ccw); // boolean y_down_ccw)
if (!test_quat2) { if (!test_quat2) {
continue; continue;
} }
...@@ -629,8 +641,6 @@ public class OrthoAltitudeMatch { ...@@ -629,8 +641,6 @@ public class OrthoAltitudeMatch {
double [][][][] raffines_pm = new double [affines.length][2][][]; double [][][][] raffines_pm = new double [affines.length][2][][];
SingularValueDecomposition[][] rsvd_pm = new SingularValueDecomposition [affines.length][2]; SingularValueDecomposition[][] rsvd_pm = new SingularValueDecomposition [affines.length][2];
for (int i = 0; i < raffines_pm.length;i++) { for (int i = 0; i < raffines_pm.length;i++) {
// raffines_pm[i][0] = QuatUtils.quatToAffine(QuatUtils.affineToQuatScaled(affines[i], false, y_down_ccw)[0],false,true,true);
// raffines_pm[i][1] = QuatUtils.quatToAffine(QuatUtils.affineToQuatScaled(affines[i], false, y_down_ccw)[1],false,false,true);
raffines_pm[i][0] = QuatUtils.quatToAffine(QuatUtils.affineToQuatScaled(affines[i], false, y_down_ccw)[0],invert_q2a,true); raffines_pm[i][0] = QuatUtils.quatToAffine(QuatUtils.affineToQuatScaled(affines[i], false, y_down_ccw)[0],invert_q2a,true);
raffines_pm[i][1] = QuatUtils.quatToAffine(QuatUtils.affineToQuatScaled(affines[i], false, y_down_ccw)[1],invert_q2a,true); raffines_pm[i][1] = QuatUtils.quatToAffine(QuatUtils.affineToQuatScaled(affines[i], false, y_down_ccw)[1],invert_q2a,true);
rsvd_pm[i][0] = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(raffines_pm[i][0], y_down_ccw); rsvd_pm[i][0] = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(raffines_pm[i][0], y_down_ccw);
...@@ -878,13 +888,90 @@ public class OrthoAltitudeMatch { ...@@ -878,13 +888,90 @@ public class OrthoAltitudeMatch {
// double tilt_err_threshold = 0.01; // reduce weight if larger // double tilt_err_threshold = 0.01; // reduce weight if larger
//overlop_pow = 2.0 //overlop_pow = 2.0
for (int npair = 0; npair <quat_pairs.length; npair++ ) {
System.out.println("quat_pairs["+npair+"]="+QuatUtils.toString(quat_pairs[npair],use_degrees));
}
double [] quat02 = QuatUtils.multiplyScaled(quat_pairs[0],quat_pairs[2]);
System.out.println( "quat02= "+QuatUtils.toString(quat02,use_degrees));
double [] quat_err = QuatUtils.multiplyScaled(quat02, QuatUtils.invertScaled(quat_pairs[1]));
System.out.println( "quat_err= "+QuatUtils.toString(quat_err,use_degrees));
double quat02_norm = QuatUtils.norm(quat02);
double quat02_offs = Math.sqrt(quat02[1]*quat02[1]+quat02[2]*quat02[2]+quat02[3]*quat02[3]);
double quat02_orient = quat02_offs/quat02_norm;
double quat02_scale = quat02_norm-1.0;
double quat_err_norm = QuatUtils.norm(quat_err);
double quat_err_offs = Math.sqrt(quat_err[1]*quat_err[1]+quat_err[2]*quat_err[2]+quat_err[3]*quat_err[3]);
double orient_err = quat_err_offs/quat_err_norm;
double scale_err = quat_err_norm-1.0;
System.out.println("quat02_orient="+quat02_orient);
System.out.println("quat02_scale= "+quat02_scale);
System.out.println("orient_err="+orient_err);
System.out.println("scale_err= "+scale_err);
System.out.println("orient_err_rel="+orient_err/quat02_orient);
System.out.println("scale_err_rel= "+scale_err/quat02_scale);
for (int npair = 0; npair <quat_pairs.length; npair++ ) {
SingularValueDecomposition svd = SingularValueDecomposition.singularValueDecomposeScaleTiltGamma(affine_pairs[npair], y_down_ccw); // boolean y_down_ccw)
System.out.println("svd_affine["+npair+"]=" + svd.toString(use_degrees));
}
double max_flat_err = 0;//tilt_err_threshold double max_flat_err = 0; // tilt_err_threshold
for (int npair = 0; npair < num_pairs; npair++) { for (int npair = 0; npair < num_pairs; npair++) {
max_flat_err = Math.max(max_flat_err, flat_err[npair]); max_flat_err = Math.max(max_flat_err, flat_err[npair]);
//weights_pairs //weights_pairs
weights_pairs[npair] = tilt_err_threshold/Math.max(tilt_err_threshold, flat_err[npair])*Math.pow(overlaps[npair], overlop_pow); weights_pairs[npair] = tilt_err_threshold/Math.max(tilt_err_threshold, flat_err[npair])*Math.pow(overlaps[npair], overlop_pow);
} }
System.out.println("max_flat_err="+max_flat_err);
OrientationSceneLMA orientationSceneLMA = new OrientationSceneLMA();
orientationSceneLMA.prepareLMA(
indices, // int [] indices, // should all be used
condensed_pairs, // int [][] cpairs,
weights_pairs, // double [] weights_pairs, // from matching tilts(flatness) (and worst sfm, per-pair rmse)?
weight_rot, // double weight_rot, // >0 weight of pairs errors in qn3
weight_tilt, // double weight_tilt, // >0 weight of pairs errors in qn1, qn2
weight_scale, // double weight_scale, // >0 weight in pairs scale-1.0 errors
pull, // double pull, // 0 <= pull <1 - fraction of all RMS contributors
pull_rots, // double pull_rots, // >=0 weight of sum of rotations, may be 0, normalized by pull value
pull_tilts, // double pull_tilts, // >=0 weights of sum of qn1 and qn2 of scenes, normalized by pull value
pull_scales, // double pull_scales, // >=0 weights of scales of scenes, normalized by pull value
quat_pairs, // double [][] qpairs, // [pair][4] quaternions for pairs - orientation and scale (non-unity quaternions)
debugLevel); // int debug_level);
double lambda = 0.1;
double lambda_scale_good = 0.5;
double lambda_scale_bad = 8.0;
double lambda_max = 1000;
boolean last_run = false;
double rms_diff = 0.0001;
int num_iter = 100;
int lma_rslt= orientationSceneLMA.runLma( // <0 - failed, >=0 iteration number (1 - immediately)
lambda, // double lambda, // 0.1
lambda_scale_good,// double lambda_scale_good,// 0.5
lambda_scale_bad, // double lambda_scale_bad, // 8.0
lambda_max, // double lambda_max, // 100
rms_diff, // double rms_diff, // 0.001
num_iter, //int num_iter, // 20
last_run, // boolean last_run,
null, // String dbg_prefix,
debugLevel); // int debug_level)
System.out.println("LMA -> "+lma_rslt);
if (lma_rslt >= 0) {
if (debugLevel > -3) {
//ersTiltLMA.printSceneResults(use_degrees, use_percents);
//ersTiltLMA.printPairsResults(use_degrees, use_percents);
}
}
System.out.println();
ERSTiltLMA ersTiltLMA = new ERSTiltLMA(); ERSTiltLMA ersTiltLMA = new ERSTiltLMA();
ersTiltLMA.prepareLMA( ersTiltLMA.prepareLMA(
...@@ -896,15 +983,16 @@ public class OrthoAltitudeMatch { ...@@ -896,15 +983,16 @@ public class OrthoAltitudeMatch {
scene_tilts_pairs, // double [][][] tilts, // [pair][scene(2)][tilt(2)] scene_tilts_pairs, // double [][][] tilts, // [pair][scene(2)][tilt(2)]
affine_pairs, // double [][][] affine_pairs, affine_pairs, // double [][][] affine_pairs,
debugLevel); // int debug_level) debugLevel); // int debug_level)
/*
double lambda = 0.1; double lambda = 0.1;
double lambda_scale_good = 0.5; double lambda_scale_good = 0.5;
double lambda_scale_bad = 8.0; double lambda_scale_bad = 8.0;
double lambda_max = 1000; double lambda_max = 1000;
boolean last_run = false; boolean last_run = false;
double rms_diff = 0.0001; double rms_diff = 0.0001;
int num_iter = 100; int num_iter = 100;
int lma_rslt=ersTiltLMA.runLma( // <0 - failed, >=0 iteration number (1 - immediately) */
lma_rslt=ersTiltLMA.runLma( // <0 - failed, >=0 iteration number (1 - immediately)
lambda, // double lambda, // 0.1 lambda, // double lambda, // 0.1
lambda_scale_good,// double lambda_scale_good,// 0.5 lambda_scale_good,// double lambda_scale_good,// 0.5
lambda_scale_bad, // double lambda_scale_bad, // 8.0 lambda_scale_bad, // double lambda_scale_bad, // 8.0
......
...@@ -6350,6 +6350,14 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -6350,6 +6350,14 @@ public class OrthoMapsCollection implements Serializable{
double metric_err = clt_parameters.imp.pmtch_metric_err;// 0.05; // 0.02;// 2 cm double metric_err = clt_parameters.imp.pmtch_metric_err;// 0.05; // 0.02;// 2 cm
double weight_rot = clt_parameters.imp.alt_weight_rot; // >0 weight of pairs errors in qn3
double weight_tilt = clt_parameters.imp.alt_weight_tilt; // >0 weight of pairs errors in qn1, qn2
double weight_scale = clt_parameters.imp.alt_weight_scale; // >0 weight in pairs scale-1.0 errors
double pull = clt_parameters.imp.alt_pull; // 0 <= pull <1 - fraction of all RMS contributors
double pull_rots = clt_parameters.imp.alt_pull_rots; // >=0 weight of sum of rotations, may be 0, normalized by pull value
double pull_tilts = clt_parameters.imp.alt_pull_tilts; // >=0 weights of sum of qn1 and qn2 of scenes, normalized by pull value
double pull_scales = clt_parameters.imp.alt_pull_scales; // >=0 weights of scales of scenes, normalized by pull value
// log/save parameters // log/save parameters
boolean save_each = clt_parameters.imp.pwise_save_each; // save state file after each match boolean save_each = clt_parameters.imp.pwise_save_each; // save state file after each match
boolean log_append = clt_parameters.imp.pwise_log_append; // boolean log_append = clt_parameters.imp.pwise_log_append; //
...@@ -6519,13 +6527,19 @@ public class OrthoMapsCollection implements Serializable{ ...@@ -6519,13 +6527,19 @@ public class OrthoMapsCollection implements Serializable{
alt_outliers, // double alt_outliers, // 0.05; Remove outliers when fitting planes, removed fraction. alt_outliers, // double alt_outliers, // 0.05; Remove outliers when fitting planes, removed fraction.
alt_refine, // int alt_refine, // 1; Refine altitude difference plane after removing outliers (0 - no outlier removal, 1 - remove outliers and refine once, ...) alt_refine, // int alt_refine, // 1; Refine altitude difference plane after removing outliers (0 - no outlier removal, 1 - remove outliers and refine once, ...)
metric_err, // double metric_error, metric_err, // double metric_error,
weight_rot, // double weight_rot, // >0 weight of pairs errors in qn3
weight_tilt, // double weight_tilt, // >0 weight of pairs errors in qn1, qn2
weight_scale, // double weight_scale, // >0 weight in pairs scale-1.0 errors
pull, // double pull, // 0 <= pull <1 - fraction of all RMS contributors
pull_rots, // double pull_rots, // >=0 weight of sum of rotations, may be 0, normalized by pull value
pull_tilts, // double pull_tilts, // >=0 weights of sum of qn1 and qn2 of scenes, normalized by pull value
pull_scales, // double pull_scales, // >=0 weights of scales of scenes, normalized by pull value
// log/save parameters // log/save parameters
save_each, // boolean save_each, save_each, // boolean save_each,
log_append, // boolean log_append, log_append, // boolean log_append,
log_path, // String log_path, log_path, // String log_path,
orthoMapsCollection_path, // String orthoMapsCollection_path, orthoMapsCollection_path, // String orthoMapsCollection_path,
debugLevel); // int debugLevel) debugLevel); // int debugLevel)
} }
public boolean displayScenePairs( public boolean displayScenePairs(
......
...@@ -67,8 +67,127 @@ public final class QuatUtils { // static class ...@@ -67,8 +67,127 @@ public final class QuatUtils { // static class
r[0]*s[3] - r[1]*s[2] + r[2]*s[1] + r[3]*s[0]}; r[0]*s[3] - r[1]*s[2] + r[2]*s[1] + r[3]*s[0]};
return t; return t;
} }
/**
* Differential d_(p*q)/dp
* https://faculty.sites.iastate.edu/jia/files/inline-files/quaternion.pdf
* @param p quaternion
* @param q quaternion
* @return matrix[4][4], where rows correspond to elements of quaternion (p*q), and columns - indices of p,
* so this matrix when multiplied by a column vector dp results in column vector d(pq)
*/
public static double [][] d_pq_dp(
double [] p,
double [] q) {
return new double[][] {
{q[0],-q[1],-q[2], -q[3]},
{q[1], q[0], q[3], -q[2]},
{q[2],-q[3], q[0], q[1]},
{q[3], q[2],-q[1], q[0]}
};
}
public static double [] multiplyScaled( /**
* Differential d_(p*q)/dq
* https://faculty.sites.iastate.edu/jia/files/inline-files/quaternion.pdf
* @param p quaternion
* @param q quaternion
* @return matrix[4][4], where rows correspond to elements of quaternion (p*q), and columns - indices of q,
* so this matrix when multiplied by a column vector dq results in column vector d(pq)
*/
public static double [][] d_pq_dq(
double [] p,
double [] q) {
return new double[][] {
{p[0],-p[1],-p[2], -p[3]},
{p[1], p[0],-p[3], p[2]},
{p[2], p[3], p[0], -p[1]},
{p[3],-p[2], p[1], p[0]}
};
}
/**
* Derivative of inverse quanternion
* @param q quternion
* @return derivative as 4x4 array
*/
public static double [][] d_invert_dq (
double [] q){
double q0= q[0],q1=q[1],q2=q[2],q3=q[3];
double l2 =q0*q0+q1*q1+q2*q2+q3*q3;
double l2l2=l2*l2;
return new double[][] {
{ (l2 - 2*q0*q0)/l2l2, -2*q0*q1/l2l2, -2*q0*q2/l2l2, -2*q0*q3/l2l2},
{ 2*q1*q0/ l2l2, (2*q1*q1 - l2)/l2l2, 2*q1*q2/l2l2, 2*q1*q3/l2l2},
{ 2*q2*q0/ l2l2, 2*q2*q1/l2l2, (2*q2*q2 - l2)/l2l2, 2*q2*q3/l2l2},
{ 2*q3*q0/ l2l2, 2*q3*q1/l2l2, 2*q3*q2/l2l2, (2*q3*q3 - l2)/l2l2},
};
}
public static double [][] dnormalize_dq(
double [] q){
double q0= q[0],q1=q[1],q2=q[2],q3=q[3];
double l2 =q0*q0+q1*q1+q2*q2+q3*q3;
double l3=l2*Math.sqrt(l2);
return new double[][] {
{(l2 - q0*q0)/l3, -q0*q1 /l3, -q0*q2 /l3, -q0*q3 /l3},
{ -q1*q0 /l3, (l2 - q1*q1)/l3, -q1*q2 /l3, -q1*q3 /l3},
{ -q2*q0 /l3, -q2*q1 /l3, (l2 - q2*q2)/l3, -q2*q3 /l3},
{ -q3*q0 /l3, -q3*q1 /l3, -q3*q2 /l3, (l2 - q3*q3)/l3}
};
}
public static double [] dscale_dq(
double [] q){
double q0= q[0],q1=q[1],q2=q[2],q3=q[3];
double l = Math.sqrt(q0*q0+q1*q1+q2*q2+q3*q3);
return new double [] {q0/l, q1/l, q2/l,q3/l};
}
/**
* Differential d_(p*q'))/dp (q' - q-conjugated)
* https://faculty.sites.iastate.edu/jia/files/inline-files/quaternion.pdf
* @param p quaternion
* @param q quaternion
* @return matrix[4][4], where rows correspond to elements of quaternion (p*q), and columns - indices of p,
* so this matrix when multiplied by a column vector dp results in column vector d(pq')
*/
/*
public static double [][] d_pqc_dp(
double [] p,
double [] q) {
return new double[][] {
{ q[0], q[1], q[2], q[3]},
{-q[1], q[0],-q[3], q[2]},
{-q[2], q[3], q[0], -q[1]},
{-q[3],-q[2], q[1], q[0]}
};
}
*/
/**
* Differential d_(p*q')/dq (q' - q-conjugated)
* https://faculty.sites.iastate.edu/jia/files/inline-files/quaternion.pdf
* @param p quaternion
* @param q quaternion
* @return matrix[4][4], where rows correspond to elements of quaternion (p*q), and columns - indices of q,
* so this matrix when multiplied by a column vector dq results in column vector d(pq)
*/
/*
public static double [][] d_pqc_dq(
double [] p,
double [] q) {
return new double[][] {
{p[0], p[1], p[2], p[3]},
{p[1],-p[0], p[3], -p[2]},
{p[2],-p[3],-p[0], p[1]},
{p[3], p[2],-p[1], -p[0]}
};
}
*/
public static double [] multiplyScaled( // Not needed, same result as multiply()
double [] r, double [] r,
double [] s ) { double [] s ) {
return scale(multiply(normalize(r),normalize(s)),norm(r)*norm(s)); return scale(multiply(normalize(r),normalize(s)),norm(r)*norm(s));
...@@ -79,6 +198,7 @@ public final class QuatUtils { // static class ...@@ -79,6 +198,7 @@ public final class QuatUtils { // static class
} }
public static double [] divide( // pure rotation public static double [] divide( // pure rotation
double [] r, double [] r,
double [] s ) { double [] s ) {
...@@ -296,11 +416,19 @@ public final class QuatUtils { // static class ...@@ -296,11 +416,19 @@ public final class QuatUtils { // static class
double [] quat) { double [] quat) {
return Math.sqrt(quat[0]*quat[0]+quat[1]*quat[1]+quat[2]*quat[2]+quat[3]*quat[3]); return Math.sqrt(quat[0]*quat[0]+quat[1]*quat[1]+quat[2]*quat[2]+quat[3]*quat[3]);
} }
public static double [] invert( public static double [] invert0(
double [] quat) { double [] quat) {
return new double [] {quat[0], -quat[1], -quat[2], -quat[3]}; return new double [] {quat[0], -quat[1], -quat[2], -quat[3]};
} }
public static double [] invert( // make sure did not break anything
double [] quat) {
double s2 = quat[0]*quat[0]+quat[1]*quat[1]+quat[2]*quat[2]+quat[3]*quat[3];
return scale(new double [] {quat[0], -quat[1], -quat[2], -quat[3]},1/s2);
}
public static double [] normalize( public static double [] normalize(
double [] quat) { double [] quat) {
// double k = 1/norm(quat); // double k = 1/norm(quat);
......
...@@ -175,6 +175,13 @@ public class IntersceneMatchParameters { ...@@ -175,6 +175,13 @@ public class IntersceneMatchParameters {
public double alt_outliers = 0.1; // remove outliers when fitting planes public double alt_outliers = 0.1; // remove outliers when fitting planes
public int alt_refine= 1; // refine plane after removing outliers (0 - no outlier removal, 1 - remove outliers and refine once, ...) public int alt_refine= 1; // refine plane after removing outliers (0 - no outlier removal, 1 - remove outliers and refine once, ...)
public double alt_weight_rot = 1.0; // >0 weight of pairs errors in qn3
public double alt_weight_tilt = 0.3; // >0 weight of pairs errors in qn1, qn2
public double alt_weight_scale = 0.1; // >0 weight in pairs scale-1.0 errors
public double alt_pull = 0.2; // 0 <= pull <1 - fraction of all RMS contributors
public double alt_pull_rots = 1.0; // >=0 weight of sum of rotations, may be 0, normalized by pull value
public double alt_pull_tilts = 0.3; // >=0 weights of sum of qn1 and qn2 of scenes, normalized by pull value
public double alt_pull_scales = 0.1; // >=0 weights of scales of scenes, normalized by pull value
public boolean pmap_move_only = false; public boolean pmap_move_only = false;
public boolean pmap_ignore_affines = false; public boolean pmap_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.");
...@@ -1935,6 +1951,14 @@ min_str_neib_fpn 0.35 ...@@ -1935,6 +1951,14 @@ min_str_neib_fpn 0.35
this.alt_outliers = gd.getNextNumber(); this.alt_outliers = gd.getNextNumber();
this.alt_refine = (int) gd.getNextNumber(); this.alt_refine = (int) gd.getNextNumber();
this.alt_weight_rot = gd.getNextNumber();
this.alt_weight_tilt = gd.getNextNumber();
this.alt_weight_scale = gd.getNextNumber();
this.alt_pull = gd.getNextNumber();
this.alt_pull_rots = gd.getNextNumber();
this.alt_pull_tilts = gd.getNextNumber();
this.alt_pull_scales = gd.getNextNumber();
this.pmap_move_only = gd.getNextBoolean(); this.pmap_move_only = gd.getNextBoolean();
this.pmap_ignore_affines = gd.getNextBoolean(); this.pmap_ignore_affines = gd.getNextBoolean();
this.pmap_use_inv = gd.getNextBoolean(); this.pmap_use_inv = gd.getNextBoolean();
...@@ -2529,6 +2553,14 @@ min_str_neib_fpn 0.35 ...@@ -2529,6 +2553,14 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"alt_outliers", this.alt_outliers + ""); // double properties.setProperty(prefix+"alt_outliers", this.alt_outliers + ""); // double
properties.setProperty(prefix+"alt_refine", this.alt_refine + ""); // int properties.setProperty(prefix+"alt_refine", this.alt_refine + ""); // int
properties.setProperty(prefix+"alt_weight_rot", this.alt_weight_rot + ""); // double
properties.setProperty(prefix+"alt_weight_tilt", this.alt_weight_tilt + ""); // double
properties.setProperty(prefix+"alt_weight_scale", this.alt_weight_scale + ""); // double
properties.setProperty(prefix+"alt_pull", this.alt_pull + ""); // double
properties.setProperty(prefix+"alt_pull_rots", this.alt_pull_rots + ""); // double
properties.setProperty(prefix+"alt_pull_tilts ", this.alt_pull_tilts + ""); // double
properties.setProperty(prefix+"alt_pull_scales", this.alt_pull_scales + ""); // double
properties.setProperty(prefix+"pmap_move_only", this.pmap_move_only + ""); // boolean properties.setProperty(prefix+"pmap_move_only", this.pmap_move_only + ""); // boolean
properties.setProperty(prefix+"pmap_ignore_affines", this.pmap_ignore_affines + ""); // boolean properties.setProperty(prefix+"pmap_ignore_affines", this.pmap_ignore_affines + ""); // boolean
properties.setProperty(prefix+"pmap_use_inv", this.pmap_use_inv + ""); // boolean properties.setProperty(prefix+"pmap_use_inv", this.pmap_use_inv + ""); // boolean
...@@ -3088,6 +3120,14 @@ min_str_neib_fpn 0.35 ...@@ -3088,6 +3120,14 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"alt_outliers")!=null) this.alt_outliers=Double.parseDouble(properties.getProperty(prefix+ "alt_outliers")); if (properties.getProperty(prefix+"alt_outliers")!=null) this.alt_outliers=Double.parseDouble(properties.getProperty(prefix+ "alt_outliers"));
if (properties.getProperty(prefix+"alt_refine")!=null) this.alt_refine=Integer.parseInt(properties.getProperty(prefix+ "alt_refine")); if (properties.getProperty(prefix+"alt_refine")!=null) this.alt_refine=Integer.parseInt(properties.getProperty(prefix+ "alt_refine"));
if (properties.getProperty(prefix+"alt_weight_rot")!=null) this.alt_weight_rot=Double.parseDouble(properties.getProperty(prefix+ "alt_weight_rot"));
if (properties.getProperty(prefix+"alt_weight_tilt")!=null) this.alt_weight_tilt=Double.parseDouble(properties.getProperty(prefix+ "alt_weight_tilt"));
if (properties.getProperty(prefix+"alt_weight_scale")!=null) this.alt_weight_scale=Double.parseDouble(properties.getProperty(prefix+ "alt_weight_scale"));
if (properties.getProperty(prefix+"alt_pull")!=null) this.alt_pull=Double.parseDouble(properties.getProperty(prefix+ "alt_pull"));
if (properties.getProperty(prefix+"alt_pull_rots")!=null) this.alt_pull_rots=Double.parseDouble(properties.getProperty(prefix+ "alt_pull_rots"));
if (properties.getProperty(prefix+"alt_pull_tilts ")!=null) this.alt_pull_tilts =Double.parseDouble(properties.getProperty(prefix+ "alt_pull_tilts "));
if (properties.getProperty(prefix+"alt_pull_scales")!=null) this.alt_pull_scales=Double.parseDouble(properties.getProperty(prefix+ "alt_pull_scales"));
if (properties.getProperty(prefix+"pmap_move_only")!=null) this.pmap_move_only=Boolean.parseBoolean(properties.getProperty(prefix+ "pmap_move_only")); if (properties.getProperty(prefix+"pmap_move_only")!=null) this.pmap_move_only=Boolean.parseBoolean(properties.getProperty(prefix+ "pmap_move_only"));
if (properties.getProperty(prefix+"pmap_ignore_affines")!=null)this.pmap_ignore_affines=Boolean.parseBoolean(properties.getProperty(prefix+"pmap_ignore_affines")); if (properties.getProperty(prefix+"pmap_ignore_affines")!=null)this.pmap_ignore_affines=Boolean.parseBoolean(properties.getProperty(prefix+"pmap_ignore_affines"));
if (properties.getProperty(prefix+"pmap_use_inv")!=null) this.pmap_use_inv=Boolean.parseBoolean(properties.getProperty(prefix+ "pmap_use_inv")); if (properties.getProperty(prefix+"pmap_use_inv")!=null) this.pmap_use_inv=Boolean.parseBoolean(properties.getProperty(prefix+ "pmap_use_inv"));
...@@ -3668,6 +3708,14 @@ min_str_neib_fpn 0.35 ...@@ -3668,6 +3708,14 @@ min_str_neib_fpn 0.35
imp.alt_outliers = this.alt_outliers; imp.alt_outliers = this.alt_outliers;
imp.alt_refine = this.alt_refine; imp.alt_refine = this.alt_refine;
imp.alt_weight_rot = this.alt_weight_rot;
imp.alt_weight_tilt = this.alt_weight_tilt;
imp.alt_weight_scale = this.alt_weight_scale;
imp.alt_pull = this.alt_pull;
imp.alt_pull_rots = this.alt_pull_rots;
imp.alt_pull_tilts = this.alt_pull_tilts ;
imp.alt_pull_scales = this.alt_pull_scales;
imp.pmap_move_only = this.pmap_move_only; imp.pmap_move_only = this.pmap_move_only;
imp.pmap_ignore_affines = this.pmap_ignore_affines; imp.pmap_ignore_affines = this.pmap_ignore_affines;
imp.pmap_use_inv = this.pmap_use_inv; imp.pmap_use_inv = this.pmap_use_inv;
......
...@@ -2240,7 +2240,7 @@ public class QuaternionLma { ...@@ -2240,7 +2240,7 @@ public class QuaternionLma {
* (samples in LMA) and rows - to the second quaternion * (samples in LMA) and rows - to the second quaternion
* (missing from the input) components. * (missing from the input) components.
*/ */
public static double [][] composeDQ( public static double [][] composeDQ( // not used
double [] r) { double [] r) {
/* /*
return new double [][] { return new double [][] {
...@@ -2269,7 +2269,7 @@ public class QuaternionLma { ...@@ -2269,7 +2269,7 @@ public class QuaternionLma {
* (samples in LMA) and rows - to the source quaternion * (samples in LMA) and rows - to the source quaternion
* (missing from the input) components. * (missing from the input) components.
*/ */
public static double [][] composeDR( // not used public static double [][] composeDR(
double [] q) { double [] q) {
return new double [][] { return new double [][] {
{ q[0], -q[1], -q[2], -q[3]}, { q[0], -q[1], -q[2], -q[3]},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment