Commit 4342fd2a authored by Andrey Filippov's avatar Andrey Filippov

more working code for moving targets

parent da579ebb
...@@ -700,7 +700,7 @@ min_str_neib_fpn 0.35 ...@@ -700,7 +700,7 @@ min_str_neib_fpn 0.35
public double cuas_reliable_str = 0.8; // use for relaible tiles if INTER-INTRA-LMA is available, not just DSI_MAIN public double cuas_reliable_str = 0.8; // use for relaible tiles if INTER-INTRA-LMA is available, not just DSI_MAIN
public double cuas_fat_zero = 1000.0; // phase correlation fat zero public double cuas_fat_zero = 1000.0; // phase correlation fat zero
public double cuas_cent_radius = 4.0; // centroids center radius public double cuas_cent_radius = 3.0; // centroids center radius
public int cuas_n_recenter = 2; // when cosine window, re-center window these many times public int cuas_n_recenter = 2; // when cosine window, re-center window these many times
public double cuas_rstr = 0.001; // minimal phase correlation maximums relative to max str public double cuas_rstr = 0.001; // minimal phase correlation maximums relative to max str
public boolean cuas_smooth = true; // used cosine window when averaging correlations public boolean cuas_smooth = true; // used cosine window when averaging correlations
...@@ -712,7 +712,12 @@ min_str_neib_fpn 0.35 ...@@ -712,7 +712,12 @@ min_str_neib_fpn 0.35
public double cuas_speed_min = 0.2; // minimal pixels per range (per cuas_corr_offset) public double cuas_speed_min = 0.2; // minimal pixels per range (per cuas_corr_offset)
public double cuas_speed_pref = 0.5; // preferable speed (boost weights for faster targets) public double cuas_speed_pref = 0.5; // preferable speed (boost weights for faster targets)
public double cuas_speed_boost = 2.5; // speed boost limit public double cuas_speed_boost = 2.5; // speed boost limit
// target filtering after constant velocity accumulation
public double cuas_target_radius = 3.0; // target centroids center radius
public double cuas_target_strength =0.8; // target centroids center radius
public double [][] cuas_target_frac = {{0,0.15},{2,0.3},{5,0.4}};
public boolean cuas_debug = false; // save debug images (and show them if not in batch mode) public boolean cuas_debug = false; // save debug images (and show them if not in batch mode)
public boolean cuas_step_debug = false; // save debug images during per-step cuas recalculation (and show them if not in batch mode) public boolean cuas_step_debug = false; // save debug images during per-step cuas recalculation (and show them if not in batch mode)
...@@ -2139,12 +2144,19 @@ min_str_neib_fpn 0.35 ...@@ -2139,12 +2144,19 @@ min_str_neib_fpn 0.35
gd.addNumericField("Local max range", this.cuas_max_range, 0,3,"", gd.addNumericField("Local max range", this.cuas_max_range, 0,3,"",
"While filtering local correlation maximums: 1 - 3x3 neighbors, 2 - 5x5 ones."); "While filtering local correlation maximums: 1 - 3x3 neighbors, 2 - 5x5 ones.");
gd.addMessage("=== Moving target filtering ===");
gd.addNumericField("Minimal speed", this.cuas_speed_min, 5,8,"ppr", gd.addNumericField("Minimal speed", this.cuas_speed_min, 5,8,"ppr",
"Minimal target speed in pixels per range (per cuas_corr_offset)."); "Minimal target speed in pixels per range (per cuas_corr_offset).");
gd.addNumericField("Preferable speed", this.cuas_speed_pref, 5,8,"ppr", gd.addNumericField("Preferable speed", this.cuas_speed_pref, 5,8,"ppr",
"Boost effective strength when speed is above this."); "Boost effective strength when speed is above this.");
gd.addNumericField("Maximal speed boost", this.cuas_speed_boost, 5,8,"", gd.addNumericField("Maximal speed boost", this.cuas_speed_boost, 5,8,"",
"Maximal speed-caused effective strength boost."); "Maximal speed-caused effective strength boost.");
gd.addNumericField("Target radius", this.cuas_target_radius, 5,8,"pix",
"Target radius, also used to calculate fraction of totals inside (windowed) to all positive values.");
gd.addNumericField("Minimal target strength", this.cuas_target_strength, 5,8,"",
"Minimal value of the target image.");
gd.addStringField ("Fraction for strengths", double2dToString(this.cuas_target_frac), 100,
"Variable number of (strength, fraction) pairs separated by \":\". Each pair of strength, minimal fraction is separated by \",\".");
gd.addMessage("=== Debug ==="); gd.addMessage("=== Debug ===");
gd.addCheckbox ("Save/show debug images", this.cuas_debug, gd.addCheckbox ("Save/show debug images", this.cuas_debug,
...@@ -3110,6 +3122,10 @@ min_str_neib_fpn 0.35 ...@@ -3110,6 +3122,10 @@ min_str_neib_fpn 0.35
this.cuas_speed_pref = gd.getNextNumber(); this.cuas_speed_pref = gd.getNextNumber();
this.cuas_speed_boost = gd.getNextNumber(); this.cuas_speed_boost = gd.getNextNumber();
this.cuas_target_radius = gd.getNextNumber();
this.cuas_target_strength = gd.getNextNumber();
this.cuas_target_frac = stringToDouble2d(gd.getNextString());
this.cuas_debug = gd.getNextBoolean(); this.cuas_debug = gd.getNextBoolean();
this.cuas_step_debug = gd.getNextBoolean(); this.cuas_step_debug = gd.getNextBoolean();
...@@ -3999,6 +4015,10 @@ min_str_neib_fpn 0.35 ...@@ -3999,6 +4015,10 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_speed_pref", this.cuas_speed_pref+""); // double properties.setProperty(prefix+"cuas_speed_pref", this.cuas_speed_pref+""); // double
properties.setProperty(prefix+"cuas_speed_boost", this.cuas_speed_boost+""); // double properties.setProperty(prefix+"cuas_speed_boost", this.cuas_speed_boost+""); // double
properties.setProperty(prefix+"cuas_target_radius", this.cuas_target_radius+""); // double
properties.setProperty(prefix+"cuas_target_strength", this.cuas_target_strength+"");// double
properties.setProperty(prefix+"cuas_target_frac", double2dToString(cuas_target_frac)+""); // double[][]
properties.setProperty(prefix+"cuas_debug", this.cuas_debug+""); // boolean properties.setProperty(prefix+"cuas_debug", this.cuas_debug+""); // boolean
properties.setProperty(prefix+"cuas_step_debug", this.cuas_step_debug+""); // boolean properties.setProperty(prefix+"cuas_step_debug", this.cuas_step_debug+""); // boolean
...@@ -4860,7 +4880,9 @@ min_str_neib_fpn 0.35 ...@@ -4860,7 +4880,9 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_speed_pref")!=null) this.cuas_speed_pref=Double.parseDouble(properties.getProperty(prefix+"cuas_speed_pref")); if (properties.getProperty(prefix+"cuas_speed_pref")!=null) this.cuas_speed_pref=Double.parseDouble(properties.getProperty(prefix+"cuas_speed_pref"));
if (properties.getProperty(prefix+"cuas_speed_boost")!=null) this.cuas_speed_boost=Double.parseDouble(properties.getProperty(prefix+"cuas_speed_boost")); if (properties.getProperty(prefix+"cuas_speed_boost")!=null) this.cuas_speed_boost=Double.parseDouble(properties.getProperty(prefix+"cuas_speed_boost"));
if (properties.getProperty(prefix+"cuas_target_radius")!=null) this.cuas_target_radius=Double.parseDouble(properties.getProperty(prefix+"cuas_target_radius"));
if (properties.getProperty(prefix+"cuas_target_strength")!=null) this.cuas_target_strength=Double.parseDouble(properties.getProperty(prefix+"cuas_target_strength"));
if (properties.getProperty(prefix+"cuas_target_frac")!= null) cuas_target_frac=stringToDouble2d((String) properties.getProperty(prefix+"cuas_target_frac"));
if (properties.getProperty(prefix+"cuas_debug")!=null) this.cuas_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_debug")); if (properties.getProperty(prefix+"cuas_debug")!=null) this.cuas_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_debug"));
if (properties.getProperty(prefix+"cuas_step_debug")!=null) this.cuas_step_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_step_debug")); if (properties.getProperty(prefix+"cuas_step_debug")!=null) this.cuas_step_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_step_debug"));
...@@ -5722,6 +5744,10 @@ min_str_neib_fpn 0.35 ...@@ -5722,6 +5744,10 @@ min_str_neib_fpn 0.35
imp.cuas_speed_min = this.cuas_speed_min; imp.cuas_speed_min = this.cuas_speed_min;
imp.cuas_speed_pref = this.cuas_speed_pref; imp.cuas_speed_pref = this.cuas_speed_pref;
imp.cuas_speed_boost = this.cuas_speed_boost; imp.cuas_speed_boost = this.cuas_speed_boost;
imp.cuas_target_frac = new double [this.cuas_target_frac.length][];
for (int i = 0; i < this.cuas_target_frac.length; i++) {
imp.cuas_target_frac[i] = this.cuas_target_frac[i].clone();
}
imp.cuas_debug = this.cuas_debug; imp.cuas_debug = this.cuas_debug;
imp.cuas_step_debug = this.cuas_step_debug; imp.cuas_step_debug = this.cuas_step_debug;
...@@ -6118,6 +6144,39 @@ min_str_neib_fpn 0.35 ...@@ -6118,6 +6144,39 @@ min_str_neib_fpn 0.35
} }
public static String double2dToString(double [][] d) {
String s = "";
for (int i = 0; i < d.length; i++) {
for (int j = 0; j < d[i].length; j++) {
Double D = d[i][j];
s+= D.toString();
if (j <(d[i].length - 1)) {
s +=",";
}
}
if (i < (d.length - 1)) {
s +=":";
}
}
return s;
}
public static double [][] stringToDouble2d(String s) {
String [] srows = s.split(":");
double [][] d = new double [srows.length][];
for (int i = 0; i < d.length; i++) {
String [] scols = srows[i].split(",");
d[i] = new double [scols.length];
for (int j = 0; j < d[i].length; j++) {
try {
d[i][j] = Double.valueOf(scols[j]);
} catch(NumberFormatException e){
d[i][j] = 0.0;
}
}
}
return d;
}
public static String rectangleToString(Rectangle r) { public static String rectangleToString(Rectangle r) {
return intsToString(new int []{r.x,r.y,r.width, r.height}); return intsToString(new int []{r.x,r.y,r.width, r.height});
......
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