Commit 89fbf5c2 authored by Andrey Filippov's avatar Andrey Filippov

cleaning up, adding parameters for different debug modes

parent decd04ed
...@@ -266,24 +266,28 @@ public class IntersceneLma { ...@@ -266,24 +266,28 @@ public class IntersceneLma {
} }
if (rslt[0]) { // better if (rslt[0]) { // better
if (iter >= num_iter) { // better, but num tries exceeded if (iter >= num_iter) { // better, but num tries exceeded
if (debug_level > 0) System.out.println("Step "+iter+": Improved, but number of steps exceeded maximal"); if (debug_level > 1) System.out.println("Step "+iter+": Improved, but number of steps exceeded maximal");
} else { } else {
if (debug_level > 0) System.out.println("Step "+iter+": LMA: Success"); if (debug_level > 1) System.out.println("Step "+iter+": LMA: Success");
} }
} else { // improved over initial ? } else { // improved over initial ?
if (last_rms[0] < initial_rms[0]) { // NaN if (last_rms[0] < initial_rms[0]) { // NaN
rslt[0] = true; rslt[0] = true;
if (debug_level > 0) System.out.println("Step "+iter+": Failed to converge, but result improved over initial"); if (debug_level > 1) System.out.println("Step "+iter+": Failed to converge, but result improved over initial");
} else { } else {
if (debug_level > 0) System.out.println("Step "+iter+": Failed to converge"); if (debug_level > 1) System.out.println("Step "+iter+": Failed to converge");
} }
} }
if (debug_level > 0) { boolean show_intermediate = true;
if (show_intermediate && (debug_level > 0)) {
System.out.println("LMA: full RMS="+last_rms[0]+" ("+initial_rms[0]+"), pure RMS="+last_rms[1]+" ("+initial_rms[1]+") + lambda="+lambda); System.out.println("LMA: full RMS="+last_rms[0]+" ("+initial_rms[0]+"), pure RMS="+last_rms[1]+" ("+initial_rms[1]+") + lambda="+lambda);
} }
if (debug_level > 0) { if (debug_level > 0) {
if ((debug_level > 1) || (iter == 1) || last_run) { if ((debug_level > 1) || (iter == 1) || last_run) {
if (!show_intermediate) {
System.out.println("LMA: full RMS="+last_rms[0]+" ("+initial_rms[0]+"), pure RMS="+last_rms[1]+" ("+initial_rms[1]+") + lambda="+lambda);
}
String [] lines = printOldNew(false); // boolean allvectors) String [] lines = printOldNew(false); // boolean allvectors)
for (String line : lines) { for (String line : lines) {
System.out.println(line); System.out.println(line);
......
...@@ -581,7 +581,7 @@ public class OpticalFlow { ...@@ -581,7 +581,7 @@ public class OpticalFlow {
final int debug_level, //1 final int debug_level, //1
final boolean enable_debug_images) // true final boolean enable_debug_images) // true
{ {
boolean debug_mismatch = (debug_level > -10); // true; boolean debug_mismatch = (debug_level > -10); // && enable_debug_images);
// int debug_corr2d = 0;// 10 // int debug_corr2d = 0;// 10
final TileProcessor tp = reference_QuadClt.getTileProcessor(); final TileProcessor tp = reference_QuadClt.getTileProcessor();
...@@ -3602,8 +3602,7 @@ public class OpticalFlow { ...@@ -3602,8 +3602,7 @@ public class OpticalFlow {
int debug_level int debug_level
) )
{ {
boolean show_results = true; boolean show_results = clt_parameters.ilp.ilma_debug_adjust_series;
if (ref_index < 0) { if (ref_index < 0) {
ref_index += scenes.length; ref_index += scenes.length;
} }
...@@ -8428,6 +8427,8 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad ...@@ -8428,6 +8427,8 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
double [][] flowXY = new double [macroTiles][2]; // zero pre-shifts double [][] flowXY = new double [macroTiles][2]; // zero pre-shifts
// double [][] flowXY_frac = new double [macroTiles][]; // Will contain fractional X/Y shift for CLT // double [][] flowXY_frac = new double [macroTiles][]; // Will contain fractional X/Y shift for CLT
double [][] reference_tiles_macro = new double [macroTiles][]; double [][] reference_tiles_macro = new double [macroTiles][];
// hack below to pass nlma for debugging. Change clt_parameters.ilp.ilma_num_corr to -11 after first pass
int test_debug_level = clt_parameters.ilp.ilma_debug_invariant? (clt_parameters.ofp.debug_level_iterate-nlma): -11;
double [][] vector_XYS = correlate2DIterate( // returns optical flow and confidence double [][] vector_XYS = correlate2DIterate( // returns optical flow and confidence
clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params,
// for prepareSceneTiles() // for prepareSceneTiles()
...@@ -8460,7 +8461,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad ...@@ -8460,7 +8461,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
clt_parameters.ofp.min_change, // final double min_change, clt_parameters.ofp.min_change, // final double min_change,
clt_parameters.ofp.best_neibs_num, // final int best_num, clt_parameters.ofp.best_neibs_num, // final int best_num,
clt_parameters.ofp.ref_stdev, // final double ref_stdev, clt_parameters.ofp.ref_stdev, // final double ref_stdev,
clt_parameters.ofp.debug_level_iterate-nlma, // final int debug_level) test_debug_level, // clt_parameters.ofp.debug_level_iterate-nlma, // final int debug_level)
clt_parameters.ofp.enable_debug_images); //final boolean enable_debug_images) clt_parameters.ofp.enable_debug_images); //final boolean enable_debug_images)
if (dbg_img != null) { if (dbg_img != null) {
for (int iy = 0; iy < macroTilesY; iy++) { for (int iy = 0; iy < macroTilesY; iy++) {
...@@ -8505,7 +8506,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad ...@@ -8505,7 +8506,7 @@ public double[][] correlateIntersceneDebug( // only uses GPU and quad
} }
} }
if (dbg_img != null) { if (clt_parameters.ilp.ilma_debug_invariant) { // dbg_img != null) {
/* /*
long [] long_xyz0 = new long [camera_xyz0.length]; long [] long_xyz0 = new long [camera_xyz0.length];
long [] long_atr0 = new long [camera_atr0.length]; long [] long_atr0 = new long [camera_atr0.length];
......
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