Commit fb528d3a authored by Andrey Filippov's avatar Andrey Filippov

improving target detection

parent 99bfce50
...@@ -64,7 +64,19 @@ public class EyesisCorrectionParameters { ...@@ -64,7 +64,19 @@ public class EyesisCorrectionParameters {
"x3dDirectory", // 5 "x3dDirectory", // 5
"resultsDirectory", // 6 "resultsDirectory", // 6
"cuasSeed", // 7 "cuasSeed", // 7
"uasLogs"}; // 8 "uasLogs", // 8
"skyMask"}; // 9
public static final int KEY_INDEX_ROOT_DIRECTORY = 0;
public static final int KEY_INDEX_SOURCE_DIRECTORY = 1;
public static final int KEY_INDEX_LINKED_MODELS = 2;
public static final int KEY_INDEX_LINKED_CENTERS = 3;
public static final int KEY_INDEX_VIDEO_DIRECTORY = 4;
public static final int KEY_INDEX_X3D_DIRECTORY = 5;
public static final int KEY_INDEX_RESULTS_DIRECTORY = 6;
public static final int KEY_INDEX_CUAS_SEED = 7;
public static final int KEY_INDEX_UAS_LOGS = 8;
public static final int KEY_INDEX_SKY_MASK = 9;
public static final String AUX_PREFIX = "AUX-"; public static final String AUX_PREFIX = "AUX-";
public boolean swapSubchannels01= true; // false; // (false: 0-1-2, true - 1-0-2) public boolean swapSubchannels01= true; // false; // (false: 0-1-2, true - 1-0-2)
public boolean split= true; public boolean split= true;
...@@ -113,6 +125,7 @@ public class EyesisCorrectionParameters { ...@@ -113,6 +125,7 @@ public class EyesisCorrectionParameters {
public boolean useSourceList= false; public boolean useSourceList= false;
public String cuasSeedDir= ""; public String cuasSeedDir= "";
public boolean useCuasSeedDir= false; public boolean useCuasSeedDir= false;
public String cuasSkyMask = ""; // TIFF image 640x512 where 1.0 - sky, 0.0 - ground, blurred with GB (now sigma==2.0)
public String cuasUasLogs = ""; // json file path containing UAS logs public String cuasUasLogs = ""; // json file path containing UAS logs
public double cuasUasTimeStamp = 0.0; // timestamp corresponding to the UAS time 0.0 public double cuasUasTimeStamp = 0.0; // timestamp corresponding to the UAS time 0.0
public double [] cuasCameraATR = {0, 0, 0}; public double [] cuasCameraATR = {0, 0, 0};
...@@ -305,6 +318,7 @@ public class EyesisCorrectionParameters { ...@@ -305,6 +318,7 @@ public class EyesisCorrectionParameters {
cp.cuasSeedDir= this.cuasSeedDir; cp.cuasSeedDir= this.cuasSeedDir;
cp.useCuasSeedDir= this.useCuasSeedDir; cp.useCuasSeedDir= this.useCuasSeedDir;
cp.cuasSkyMask = this.cuasSkyMask;
cp.cuasUasLogs = this.cuasUasLogs; cp.cuasUasLogs = this.cuasUasLogs;
cp.cuasUasTimeStamp = this.cuasUasTimeStamp; cp.cuasUasTimeStamp = this.cuasUasTimeStamp;
cp.cuasCameraATR = this.cuasCameraATR.clone(); cp.cuasCameraATR = this.cuasCameraATR.clone();
...@@ -719,6 +733,7 @@ public class EyesisCorrectionParameters { ...@@ -719,6 +733,7 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"cuasSeedDir")!= null) this.cuasSeedDir=properties.getProperty(prefix+"cuasSeedDir"); if (properties.getProperty(prefix+"cuasSeedDir")!= null) this.cuasSeedDir=properties.getProperty(prefix+"cuasSeedDir");
if (properties.getProperty(prefix+"useCuasSeedDir")!=null) this.useCuasSeedDir=Boolean.parseBoolean(properties.getProperty(prefix+"useCuasSeedDir")); // save 32-bit tiff also if the end result is 8 or 16 bit if (properties.getProperty(prefix+"useCuasSeedDir")!=null) this.useCuasSeedDir=Boolean.parseBoolean(properties.getProperty(prefix+"useCuasSeedDir")); // save 32-bit tiff also if the end result is 8 or 16 bit
if (properties.getProperty(prefix+"cuasSkyMask")!= null) this.cuasSkyMask=properties.getProperty(prefix+"cuasSkyMask");
if (properties.getProperty(prefix+"cuasUasLogs")!= null) this.cuasUasLogs=properties.getProperty(prefix+"cuasUasLogs"); if (properties.getProperty(prefix+"cuasUasLogs")!= null) this.cuasUasLogs=properties.getProperty(prefix+"cuasUasLogs");
if (properties.getProperty(prefix+"cuasUasTimeStamp")!=null)this.cuasUasTimeStamp=Double.parseDouble(properties.getProperty(prefix+"cuasUasTimeStamp")); // save 32-bit tiff also if the end result is 8 or 16 bit if (properties.getProperty(prefix+"cuasUasTimeStamp")!=null)this.cuasUasTimeStamp=Double.parseDouble(properties.getProperty(prefix+"cuasUasTimeStamp")); // save 32-bit tiff also if the end result is 8 or 16 bit
if (properties.getProperty(prefix+"cuasCameraATR")!=null) this.cuasCameraATR= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"cuasCameraATR"),this.cuasCameraATR); if (properties.getProperty(prefix+"cuasCameraATR")!=null) this.cuasCameraATR= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"cuasCameraATR"),this.cuasCameraATR);
...@@ -954,6 +969,7 @@ public class EyesisCorrectionParameters { ...@@ -954,6 +969,7 @@ public class EyesisCorrectionParameters {
gd.addStringField ("CUAS seed directory", this.cuasSeedDir, 80); gd.addStringField ("CUAS seed directory", this.cuasSeedDir, 80);
gd.addCheckbox ("Use CUAS seed", this.useCuasSeedDir); gd.addCheckbox ("Use CUAS seed", this.useCuasSeedDir);
gd.addStringField ("UAS Sky Mask file", this.cuasSkyMask, 80);
gd.addStringField ("UAS log file", this.cuasUasLogs, 80); gd.addStringField ("UAS log file", this.cuasUasLogs, 80);
gd.addNumericField("UAS log start timestamp", this.cuasUasTimeStamp, 0); gd.addNumericField("UAS log start timestamp", this.cuasUasTimeStamp, 0);
gd.addStringField ("Camera ATR in world coordinates", IntersceneMatchParameters.doublesToString(this.cuasCameraATR), 80); gd.addStringField ("Camera ATR in world coordinates", IntersceneMatchParameters.doublesToString(this.cuasCameraATR), 80);
...@@ -1113,6 +1129,8 @@ public class EyesisCorrectionParameters { ...@@ -1113,6 +1129,8 @@ public class EyesisCorrectionParameters {
this.sourceSequencesList= gd.getNextString(); if (gd.getNextBoolean()) selectSourceSequencesList(false, false); this.sourceSequencesList= gd.getNextString(); if (gd.getNextBoolean()) selectSourceSequencesList(false, false);
this.useSourceList = gd.getNextBoolean(); this.useSourceList = gd.getNextBoolean();
this.cuasSeedDir= gd.getNextString(); this.cuasSeedDir= gd.getNextString();
this.cuasSkyMask = gd.getNextString();
this.cuasUasLogs = gd.getNextString(); this.cuasUasLogs = gd.getNextString();
this.cuasUasTimeStamp = gd.getNextNumber(); this.cuasUasTimeStamp = gd.getNextNumber();
this.cuasCameraATR = IntersceneMatchParameters.StringToDoubles(gd.getNextString(), cuasCameraATR); this.cuasCameraATR = IntersceneMatchParameters.StringToDoubles(gd.getNextString(), cuasCameraATR);
...@@ -1210,6 +1228,7 @@ public class EyesisCorrectionParameters { ...@@ -1210,6 +1228,7 @@ public class EyesisCorrectionParameters {
gd.addStringField ("CUAS seed directory", this.cuasSeedDir, 80); gd.addStringField ("CUAS seed directory", this.cuasSeedDir, 80);
gd.addCheckbox ("Use CUAS seed", this.useCuasSeedDir); gd.addCheckbox ("Use CUAS seed", this.useCuasSeedDir);
gd.addStringField ("UAS Sky Mask file", this.cuasSkyMask, 80);
gd.addStringField ("UAS log file", this.cuasUasLogs, 80); gd.addStringField ("UAS log file", this.cuasUasLogs, 80);
gd.addNumericField("UAS log start timestamp", this.cuasUasTimeStamp, 0); gd.addNumericField("UAS log start timestamp", this.cuasUasTimeStamp, 0);
gd.addStringField ("Camera ATR in world coordinates", IntersceneMatchParameters.doublesToString(this.cuasCameraATR), 80); gd.addStringField ("Camera ATR in world coordinates", IntersceneMatchParameters.doublesToString(this.cuasCameraATR), 80);
...@@ -1406,6 +1425,7 @@ public class EyesisCorrectionParameters { ...@@ -1406,6 +1425,7 @@ public class EyesisCorrectionParameters {
this.cuasSeedDir= gd.getNextString(); this.cuasSeedDir= gd.getNextString();
this.useCuasSeedDir = gd.getNextBoolean(); this.useCuasSeedDir = gd.getNextBoolean();
this.cuasSkyMask = gd.getNextString();
this.cuasUasLogs = gd.getNextString(); this.cuasUasLogs = gd.getNextString();
this.cuasUasTimeStamp = gd.getNextNumber(); this.cuasUasTimeStamp = gd.getNextNumber();
this.cuasCameraATR = IntersceneMatchParameters.StringToDoubles(gd.getNextString(), cuasCameraATR); this.cuasCameraATR = IntersceneMatchParameters.StringToDoubles(gd.getNextString(), cuasCameraATR);
...@@ -1681,11 +1701,21 @@ public class EyesisCorrectionParameters { ...@@ -1681,11 +1701,21 @@ public class EyesisCorrectionParameters {
public int first = 0; public int first = 0;
public int last = -1; public int last = -1;
public int movement_size = -1; public int movement_size = -1;
PathFirstLast (String path, int first, int last, int movement_size){ public double mask_x = 0.0; // mask offset X (use mask with this x,y instead of 0,0)
public double mask_y = 0.0; // mask offset X (use mask with this x,y instead of 0,0)
PathFirstLast (
String path,
int first,
int last,
int movement_size,
double mask_x,
double mask_y){
this.path = path; this.path = path;
this.first = first; this.first = first;
this.last = last; this.last = last;
this.movement_size = movement_size; this.movement_size = movement_size;
this.mask_x = mask_x;
this.mask_y = mask_x;
} }
} }
public PathFirstLast [] getSourceSets( public PathFirstLast [] getSourceSets(
...@@ -1755,21 +1785,16 @@ public class EyesisCorrectionParameters { ...@@ -1755,21 +1785,16 @@ public class EyesisCorrectionParameters {
if (!source_dir.exists()) { if (!source_dir.exists()) {
source_dir.mkdirs(); source_dir.mkdirs();
} }
/// if (dir_map.containsKey("cuasSeed")) {
/// this.cuasSeed=(base_path.resolve(Paths.get(dir_map.get("cuasSeed")))).toString();
/// }
useCuasSeedDir = false; useCuasSeedDir = false;
// Set other directories (possibly relative to base_path) // Set other directories (possibly relative to base_path)
for (int i = 2; i < KEY_DIRS.length; i++) { // skip "rootDirectory" and "sourceDirectory" for (int i = KEY_INDEX_LINKED_MODELS; i < KEY_DIRS.length; i++) { // skip "rootDirectory" and "sourceDirectory"
if (dir_map.containsKey(KEY_DIRS[i])) { if (dir_map.containsKey(KEY_DIRS[i])) {
// Path dir_path=null;
// File dir_file = null;
String dir_string = ""; String dir_string = "";
if (dir_map.get(KEY_DIRS[i]).length() > 0){ if (dir_map.get(KEY_DIRS[i]).length() > 0){
Path dir_path=base_path.resolve(Paths.get(dir_map.get(KEY_DIRS[i]))); Path dir_path=base_path.resolve(Paths.get(dir_map.get(KEY_DIRS[i])));
File dir_file = new File(dir_path.toString()); File dir_file = new File(dir_path.toString());
if (i != 8) { // cuasUasLogs is a file, not directory if ((i != KEY_INDEX_UAS_LOGS) && (i != KEY_INDEX_SKY_MASK)) { // cuasUasLogs, cuasSkyMask are files, not directories
if (!dir_file.exists()) { if (!dir_file.exists()) {
dir_file.mkdirs(); dir_file.mkdirs();
} }
...@@ -1777,32 +1802,32 @@ public class EyesisCorrectionParameters { ...@@ -1777,32 +1802,32 @@ public class EyesisCorrectionParameters {
dir_string = dir_path.toString(); dir_string = dir_path.toString();
} }
switch (i) { switch (i) {
case 2: case KEY_INDEX_LINKED_MODELS: // 2
this.linkedModels = dir_string; // dir_path.toString(); this.linkedModels = dir_string; // dir_path.toString();
System.out.println("this.linkedModels="+this.linkedModels); System.out.println("this.linkedModels="+this.linkedModels);
break; break;
case 3: case KEY_INDEX_LINKED_CENTERS: // 3:
this.linkedCenters = dir_string; // dir_path.toString(); this.linkedCenters = dir_string; // dir_path.toString();
System.out.println("this.linkedCenters="+this.linkedCenters); System.out.println("this.linkedCenters="+this.linkedCenters);
break; break;
case 4: case KEY_INDEX_VIDEO_DIRECTORY: // 4:
this.videoDirectory = dir_string; // dir_path.toString(); this.videoDirectory = dir_string; // dir_path.toString();
System.out.println("this.videoDirectory="+this.videoDirectory); System.out.println("this.videoDirectory="+this.videoDirectory);
break; break;
case 5: case KEY_INDEX_X3D_DIRECTORY: // 5:
this.x3dDirectory = dir_string; // dir_path.toString(); this.x3dDirectory = dir_string; // dir_path.toString();
System.out.println("this.x3dDirectory="+this.x3dDirectory); System.out.println("this.x3dDirectory="+this.x3dDirectory);
break; break;
case 6: case KEY_INDEX_RESULTS_DIRECTORY: // 6:
this.resultsDirectory = dir_string; // dir_path.toString(); this.resultsDirectory = dir_string; // dir_path.toString();
System.out.println("this.resultsDirectory="+this.resultsDirectory); System.out.println("this.resultsDirectory="+this.resultsDirectory);
break; break;
case 7: // cuasSeed case KEY_INDEX_CUAS_SEED: // 7: // cuasSeed
this.cuasSeedDir = dir_string; // dir_path.toString(); this.cuasSeedDir = dir_string; // dir_path.toString();
System.out.println("this.cuasSeedDir=" + this.cuasSeedDir); System.out.println("this.cuasSeedDir=" + this.cuasSeedDir);
useCuasSeedDir = true; useCuasSeedDir = true;
break; break;
case 8: // cuasSeed case KEY_INDEX_UAS_LOGS: // 8: // cuasSeed
this.cuasUasLogs = dir_string; // dir_path.toString(); this.cuasUasLogs = dir_string; // dir_path.toString();
System.out.println("this.cuasUasLogs=" + this.cuasUasLogs); System.out.println("this.cuasUasLogs=" + this.cuasUasLogs);
ArrayList<String> uas_pars = extra_map.get("uasLogs"); ArrayList<String> uas_pars = extra_map.get("uasLogs");
...@@ -1826,6 +1851,11 @@ public class EyesisCorrectionParameters { ...@@ -1826,6 +1851,11 @@ public class EyesisCorrectionParameters {
} }
} }
} }
break;
case KEY_INDEX_SKY_MASK: // 9: // cuasSeed
this.cuasSkyMask = dir_string; // dir_path.toString();
System.out.println("this.cuasSkyMask=" + this.cuasSkyMask);
break; break;
} }
} }
...@@ -1842,16 +1872,17 @@ public class EyesisCorrectionParameters { ...@@ -1842,16 +1872,17 @@ public class EyesisCorrectionParameters {
Path dir_path = source_path.resolve(Paths.get(tokens[0])); Path dir_path = source_path.resolve(Paths.get(tokens[0]));
path_list.add(new PathFirstLast( path_list.add(new PathFirstLast(
dir_path.toString(), dir_path.toString(),
((tokens.length > 1)? Integer.parseInt(tokens[1]):0), ((tokens.length > 1)? Integer.parseInt (tokens[1]): 0),
((tokens.length > 2)? Integer.parseInt(tokens[2]):-1), ((tokens.length > 2)? Integer.parseInt (tokens[2]):-1),
((tokens.length > 3)? Integer.parseInt(tokens[3]):-1))); ((tokens.length > 3)? Integer.parseInt (tokens[3]):-1),
((tokens.length > 4)? Double.parseDouble(tokens[4]): 0.0),
((tokens.length > 5)? Double.parseDouble(tokens[5]): 0.0)));
} }
} }
} }
return path_list.toArray(new PathFirstLast[0]); return path_list.toArray(new PathFirstLast[0]);
} }
public boolean selectSourceSets(int debugLevel) { public boolean selectSourceSets(int debugLevel) {
String [] defaultPaths = getSetList(this.sourcePaths); // returns non-null 99 scenes list String [] defaultPaths = getSetList(this.sourcePaths); // returns non-null 99 scenes list
File [] defaultFiles = new File[defaultPaths.length]; // 99 directories File [] defaultFiles = new File[defaultPaths.length]; // 99 directories
...@@ -2482,6 +2513,21 @@ public class EyesisCorrectionParameters { ...@@ -2482,6 +2513,21 @@ public class EyesisCorrectionParameters {
return this.cuasUasLogs; return this.cuasUasLogs;
} }
public String getUasSkyMask() {
if (this.cuasSkyMask == null) { // Keep it?
return null;
}
if (this.cuasSkyMask.length() == 0) {
return "";
}
if (!this.cuasSkyMask.endsWith(".tiff")) {
this.cuasSkyMask = this.cuasSkyMask+".tiff";
}
return this.cuasSkyMask;
}
public double getUasLogsTimeStamp() { public double getUasLogsTimeStamp() {
return this.cuasUasTimeStamp; return this.cuasUasTimeStamp;
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -91,20 +91,23 @@ public class CuasMotionLMA { ...@@ -91,20 +91,23 @@ public class CuasMotionLMA {
"WHEN", "FAILURE"}; "WHEN", "FAILURE"};
public static final int FAIL_NONE = 0; public static final int FAIL_NONE = 0;
public static final int FAIL_CENT_STR = 1; // centroid amplitude is too low public static final int FAIL_MOTION = 1; // motion strength/fraction too low
public static final int FAIL_CENT_FRAC = 2; // Centroid fraction (energy in the peak fraction of all) is too low public static final int FAIL_NO_MAX = 2; // no suitable local maximum
public static final int FAIL_LMA = 3; // LMA fail to converge public static final int FAIL_CENT_STR = 3; // centroid amplitude is too low
public static final int FAIL_A_LOW = 4; // 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_ACENT = 5; // ratio of maximal pixel to amplitude is too low public static final int FAIL_LMA = 5; // LMA fail to converge
public static final int FAIL_RMSE = 6; // RMSE is too high public static final int FAIL_A_LOW = 6; // amplitude is too low
public static final int FAIL_RMSE_R = 7; // BOTH RMSE is not sufficient and RMSE/A is too high public static final int FAIL_ACENT = 7; // ratio of maximal pixel to amplitude is too low
public static final int FAIL_R0_HIGH = 8; // Full radius (including negative overshoot) is too high public static final int FAIL_RMSE = 8; // RMSE is too high
public static final int FAIL_R1_LOW = 9; // Inner (positive) peak radius is too low public static final int FAIL_RMSE_R = 9; // BOTH RMSE is not sufficient and RMSE/A is too high
public static final int FAIL_K_LOW = 10; // Overshoot is too low (not used, it can be down to 0) public static final int FAIL_R0_HIGH = 10; // Full radius (including negative overshoot) is too high
public static final int FAIL_K_HIGH = 11; // Overshoot is too high public static final int FAIL_R1_LOW = 11; // Inner (positive) peak radius is too low
public static final int FAIL_FAR = 12; // Peak is too far from the center 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_HORIZON = 13; // Peak is below horizon public static final int FAIL_K_HIGH = 13; // Overshoot is too high
public static final int FAIL_MISMATCH = 14; // Mismatch on both ends 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
private int width; private int width;
private double [][] window; private double [][] window;
......
...@@ -4728,6 +4728,7 @@ public class GpuQuad{ // quad camera description ...@@ -4728,6 +4728,7 @@ public class GpuQuad{ // quad camera description
* @param offset_scale multiply all vectors by this value when calculating pixel offsets * @param offset_scale multiply all vectors by this value when calculating pixel offsets
* @param magnitude_scale Scale data for accumulation (here positive, will be negated). If 0 - will use scale=1.0 (no accumulation) * @param magnitude_scale Scale data for accumulation (here positive, will be negated). If 0 - will use scale=1.0 (no accumulation)
* @param index_vx - index of vx in the targets_array[tile] array * @param index_vx - index of vx in the targets_array[tile] array
* @param index_xc - index of xc in the targets_array[tile] array to center target or <0 to render as is
* @param image_width image width in tiles (80 for 640-wide images). * @param image_width image width in tiles (80 for 640-wide images).
* @return condensed array of TpTask * @return condensed array of TpTask
*/ */
...@@ -4736,6 +4737,7 @@ public class GpuQuad{ // quad camera description ...@@ -4736,6 +4737,7 @@ public class GpuQuad{ // quad camera description
final double offset_scale, final double offset_scale,
final double magnitude_scale, final double magnitude_scale,
final int index_vx, final int index_vx,
final int index_xc,
final int tilesX) { final int tilesX) {
final float fmagnitude_scale = (magnitude_scale==0)? 1.0f : ((float) -magnitude_scale); final float fmagnitude_scale = (magnitude_scale==0)? 1.0f : ((float) -magnitude_scale);
final int tiles = targets_array.length; final int tiles = targets_array.length;
...@@ -4754,6 +4756,10 @@ public class GpuQuad{ // quad camera description ...@@ -4754,6 +4756,10 @@ public class GpuQuad{ // quad camera description
int tileX = nTile % tilesX;; int tileX = nTile % tilesX;;
double dx = targets_array[nTile][index_vx + 0]*offset_scale; double dx = targets_array[nTile][index_vx + 0]*offset_scale;
double dy = targets_array[nTile][index_vx + 1]*offset_scale; double dy = targets_array[nTile][index_vx + 1]*offset_scale;
if ((index_xc >= 0) && !Double.isNaN( targets_array[nTile][index_xc])) {
dx += targets_array[nTile][index_xc + 0];
dy += targets_array[nTile][index_xc + 1];
}
double [] cxy0 = { // uniform coordinates for the center scene double [] cxy0 = { // uniform coordinates for the center scene
(tileX + 0.5) * GPUTileProcessor.DTT_SIZE, (tileX + 0.5) * GPUTileProcessor.DTT_SIZE,
(tileY + 0.5) * GPUTileProcessor.DTT_SIZE}; (tileY + 0.5) * GPUTileProcessor.DTT_SIZE};
......
...@@ -2572,7 +2572,8 @@ public class Correlation2d { ...@@ -2572,7 +2572,8 @@ public class Correlation2d {
System.out.println("getMaxXYCm() -> "+rslt[0]+":"+rslt[1] +" ("+rslt[2]+"), frac = " + rslt[3]); System.out.println("getMaxXYCm() -> "+rslt[0]+":"+rslt[1] +" ("+rslt[2]+"), frac = " + rslt[3]);
} }
if (Double.isNaN(rslt[0]) || Double.isNaN(rslt[1]) || Double.isNaN(rslt[2])) { if (Double.isNaN(rslt[0]) || Double.isNaN(rslt[1]) || Double.isNaN(rslt[2])) {
System.out.println("getMaxXYCm():NaN"); // System.out.println("getMaxXYCm():NaN");
return null;
} }
return rslt; return rslt;
} else { } else {
...@@ -2581,7 +2582,8 @@ public class Correlation2d { ...@@ -2581,7 +2582,8 @@ public class Correlation2d {
System.out.println("getMaxXYCm() -> "+rslt[0]+":"+rslt[1] +" ("+rslt[2]+")"); System.out.println("getMaxXYCm() -> "+rslt[0]+":"+rslt[1] +" ("+rslt[2]+")");
} }
if (Double.isNaN(rslt[0]) || Double.isNaN(rslt[1]) || Double.isNaN(rslt[2])) { if (Double.isNaN(rslt[0]) || Double.isNaN(rslt[1]) || Double.isNaN(rslt[2])) {
System.out.println("getMaxXYCm():NaN"); // System.out.println("getMaxXYCm():NaN");
return null;
} }
return rslt; return rslt;
} }
......
...@@ -657,6 +657,7 @@ min_str_neib_fpn 0.35 ...@@ -657,6 +657,7 @@ min_str_neib_fpn 0.35
public double mb_max_gain = 5.0; // motion blur maximal gain (if more - move second point more than a pixel public double mb_max_gain = 5.0; // motion blur maximal gain (if more - move second point more than a pixel
public double mb_max_gain_inter = 2.0; // same for interscene correlation for pose adjustment public double mb_max_gain_inter = 2.0; // same for interscene correlation for pose adjustment
//CUAS mode //CUAS mode
public boolean cuas_update_existing= false; // re-create center_CLT if it exists (FIXME: accumulates errors - need fixing)
public int cuas_discard_border = 8; // Discard this number of pixels from each side when merging public int cuas_discard_border = 8; // Discard this number of pixels from each side when merging
public double cuas_max_fold = 50; public double cuas_max_fold = 50;
public int cuas_min_in_row_col = 4; // Minimal number of defined tiles in a row/column public int cuas_min_in_row_col = 4; // Minimal number of defined tiles in a row/column
...@@ -725,8 +726,19 @@ min_str_neib_fpn 0.35 ...@@ -725,8 +726,19 @@ min_str_neib_fpn 0.35
public double cuas_speed_boost = 1.0; // speed boost limit public double cuas_speed_boost = 1.0; // speed boost limit
// target filtering after constant velocity accumulation // target filtering after constant velocity accumulation
public double cuas_lmax_fraction = 0.7; // Check if local maximum is separated from the surrounding by this fraction of the maximum value // additional filtering before finding the local max
public double cuas_lmax_radius = 4.5; // look inside ((int)cuas_lmax_radius) * 2 + 1 square for the local maximum isolation public double cuas_lmax_flt_neglim=-0.3; // limit negative data to reduce ridge influence (>=0 to disable)
public double cuas_lmax_flt_hsigma= 1.0; // HPF (~UM) subtract GB with this sigma from the data tile
public double cuas_lmax_flt_lsigma= 1.0; // LPF - GB result of the previous subtraction
public double cuas_lmax_flt_scale = 5.0; // scale filtering result
public String cuas_sky_path = ""; // edited not here
public double cuas_sky_threshold = 0.9; // minimal value of the sky mask where target is possible
public double [] cuas_sky_offset = {0.0, 0.0}; // add to coordinates when looking for the mask value
public double cuas_lmax_fraction = 0.6; // Check if local maximum is separated from the surrounding by this fraction of the maximum value
public double cuas_lmax_hack_ridge= 0.45; // Hack for ridges: remove horizontal streaks, where average(abs()) for the line exceeds fraction of abs max 0.32-good, 0.55 - bad
public double cuas_lmax_radius = 3.5; // 4.5; // look inside ((int)cuas_lmax_radius) * 2 + 1 square for the local maximum isolation
public boolean cuas_lmax_zero = false; // true; // zero all data outside this radius from the maximum public boolean cuas_lmax_zero = false; // true; // zero all data outside this radius from the maximum
...@@ -769,6 +781,7 @@ min_str_neib_fpn 0.35 ...@@ -769,6 +781,7 @@ min_str_neib_fpn 0.35
public double cuas_factor_pow = 1.0; // raise score factor to this power before combining public double cuas_factor_pow = 1.0; // raise score factor to this power before combining
public double [] cuas_score_coeff = {1.0, 0.2, 1.0, 1.0, 1.0}; //weights of amplitude, RMSE and RMSE/amplitude public double [] cuas_score_coeff = {1.0, 0.2, 1.0, 1.0, 1.0}; //weights of amplitude, RMSE and RMSE/amplitude
public boolean cuas_center_targ = true; // re-run target extraction with targets centered to their tiles
public boolean cuas_isolated = true; // remove targets that do not have neighbors before/after public boolean cuas_isolated = true; // remove targets that do not have neighbors before/after
public boolean cuas_remove_2seq = true; // Remove short target sequences consisting of 2 consecutive key frames public boolean cuas_remove_2seq = true; // Remove short target sequences consisting of 2 consecutive key frames
public double cuas_max_mismatch = 2.0; // maximal position error between consecutive scene sequences public double cuas_max_mismatch = 2.0; // maximal position error between consecutive scene sequences
...@@ -2136,7 +2149,7 @@ min_str_neib_fpn 0.35 ...@@ -2136,7 +2149,7 @@ min_str_neib_fpn 0.35
gd.addTab("MB","Motion Blur"); gd.addTab("MB","Motion Blur");
gd.addCheckbox ("Compensate motion blur", this.mb_en, gd.addCheckbox ("Compensate motion blur", this.mb_en,
"Ebable motion blur correction."); "Enable motion blur correction.");
gd.addNumericField("Sensor time constant", this.mb_tau, 5,7,"s", gd.addNumericField("Sensor time constant", this.mb_tau, 5,7,"s",
"Sensor exponential decay in seconds."); "Sensor exponential decay in seconds.");
gd.addNumericField("Maximal gain", this.mb_max_gain, 5,7,"x", gd.addNumericField("Maximal gain", this.mb_max_gain, 5,7,"x",
...@@ -2144,6 +2157,8 @@ min_str_neib_fpn 0.35 ...@@ -2144,6 +2157,8 @@ min_str_neib_fpn 0.35
gd.addNumericField("Maximal gain pose", this.mb_max_gain_inter, 5,7,"x", gd.addNumericField("Maximal gain pose", this.mb_max_gain_inter, 5,7,"x",
"Maximal gain for motion blur correction during interscene correlation. Will be used for all but the last adjustment."); "Maximal gain for motion blur correction during interscene correlation. Will be used for all but the last adjustment.");
gd.addTab("CUAS","CUAS Parameters"); gd.addTab("CUAS","CUAS Parameters");
gd.addCheckbox ("Re-calculate center CLT", this.cuas_update_existing,
"Re-create center_CLT if it exists (FIXME: accumulates errors - need fixing).");
gd.addNumericField("Discard margins", this.cuas_discard_border, 0,3,"pix", gd.addNumericField("Discard margins", this.cuas_discard_border, 0,3,"pix",
"Discards this number of pixels from each side when merging images."); "Discards this number of pixels from each side when merging images.");
gd.addNumericField("Maximal X,Y fold", this.cuas_max_fold, 5,7,"pix", gd.addNumericField("Maximal X,Y fold", this.cuas_max_fold, 5,7,"pix",
...@@ -2265,10 +2280,32 @@ min_str_neib_fpn 0.35 ...@@ -2265,10 +2280,32 @@ min_str_neib_fpn 0.35
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("Negative tile data limit", this.cuas_lmax_flt_neglim, 5,8,"",
"Limit negative data to reduce ridge influence (>=0 to disable). Only used if filtering is ON (see below).");
gd.addNumericField("HPF sigma for the data tile", this.cuas_lmax_flt_hsigma, 5,8,"pix",
"HPF (~UM) subtract GB with this sigma from the data tile.");
gd.addNumericField("LPF sigma for the data tile", this.cuas_lmax_flt_lsigma, 5,8,"pix",
"LPF - GB result of the previous subtraction.");
gd.addNumericField("Scale filtering result", this.cuas_lmax_flt_scale, 5,8,"x",
"Scale filtering result.");
gd.addMessage("Cuas sky mask path: \""+cuas_sky_path+"\"");
gd.addNumericField("Cuas sky threshold", this.cuas_sky_threshold, 5,8,"",
"Minimal value of the sky mask where target is possible.");
gd.addStringField ("Sky mask x,y offsets", IntersceneMatchParameters.doublesToString(cuas_sky_offset), 80,
"Add to coordinates when looking for the mask value .");
gd.addNumericField("Maximums separation fraction", this.cuas_lmax_fraction, 5,8,"", gd.addNumericField("Maximums separation fraction", this.cuas_lmax_fraction, 5,8,"",
"Check if local maximum is separated from tye surrounding by this fraction of the maximum value."); "Check if local maximum is separated from tye surrounding by this fraction of the maximum value.");
gd.addNumericField("Hack for ridges", this.cuas_lmax_hack_ridge, 5,8,"",
"Remove horizontal streaks, where average(abs()) for the line exceeds fraction of abs max(0.32-good max, 0.55 - bad max).");
gd.addNumericField("Maximums separation radius", this.cuas_lmax_radius, 5,8,"pix", gd.addNumericField("Maximums separation radius", this.cuas_lmax_radius, 5,8,"pix",
"Look inside ((int)cuas_lmax_radius) * 2 + 1 square for the local maximum isolation ."); "Look inside ((int)cuas_lmax_radius) * 2 + 1 square for the local maximum isolation .");
gd.addCheckbox ("Zero far from maximums pixels", this.cuas_lmax_zero, gd.addCheckbox ("Zero far from maximums pixels", this.cuas_lmax_zero,
"Zero all data outside this radius from the maximum."); "Zero all data outside this radius from the maximum.");
...@@ -2351,12 +2388,13 @@ min_str_neib_fpn 0.35 ...@@ -2351,12 +2388,13 @@ min_str_neib_fpn 0.35
"Raise each score factor to this power before combining them."); "Raise each score factor to this power before combining them.");
gd.addStringField ("Score factors weights", IntersceneMatchParameters.doublesToString(cuas_score_coeff), 80, gd.addStringField ("Score factors weights", IntersceneMatchParameters.doublesToString(cuas_score_coeff), 80,
"Relative importance of LMA amplitude, RMSE and RMSE/ampitude, before/after, far-from-edges."); "Relative importance of LMA amplitude, RMSE and RMSE/ampitude, before/after, far-from-edges.");
gd.addCheckbox ("Center targets in their tiles", this.cuas_center_targ,
"Re-run target extraction placing the targets at the center of their tiles.");
gd.addMessage("=== Post-processing targets filtering ==="); gd.addMessage("=== Post-processing targets filtering ===");
gd.addCheckbox ("Remove single-frame targets", this.cuas_isolated, gd.addCheckbox ("Remove single-frame targets", this.cuas_isolated,
"Remove targets that do not have neighbors before/afte."); "Remove targets that do not have neighbors before/after.");
gd.addCheckbox ("Remove pairs too", this.cuas_remove_2seq, gd.addCheckbox ("Remove pairs too", this.cuas_remove_2seq,
"Remove short target sequences consisting of 2 consecutive key frames."); "Remove short target sequences consisting of 2 consecutive key frames.");
gd.addNumericField("Remove by mismatch", this.cuas_max_mismatch, 5,8,"pix", gd.addNumericField("Remove by mismatch", this.cuas_max_mismatch, 5,8,"pix",
...@@ -3359,6 +3397,7 @@ min_str_neib_fpn 0.35 ...@@ -3359,6 +3397,7 @@ min_str_neib_fpn 0.35
this.mb_max_gain = gd.getNextNumber(); this.mb_max_gain = gd.getNextNumber();
this.mb_max_gain_inter = gd.getNextNumber(); this.mb_max_gain_inter = gd.getNextNumber();
this.cuas_update_existing = gd.getNextBoolean();
this.cuas_discard_border= (int) gd.getNextNumber(); this.cuas_discard_border= (int) gd.getNextNumber();
this.cuas_max_fold = gd.getNextNumber(); this.cuas_max_fold = gd.getNextNumber();
this.cuas_min_in_row_col= (int) gd.getNextNumber(); this.cuas_min_in_row_col= (int) gd.getNextNumber();
...@@ -3422,7 +3461,16 @@ min_str_neib_fpn 0.35 ...@@ -3422,7 +3461,16 @@ 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_lmax_flt_neglim = gd.getNextNumber();
this.cuas_lmax_flt_hsigma = gd.getNextNumber();
this.cuas_lmax_flt_lsigma = gd.getNextNumber();
this.cuas_lmax_flt_scale = gd.getNextNumber();
this.cuas_sky_threshold = gd.getNextNumber();
this.cuas_sky_offset = IntersceneMatchParameters.StringToDoubles(gd.getNextString(), cuas_sky_offset);
this.cuas_lmax_fraction = gd.getNextNumber(); this.cuas_lmax_fraction = gd.getNextNumber();
this.cuas_lmax_hack_ridge = gd.getNextNumber();
this.cuas_lmax_radius = gd.getNextNumber(); this.cuas_lmax_radius = gd.getNextNumber();
this.cuas_lmax_zero = gd.getNextBoolean(); this.cuas_lmax_zero = gd.getNextBoolean();
...@@ -3461,6 +3509,7 @@ min_str_neib_fpn 0.35 ...@@ -3461,6 +3509,7 @@ min_str_neib_fpn 0.35
this.cuas_factor_lim = gd.getNextNumber(); this.cuas_factor_lim = gd.getNextNumber();
this.cuas_factor_pow = gd.getNextNumber(); this.cuas_factor_pow = gd.getNextNumber();
this.cuas_score_coeff = IntersceneMatchParameters.StringToDoubles(gd.getNextString(), cuas_score_coeff); this.cuas_score_coeff = IntersceneMatchParameters.StringToDoubles(gd.getNextString(), cuas_score_coeff);
this.cuas_center_targ = gd.getNextBoolean();
this.cuas_isolated = gd.getNextBoolean(); this.cuas_isolated = gd.getNextBoolean();
this.cuas_remove_2seq = gd.getNextBoolean(); this.cuas_remove_2seq = gd.getNextBoolean();
...@@ -4350,6 +4399,7 @@ min_str_neib_fpn 0.35 ...@@ -4350,6 +4399,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"mb_max_gain", this.mb_max_gain+""); // double properties.setProperty(prefix+"mb_max_gain", this.mb_max_gain+""); // double
properties.setProperty(prefix+"mb_max_gain_inter", this.mb_max_gain_inter+""); // double properties.setProperty(prefix+"mb_max_gain_inter", this.mb_max_gain_inter+""); // double
properties.setProperty(prefix+"cuas_update_existing", this.cuas_update_existing+"");// boolean
properties.setProperty(prefix+"cuas_discard_border", this.cuas_discard_border+""); // int properties.setProperty(prefix+"cuas_discard_border", this.cuas_discard_border+""); // int
properties.setProperty(prefix+"cuas_max_fold", this.cuas_max_fold+""); // double properties.setProperty(prefix+"cuas_max_fold", this.cuas_max_fold+""); // double
properties.setProperty(prefix+"cuas_min_in_row_col", this.cuas_min_in_row_col+""); // int properties.setProperty(prefix+"cuas_min_in_row_col", this.cuas_min_in_row_col+""); // int
...@@ -4413,8 +4463,14 @@ min_str_neib_fpn 0.35 ...@@ -4413,8 +4463,14 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_speed_min", this.cuas_speed_min+""); // double properties.setProperty(prefix+"cuas_speed_min", this.cuas_speed_min+""); // double
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_lmax_flt_neglim", this.cuas_lmax_flt_neglim+"");// double
properties.setProperty(prefix+"cuas_lmax_flt_hsigma", this.cuas_lmax_flt_hsigma+"");// double
properties.setProperty(prefix+"cuas_lmax_flt_lsigma", this.cuas_lmax_flt_lsigma+"");// double
properties.setProperty(prefix+"cuas_lmax_flt_scale", this.cuas_lmax_flt_scale+""); // double
properties.setProperty(prefix+"cuas_sky_threshold", this.cuas_sky_threshold+""); // double
properties.setProperty(prefix+"cuas_sky_offset", IntersceneMatchParameters.doublesToString(this.cuas_sky_offset));
properties.setProperty(prefix+"cuas_lmax_fraction", this.cuas_lmax_fraction+""); // double properties.setProperty(prefix+"cuas_lmax_fraction", this.cuas_lmax_fraction+""); // double
properties.setProperty(prefix+"cuas_lmax_hack_ridge", this.cuas_lmax_hack_ridge+"");// double
properties.setProperty(prefix+"cuas_lmax_radius", this.cuas_lmax_radius+""); // double properties.setProperty(prefix+"cuas_lmax_radius", this.cuas_lmax_radius+""); // double
properties.setProperty(prefix+"cuas_lmax_zero", this.cuas_lmax_zero+""); // boolean properties.setProperty(prefix+"cuas_lmax_zero", this.cuas_lmax_zero+""); // boolean
...@@ -4453,6 +4509,7 @@ min_str_neib_fpn 0.35 ...@@ -4453,6 +4509,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_factor_lim", this.cuas_factor_lim+""); // double properties.setProperty(prefix+"cuas_factor_lim", this.cuas_factor_lim+""); // double
properties.setProperty(prefix+"cuas_factor_pow", this.cuas_factor_pow+""); // double properties.setProperty(prefix+"cuas_factor_pow", this.cuas_factor_pow+""); // double
properties.setProperty(prefix+"cuas_score_coeff", IntersceneMatchParameters.doublesToString(this.cuas_score_coeff)); properties.setProperty(prefix+"cuas_score_coeff", IntersceneMatchParameters.doublesToString(this.cuas_score_coeff));
properties.setProperty(prefix+"cuas_center_targ", this.cuas_center_targ+""); // boolean
properties.setProperty(prefix+"cuas_isolated", this.cuas_isolated+""); // boolean properties.setProperty(prefix+"cuas_isolated", this.cuas_isolated+""); // boolean
...@@ -5310,6 +5367,7 @@ min_str_neib_fpn 0.35 ...@@ -5310,6 +5367,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"mb_max_gain")!=null) this.mb_max_gain=Double.parseDouble(properties.getProperty(prefix+"mb_max_gain")); if (properties.getProperty(prefix+"mb_max_gain")!=null) this.mb_max_gain=Double.parseDouble(properties.getProperty(prefix+"mb_max_gain"));
if (properties.getProperty(prefix+"mb_max_gain_inter")!=null) this.mb_max_gain_inter=Double.parseDouble(properties.getProperty(prefix+"mb_max_gain_inter")); if (properties.getProperty(prefix+"mb_max_gain_inter")!=null) this.mb_max_gain_inter=Double.parseDouble(properties.getProperty(prefix+"mb_max_gain_inter"));
if (properties.getProperty(prefix+"cuas_update_existing")!=null) this.cuas_update_existing=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_update_existing"));
if (properties.getProperty(prefix+"cuas_discard_border")!=null) this.cuas_discard_border=Integer.parseInt(properties.getProperty(prefix+"cuas_discard_border")); if (properties.getProperty(prefix+"cuas_discard_border")!=null) this.cuas_discard_border=Integer.parseInt(properties.getProperty(prefix+"cuas_discard_border"));
if (properties.getProperty(prefix+"cuas_max_fold")!=null) this.cuas_max_fold=Double.parseDouble(properties.getProperty(prefix+"cuas_max_fold")); if (properties.getProperty(prefix+"cuas_max_fold")!=null) this.cuas_max_fold=Double.parseDouble(properties.getProperty(prefix+"cuas_max_fold"));
if (properties.getProperty(prefix+"cuas_min_in_row_col")!=null) this.cuas_min_in_row_col=Integer.parseInt(properties.getProperty(prefix+"cuas_min_in_row_col")); if (properties.getProperty(prefix+"cuas_min_in_row_col")!=null) this.cuas_min_in_row_col=Integer.parseInt(properties.getProperty(prefix+"cuas_min_in_row_col"));
...@@ -5373,7 +5431,16 @@ min_str_neib_fpn 0.35 ...@@ -5373,7 +5431,16 @@ 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_lmax_flt_hsigma")!=null) this.cuas_lmax_flt_hsigma=Double.parseDouble(properties.getProperty(prefix+"cuas_lmax_flt_hsigma"));
if (properties.getProperty(prefix+"cuas_lmax_flt_neglim")!=null) this.cuas_lmax_flt_neglim=Double.parseDouble(properties.getProperty(prefix+"cuas_lmax_flt_neglim"));
if (properties.getProperty(prefix+"cuas_lmax_flt_lsigma")!=null) this.cuas_lmax_flt_lsigma=Double.parseDouble(properties.getProperty(prefix+"cuas_lmax_flt_lsigma"));
if (properties.getProperty(prefix+"cuas_lmax_flt_scale")!=null) this.cuas_lmax_flt_scale=Double.parseDouble(properties.getProperty(prefix+"cuas_lmax_flt_scale"));
if (properties.getProperty(prefix+"cuas_sky_threshold")!=null) this.cuas_sky_threshold=Double.parseDouble(properties.getProperty(prefix+"cuas_sky_threshold"));
if (properties.getProperty(prefix+"cuas_sky_offset")!=null) this.cuas_sky_offset= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"cuas_sky_offset"),this.cuas_sky_offset);
if (properties.getProperty(prefix+"cuas_lmax_fraction")!=null) this.cuas_lmax_fraction=Double.parseDouble(properties.getProperty(prefix+"cuas_lmax_fraction")); if (properties.getProperty(prefix+"cuas_lmax_fraction")!=null) this.cuas_lmax_fraction=Double.parseDouble(properties.getProperty(prefix+"cuas_lmax_fraction"));
if (properties.getProperty(prefix+"cuas_lmax_hack_ridge")!=null) this.cuas_lmax_hack_ridge=Double.parseDouble(properties.getProperty(prefix+"cuas_lmax_hack_ridge"));
if (properties.getProperty(prefix+"cuas_lmax_radius")!=null) this.cuas_lmax_radius=Double.parseDouble(properties.getProperty(prefix+"cuas_lmax_radius")); if (properties.getProperty(prefix+"cuas_lmax_radius")!=null) this.cuas_lmax_radius=Double.parseDouble(properties.getProperty(prefix+"cuas_lmax_radius"));
if (properties.getProperty(prefix+"cuas_lmax_zero")!=null) this.cuas_lmax_zero=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_lmax_zero")); if (properties.getProperty(prefix+"cuas_lmax_zero")!=null) this.cuas_lmax_zero=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_lmax_zero"));
...@@ -5413,6 +5480,7 @@ min_str_neib_fpn 0.35 ...@@ -5413,6 +5480,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_factor_lim")!=null) this.cuas_factor_lim=Double.parseDouble(properties.getProperty(prefix+"cuas_factor_lim")); if (properties.getProperty(prefix+"cuas_factor_lim")!=null) this.cuas_factor_lim=Double.parseDouble(properties.getProperty(prefix+"cuas_factor_lim"));
if (properties.getProperty(prefix+"cuas_factor_pow")!=null) this.cuas_factor_pow=Double.parseDouble(properties.getProperty(prefix+"cuas_factor_pow")); if (properties.getProperty(prefix+"cuas_factor_pow")!=null) this.cuas_factor_pow=Double.parseDouble(properties.getProperty(prefix+"cuas_factor_pow"));
if (properties.getProperty(prefix+"cuas_score_coeff")!=null) this.cuas_score_coeff= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"cuas_score_coeff"),this.cuas_score_coeff); if (properties.getProperty(prefix+"cuas_score_coeff")!=null) this.cuas_score_coeff= IntersceneMatchParameters.StringToDoubles(properties.getProperty(prefix+"cuas_score_coeff"),this.cuas_score_coeff);
if (properties.getProperty(prefix+"cuas_center_targ")!=null) this.cuas_center_targ=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_center_targ"));
if (properties.getProperty(prefix+"cuas_isolated")!=null) this.cuas_isolated=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_isolated")); if (properties.getProperty(prefix+"cuas_isolated")!=null) this.cuas_isolated=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_isolated"));
if (properties.getProperty(prefix+"cuas_remove_2seq")!=null) this.cuas_remove_2seq=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_remove_2seq")); if (properties.getProperty(prefix+"cuas_remove_2seq")!=null) this.cuas_remove_2seq=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_remove_2seq"));
...@@ -6272,6 +6340,7 @@ min_str_neib_fpn 0.35 ...@@ -6272,6 +6340,7 @@ min_str_neib_fpn 0.35
imp.mb_max_gain = this.mb_max_gain; imp.mb_max_gain = this.mb_max_gain;
imp.mb_max_gain_inter = this.mb_max_gain_inter; imp.mb_max_gain_inter = this.mb_max_gain_inter;
imp.cuas_update_existing = this.cuas_update_existing;
imp.cuas_discard_border = this.cuas_discard_border; imp.cuas_discard_border = this.cuas_discard_border;
imp.cuas_max_fold = this.cuas_max_fold; imp.cuas_max_fold = this.cuas_max_fold;
imp.cuas_min_in_row_col = this.cuas_min_in_row_col; imp.cuas_min_in_row_col = this.cuas_min_in_row_col;
...@@ -6332,8 +6401,15 @@ min_str_neib_fpn 0.35 ...@@ -6332,8 +6401,15 @@ 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_lmax_flt_neglim = this.cuas_lmax_flt_neglim;
imp.cuas_lmax_flt_hsigma = this.cuas_lmax_flt_hsigma;
imp.cuas_lmax_flt_lsigma = this.cuas_lmax_flt_lsigma;
imp.cuas_lmax_flt_scale = this.cuas_lmax_flt_scale;
imp.cuas_sky_threshold = this.cuas_sky_threshold;
imp.cuas_sky_offset = this.cuas_sky_offset.clone();
imp.cuas_lmax_fraction = this.cuas_lmax_fraction; imp.cuas_lmax_fraction = this.cuas_lmax_fraction;
imp.cuas_lmax_hack_ridge = this.cuas_lmax_hack_ridge;
imp.cuas_lmax_radius = this.cuas_lmax_radius; imp.cuas_lmax_radius = this.cuas_lmax_radius;
imp.cuas_lmax_zero = this.cuas_lmax_zero; imp.cuas_lmax_zero = this.cuas_lmax_zero;
...@@ -6373,6 +6449,7 @@ min_str_neib_fpn 0.35 ...@@ -6373,6 +6449,7 @@ min_str_neib_fpn 0.35
imp.cuas_factor_lim = this.cuas_factor_lim; imp.cuas_factor_lim = this.cuas_factor_lim;
imp.cuas_factor_pow = this.cuas_factor_pow; imp.cuas_factor_pow = this.cuas_factor_pow;
imp.cuas_score_coeff = this.cuas_score_coeff.clone(); imp.cuas_score_coeff = this.cuas_score_coeff.clone();
imp.cuas_center_targ = this.cuas_center_targ;
imp.cuas_isolated = this.cuas_isolated; imp.cuas_isolated = this.cuas_isolated;
imp.cuas_remove_2seq = this.cuas_remove_2seq; imp.cuas_remove_2seq = this.cuas_remove_2seq;
......
...@@ -4851,22 +4851,15 @@ public class OpticalFlow { ...@@ -4851,22 +4851,15 @@ public class OpticalFlow {
double min_ref_frac= clt_parameters.imp.min_ref_frac; double min_ref_frac= clt_parameters.imp.min_ref_frac;
boolean cuas_subtract_fpn = clt_parameters.imp.cuas_subtract_fpn; boolean cuas_subtract_fpn = clt_parameters.imp.cuas_subtract_fpn;
/// boolean cuas_calc_fpn = clt_parameters.imp.cuas_calc_fpn;
/// double cuas_rot_period = clt_parameters.imp.cuas_rot_period;
boolean cuas_subtract_rowcol=clt_parameters.imp.cuas_subtract_rowcol;// Subtract row/column noise boolean cuas_subtract_rowcol=clt_parameters.imp.cuas_subtract_rowcol;// Subtract row/column noise
/// boolean cuas_calc_rowcol= clt_parameters.imp.cuas_calc_rowcol; // Recalculate+save row/column noise, if false - try to read saved one first
/// double cuas_um_sigma = clt_parameters.imp.cuas_um_sigma; // Apply Unsharp Mask filter sigma when calculating row/column noise
/// double cuas_max_abs_rowcol= clt_parameters.imp.cuas_max_abs_rowcol; // consider pixels with abs(UM difference) does not exceed this value
/// double cuas_outliers_rowcol=clt_parameters.imp.cuas_outliers_rowcol;// scale weight of the outliers with high difference (to prevent undefined values
boolean cuas_debug = clt_parameters.imp.cuas_debug; // save debug images (and show them if not in batch mode) boolean cuas_debug = clt_parameters.imp.cuas_debug; // save debug images (and show them if not in batch mode)
boolean cuas_step_debug = clt_parameters.imp.cuas_step_debug; boolean cuas_step_debug = clt_parameters.imp.cuas_step_debug;
boolean cuas_reset_first= clt_parameters.imp.cuas_reset_first && first_in_series; boolean cuas_reset_first= clt_parameters.imp.cuas_reset_first && first_in_series;
/// int cuas_invert_margins = clt_parameters.imp.cuas_invert_margins; // 1 Expand image each side when inverting tasks
/// int cuas_invert_iters = clt_parameters.imp.cuas_invert_iters; // 4 Enhance inversion iterations boolean combine_clt = clt_parameters.imp.cuas_rotation; // (cuas_atr[0] != 0) || (cuas_atr[1] != 0) || (cuas_atr[2] != 0);
/// double cuas_invert_tolerance = clt_parameters.imp.cuas_invert_tolerance;// 0.001 Finish enhancing when last change was lower than boolean update_existing = clt_parameters.imp.cuas_update_existing; // re-create center_CLT if it exists (FIXME: accumulates errors - need fixing)
/// int cuas_invert_gap2 = clt_parameters.imp.cuas_invert_gap2; // 10 Maximal dual gap size for inversion (depends on scanning radius in tiles)
double [] ref_blue_sky = null; // turn off "lma" in the ML output double [] ref_blue_sky = null; // turn off "lma" in the ML output
if (reuse_video) { // disable all other options if (reuse_video) { // disable all other options
...@@ -5252,7 +5245,7 @@ public class OpticalFlow { ...@@ -5252,7 +5245,7 @@ public class OpticalFlow {
// use master_clt? - where to look for stage. in CUAS mode build directory name and look there // use master_clt? - where to look for stage. in CUAS mode build directory name and look there
if (center_CLT != null) { if (center_CLT != null) {
if (center_CLT.getNumOrient() == 0) { if (center_CLT.getNumOrient() == 0) {
if (debugLevel >-3) { if (debugLevel >-4) {
System.out.println("center_CLT exists, but does not have egomotion data. Forcing its calculation."); System.out.println("center_CLT exists, but does not have egomotion data. Forcing its calculation.");
} }
force_initial_orientations = true; force_initial_orientations = true;
...@@ -5480,7 +5473,7 @@ public class OpticalFlow { ...@@ -5480,7 +5473,7 @@ public class OpticalFlow {
if (combo_dsn_final == null) { if (combo_dsn_final == null) {
combo_dsn_final =quadCLTs[ref_index].restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky combo_dsn_final =quadCLTs[ref_index].restoreComboDSI(true); // also sets quadCLTs[ref_index].dsi and blue sky
} }
if (debugLevel > -3) { if (debugLevel > -4) {
System.out.println("Creating center_CLT from the reference one (ref_index="+ref_index); System.out.println("Creating center_CLT from the reference one (ref_index="+ref_index);
} }
center_CLT = Cuas.createCenterClt( // assuming cuas_rotation is true center_CLT = Cuas.createCenterClt( // assuming cuas_rotation is true
...@@ -5493,7 +5486,7 @@ public class OpticalFlow { ...@@ -5493,7 +5486,7 @@ public class OpticalFlow {
sensor_mask_clt, // int sensor_mask, // -1 - all; sensor_mask_clt, // int sensor_mask, // -1 - all;
true, // boolean // new_average, true, // boolean // new_average,
debugLevel); // int debugLevel) debugLevel); // int debugLevel)
if (debugLevel > -3) { if (debugLevel > -4) {
System.out.println("Cuas.createCenterClt() done, center_CLT="+((center_CLT==null)? "null":center_CLT.toString())); System.out.println("Cuas.createCenterClt() done, center_CLT="+((center_CLT==null)? "null":center_CLT.toString()));
} }
} }
...@@ -6040,7 +6033,6 @@ public class OpticalFlow { ...@@ -6040,7 +6033,6 @@ public class OpticalFlow {
System.out.println ("Omegas ATR: "+center_ATR[2][0]+", "+center_ATR[2][1]+", "+center_ATR[2][2]); System.out.println ("Omegas ATR: "+center_ATR[2][0]+", "+center_ATR[2][1]+", "+center_ATR[2][2]);
} }
boolean combine_clt = clt_parameters.imp.cuas_rotation; // (cuas_atr[0] != 0) || (cuas_atr[1] != 0) || (cuas_atr[2] != 0);
// TODO: Refine center_CLT if it exists, not create // TODO: Refine center_CLT if it exists, not create
...@@ -6071,13 +6063,13 @@ public class OpticalFlow { ...@@ -6071,13 +6063,13 @@ public class OpticalFlow {
if (cuas_centers != null) { if (cuas_centers != null) {
cuas_centers[1] = center_CLT.getImagePath(); cuas_centers[1] = center_CLT.getImagePath();
} }
if (debugLevel > -3) { if (debugLevel > -4) {
System.out.println("Created/saved center CLT "+center_CLT.getImagePath()); System.out.println("Created/saved center CLT "+center_CLT.getImagePath());
} }
dbg_created=true; dbg_created=true;
} else { } else if (update_existing) {
if (debugLevel > -3) { if (debugLevel > -4) {
System.out.println("Updating CLT"); System.out.println("Updating existing CLT (FIXME: accumulates errors - needs fixing)");
} }
boolean condition_dsi = true; boolean condition_dsi = true;
if (combo_dsn_final == null) { if (combo_dsn_final == null) {
...@@ -6096,12 +6088,15 @@ public class OpticalFlow { ...@@ -6096,12 +6088,15 @@ public class OpticalFlow {
if (cuas_centers != null) { if (cuas_centers != null) {
cuas_centers[1] = center_CLT.getImagePath(); cuas_centers[1] = center_CLT.getImagePath();
} }
if (debugLevel > -3) { if (debugLevel > -4) {
System.out.println("Updated/saved center CLT "+center_CLT.getImagePath()); System.out.println("Updated/saved center CLT "+center_CLT.getImagePath());
} }
} else {
if (debugLevel > -4) {
System.out.println("Spipping update of center CLT (it is reaed from "+center_CLT.getImagePath()+").");
}
} }
// setCenterAverage(); // setCenterAverage();
ImagePlus imp_center_clt= center_CLT.showCenterClt( ImagePlus imp_center_clt= center_CLT.showCenterClt(
null, // float [][] fclt, // may be null null, // float [][] fclt, // may be null
...@@ -7287,7 +7282,8 @@ public class OpticalFlow { ...@@ -7287,7 +7282,8 @@ public class OpticalFlow {
String [] bkp_sourcePaths = quadCLT_main.correctionsParameters.sourcePaths; String [] bkp_sourcePaths = quadCLT_main.correctionsParameters.sourcePaths;
boolean bkp_use_set_dirs = quadCLT_main.correctionsParameters.use_set_dirs; boolean bkp_use_set_dirs = quadCLT_main.correctionsParameters.use_set_dirs;
String bkp_cuasUasLogs = quadCLT_main.correctionsParameters.cuasUasLogs; // json file path containing UAS logs String bkp_cuasUasLogs = quadCLT_main.correctionsParameters.cuasSkyMask; // TIFF image 640x512 where 1.0 - sky, 0.0 - ground, blurred with GB (now sigma==2.0)
String bkp_cuasSkyMask = quadCLT_main.correctionsParameters.cuasUasLogs; // json file path containing UAS logs
double bkp_cuasUasTimeStamp = quadCLT_main.correctionsParameters.cuasUasTimeStamp; // 0.0; // timestamp corresponding to the UAS time 0.0 double bkp_cuasUasTimeStamp = quadCLT_main.correctionsParameters.cuasUasTimeStamp; // 0.0; // timestamp corresponding to the UAS time 0.0
double [] bkp_cuasCameraATR = quadCLT_main.correctionsParameters.cuasCameraATR; //{0, 0, 0}; double [] bkp_cuasCameraATR = quadCLT_main.correctionsParameters.cuasCameraATR; //{0, 0, 0};
double [] bkp_cuasUASHome = quadCLT_main.correctionsParameters.cuasUASHome; //{0, 0, 0}; double [] bkp_cuasUASHome = quadCLT_main.correctionsParameters.cuasUASHome; //{0, 0, 0};
...@@ -7301,7 +7297,6 @@ public class OpticalFlow { ...@@ -7301,7 +7297,6 @@ public class OpticalFlow {
} }
quadCLT_main.correctionsParameters.linkedModels = bkp_linkedModels; quadCLT_main.correctionsParameters.linkedModels = bkp_linkedModels;
quadCLT_main.correctionsParameters.linkedCenters = bkp_linkedCenters; quadCLT_main.correctionsParameters.linkedCenters = bkp_linkedCenters;
/// quadCLT_main.correctionsParameters.cuasSeed = bkp_cuasSeed;
quadCLT_main.correctionsParameters.cuasSeedDir = bkp_cuasSeedDir; quadCLT_main.correctionsParameters.cuasSeedDir = bkp_cuasSeedDir;
quadCLT_main.correctionsParameters.videoDirectory = bkp_videoDirectory; quadCLT_main.correctionsParameters.videoDirectory = bkp_videoDirectory;
quadCLT_main.correctionsParameters.x3dDirectory = bkp_x3dDirectory; quadCLT_main.correctionsParameters.x3dDirectory = bkp_x3dDirectory;
...@@ -7315,6 +7310,7 @@ public class OpticalFlow { ...@@ -7315,6 +7310,7 @@ public class OpticalFlow {
quadCLT_main.correctionsParameters.cuasCameraATR = bkp_cuasCameraATR; quadCLT_main.correctionsParameters.cuasCameraATR = bkp_cuasCameraATR;
quadCLT_main.correctionsParameters.cuasUASHome = bkp_cuasUASHome; quadCLT_main.correctionsParameters.cuasUASHome = bkp_cuasUASHome;
quadCLT_main.correctionsParameters.cuasSetHome = bkp_cuasSetHome; quadCLT_main.correctionsParameters.cuasSetHome = bkp_cuasSetHome;
quadCLT_main.correctionsParameters.cuasSkyMask = bkp_cuasSkyMask;
System.out.println("buildSeries(): DONE"); // System.out.println("buildSeries(): DONE"); //
// String top_dir0=quadCLTs[ref_index].getX3dTopDirectory(); // String top_dir0=quadCLTs[ref_index].getX3dTopDirectory();
......
...@@ -8645,6 +8645,9 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8645,6 +8645,9 @@ if (debugLevel > -100) return true; // temporarily !
cuas_centers = new String [] {quadCLT_main.correctionsParameters.getCuasDir(),""}; cuas_centers = new String [] {quadCLT_main.correctionsParameters.getCuasDir(),""};
} }
*/ */
String uas_sky_mask_path = quadCLT_main.correctionsParameters.getUasSkyMask();
for (int nseq = 0; nseq < num_seq; nseq++) { for (int nseq = 0; nseq < num_seq; nseq++) {
long start_time_seq = System.nanoTime(); long start_time_seq = System.nanoTime();
System.out.println("\nSTARTED PROCESSING SCENE SEQUENCE "+nseq+" (last is "+(num_seq-1)+")\n"); System.out.println("\nSTARTED PROCESSING SCENE SEQUENCE "+nseq+" (last is "+(num_seq-1)+")\n");
...@@ -8668,6 +8671,10 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8668,6 +8671,10 @@ if (debugLevel > -100) return true; // temporarily !
clt_parameters.imp.mov_max_len+" tiles."); clt_parameters.imp.mov_max_len+" tiles.");
} }
} }
clt_parameters.imp.cuas_sky_path = uas_sky_mask_path;
if (clt_parameters.imp.cuas_sky_path != null) {
clt_parameters.imp.cuas_sky_offset = new double[] {pathFirstLast[nseq].mask_x,pathFirstLast[nseq].mask_y};
}
} }
String [][] video_list = new String[1][]; String [][] video_list = new String[1][];
...@@ -8676,9 +8683,6 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8676,9 +8683,6 @@ if (debugLevel > -100) return true; // temporarily !
int [] start_ref_pointers = new int[2]; //{earlist, reference} - reference may be center int [] start_ref_pointers = new int[2]; //{earlist, reference} - reference may be center
boolean first_in_series = true; boolean first_in_series = true;
// Process UAS logs // Process UAS logs
// quadCLT_main.correctionsParameters.cuasUasLogs, // String cuasUasLogs,
// quadCLT_main.correctionsParameters.cuasUasTimeStamp, // double cuasUasTimeStamp,
// quadCLT_main.correctionsParameters.cuasCameraATR, // double [] cuasCameraATR,
UasLogReader uasLogReader = null; UasLogReader uasLogReader = null;
String uas_log_path = quadCLT_main.correctionsParameters.getUasLogsPath(); String uas_log_path = quadCLT_main.correctionsParameters.getUasLogsPath();
if ((uas_log_path != null) && (uas_log_path.length() > 0)) { if ((uas_log_path != null) && (uas_log_path.length() > 0)) {
...@@ -8686,6 +8690,8 @@ if (debugLevel > -100) return true; // temporarily ! ...@@ -8686,6 +8690,8 @@ if (debugLevel > -100) return true; // temporarily !
uasLogReader.setCameraATR(quadCLT_main.correctionsParameters.cuasCameraATR); uasLogReader.setCameraATR(quadCLT_main.correctionsParameters.cuasCameraATR);
uasLogReader.setUASHomeNed(quadCLT_main.correctionsParameters.cuasSetHome? quadCLT_main.correctionsParameters.cuasUASHome : null); uasLogReader.setUASHomeNed(quadCLT_main.correctionsParameters.cuasSetHome? quadCLT_main.correctionsParameters.cuasUASHome : null);
} }
while ((ref_index < 0) || ((ref_index + 1) >= min_num_scenes)) { while ((ref_index < 0) || ((ref_index + 1) >= min_num_scenes)) {
String model_directory = opticalFlow.buildSeries( String model_directory = opticalFlow.buildSeries(
(pathFirstLast != null), //boolean batch_mode, (pathFirstLast != null), //boolean batch_mode,
......
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