Commit 58388314 authored by Andrey Filippov's avatar Andrey Filippov

testing multi-target (per tile) mode

parent d6e178fd
......@@ -560,6 +560,27 @@ import ij.process.ImageProcessor;
return null;
}
public static ImagePlus makeArrays(int[][] pixels, int width, int height, String title, String [] titles) {
int i,j;
if (pixels==null) {
System.out.println("showDoubleFloatArrays.makeArrays(): - pixel array is null");
}
float [] fpixels;
ImageStack array_stack=new ImageStack(width,height);
boolean not_empty = false;
for (i=0;i<pixels.length;i++) if (pixels[i]!=null) {
not_empty = true;
fpixels=new float[pixels[i].length];
for (j=0;j<fpixels.length;j++) fpixels[j]=pixels[i][j];
array_stack.addSlice(titles[i], fpixels);
}
if (not_empty) {
ImagePlus imp_stack = new ImagePlus(title, array_stack);
imp_stack.getProcessor().resetMinAndMax();
return imp_stack;
}
return null;
}
public static ImagePlus makeArrays(double[][] pixels, int width, int height, String title, String [] titles) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -47,48 +47,50 @@ public class CuasMotionLMA {
public static final int RSLT_RMS_A = 8;
public static final int RSLT_MAX2A = 9;
public static final int RSLT_ITERS = 10;
public static final int RSLT_CENT_X = 11;
public static final int RSLT_CENT_Y = 12;
public static final int RSLT_CENT_MX= 13;
public static final int RSLT_CENT_F = 14;
public static final int RSLT_VX = 15;
public static final int RSLT_VY = 16;
public static final int RSLT_VSTR = 17;
public static final int RSLT_VFRAC = 18;
public static final int RSLT_BX = 19;
public static final int RSLT_BY = 20; // RSLT_BX+1;
public static final int RSLT_AX = 21; // RSLT_BX+2;
public static final int RSLT_AY = 22; // RSLT_BX+3;
public static final int RSLT_MISMATCH_BEFORE = 23;
public static final int RSLT_MISMATCH_AFTER = 24; // RSLT_MISMATCH_BEFORE+1;
public static final int RSLT_MISMATCH_DIRS= 25;
public static final int RSLT_MSCORE = 26;
public static final int RSLT_QA = 27;
public static final int RSLT_QRMS = 28;
public static final int RSLT_QRMS_A = 29;
public static final int RSLT_QMATCH = 30;
public static final int RSLT_QCENTER = 31;
public static final int RSLT_QSCORE = 32;
public static final int RSLT_STRONGER =33; // index of stronger neighbor (may be more)
public static final int RSLT_CENTERED=11; //1: this target was evaluated in centered mode, 0 - was in non-centered, -1 - consumed in non-centered
public static final int RSLT_CENT_X = 12;
public static final int RSLT_CENT_Y = 13;
public static final int RSLT_CENT_MX= 14;
public static final int RSLT_CENT_F = 15;
public static final int RSLT_VX = 16;
public static final int RSLT_VY = 17;
public static final int RSLT_VSTR = 18;
public static final int RSLT_VFRAC = 19;
public static final int RSLT_BX = 20;
public static final int RSLT_BY = 21; // RSLT_BX+1;
public static final int RSLT_AX = 22; // RSLT_BX+2;
public static final int RSLT_AY = 23; // RSLT_BX+3;
public static final int RSLT_MISMATCH_BEFORE = 24;
public static final int RSLT_MISMATCH_AFTER = 25; // RSLT_MISMATCH_BEFORE+1;
public static final int RSLT_MISMATCH_DIRS= 26;
public static final int RSLT_MATCH_LENGTH= 27; // [RSLT_MATCH_LENGTH] is one less than the total length (0 - isolated)
public static final int RSLT_MSCORE = 28;
public static final int RSLT_WHEN = 34;
public static final int RSLT_FAIL = 35;
public static final int RSLT_QA = 29;
public static final int RSLT_QRMS = 30;
public static final int RSLT_QRMS_A = 31;
public static final int RSLT_QCENTER = 32;
public static final int RSLT_QMATCH = 33;
public static final int RSLT_QMATCH_LEN=34;
public static final int RSLT_QSCORE = 35;
public static final int RSLT_STRONGER =36; // index of stronger neighbor (may be more)
public static final int RSLT_WHEN = 37;
public static final int RSLT_FAIL = 38;
public static final int RSLT_LEN = RSLT_FAIL+1;
public static final String [] LMA_TITLES =
{"X-OFFS","Y-OFFS", "AMPLITUDE", "RADIUS","RAD_POS", "OVERSHOOT","OFFSET","RMSE","RMSE/A","MAX2A","ITERATIONS",
"CENTERED",
"Centr-X","Centr-Y","Centr-max","Centr-frac",
"Vx", "Vy", "V-conf","V-frac", // from motion vectors
"X-before", "Y-before","X-after","Y-after", // from getHalfBeforeAfterPixXY()
"ERR-BEFORE", "ERR-AFTER", "BA-DIRS", // before dir + 16*after dir
"ERR-BEFORE", "ERR-AFTER", "BA-DIRS", "Match-length", // before dir + 16*after dir
"*MOTION-SCORE",
"*Q-AMPL","*Q-RMSE","*Q-RMSE/A","*Q-MATCH","*Q-CENTER","*Q-SCORE",
"*Q-AMPL","*Q-RMSE","*Q-RMSE/A","*Q-CENTER","*Q-MATCH","*Q-LENGTH","*Q-SCORE",
"Stronger",
"WHEN", "FAILURE"};
......@@ -98,18 +100,24 @@ public class CuasMotionLMA {
public static final int FAIL_CENT_STR = 3; // centroid amplitude is too low
public static final int FAIL_CENT_FRAC = 4; // centroid fraction (energy in the peak fraction of all) is too low
public static final int FAIL_LMA = 5; // LMA fail to converge
public static final int FAIL_A_LOW = 6; // amplitude is too low
public static final int FAIL_ACENT = 7; // ratio of maximal pixel to amplitude is too low
public static final int FAIL_RMSE = 8; // RMSE is too high
public static final int FAIL_RMSE_R = 9; // BOTH RMSE is not sufficient and RMSE/A is too high
public static final int FAIL_R0_HIGH = 10; // Full radius (including negative overshoot) is too high
public static final int FAIL_R1_LOW = 11; // Inner (positive) peak radius is too low
public static final int FAIL_K_LOW = 12; // Overshoot is too low (not used, it can be down to 0)
public static final int FAIL_K_HIGH = 13; // Overshoot is too high
public static final int FAIL_FAR = 14; // Peak is too far from the center
public static final int FAIL_HORIZON = 15; // Peak is below horizon
public static final int FAIL_MISMATCH = 16; // Mismatch on both ends is too high
public static final int FAIL_NEIGHBOR = 17; // failed because some neighbor is stronger
public static final int FAIL_A_PRE = 6; // amplitude is too low at preliminary filter (just after LMA)
public static final int FAIL_A_LOW = 7; // amplitude is too low
public static final int FAIL_ACENT = 8; // ratio of maximal pixel to amplitude is too low
public static final int FAIL_RMSE = 9; // RMSE is too high
public static final int FAIL_RMSE_R = 10; // BOTH RMSE is not sufficient and RMSE/A is too high
public static final int FAIL_R0_HIGH = 11; // Full radius (including negative overshoot) is too high
public static final int FAIL_R1_LOW = 12; // Inner (positive) peak radius is too low
public static final int FAIL_K_LOW = 13; // Overshoot is too low (not used, it can be down to 0)
public static final int FAIL_K_HIGH = 14; // Overshoot is too high
public static final int FAIL_FAR = 15; // Peak is too far from the center
public static final int FAIL_HORIZON = 16; // Peak is below horizon
public static final int FAIL_MISMATCH = 17; // Mismatch on both ends is too high
public static final int FAIL_NEIGHBOR = 18; // failed because some neighbor is stronger
public static final int FAIL_DUPLICATE= 19; // coordinate are (almost) the same as those of a stronger tile
public static final int CENTERED_NO = 0;
public static final int CENTERED_YES = 1;
public static final int CENTERED_USED= -1;
private int width;
private double [][] window;
......@@ -332,6 +340,9 @@ public class CuasMotionLMA {
double lambda_max, // 100
double rms_diff, // 0.001
int num_iter, // 20
int dbg_seq,
int dbg_tile,
int dbg_index,
int debug_level)
{
boolean last_run = true;
......@@ -409,13 +420,13 @@ public class CuasMotionLMA {
}
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("LMA failed on iteration = "+iter+ ", nSeq="+dbg_seq+", ntile="+dbg_tile+((dbg_index>=0)?(", index="+dbg_index):""));
// String [] lines = printOldNew(true); // boolean allvectors)
// for (String line : lines) {
// System.out.println(line);
// }
}
System.out.println();
// System.out.println();
}
// No need to updateFullParameters() in this implementation - they are already updated
/*
......
......@@ -5882,6 +5882,15 @@ if (debugLevel < -100) {
UasLogReader uasLogReader,
String [] scene_titles, // recreate slice_titles from scene titles?
final int debugLevel) {
CuasMotion.processMovingTargetsMulti(
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // final boolean batch_mode,
this, // QuadCLT parentCLT, //
fpixels, // final float [][] fpixels,
uasLogReader, // UasLogReader uasLogReader,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
debugLevel); // final int debugLevel)
/*
CuasMotion.processMovingTargets(
clt_parameters, // CLTParameters clt_parameters,
batch_mode, // final boolean batch_mode,
......@@ -5890,6 +5899,7 @@ if (debugLevel < -100) {
uasLogReader, // UasLogReader uasLogReader,
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
debugLevel); // final int debugLevel)
*/
}
}
......@@ -5034,9 +5034,7 @@ public class QuadCLTCPU {
System.out.println("Configuration parameters are saved to " + save_path);
return;
}
}
}
return;
}
......
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