Commit df71e1d0 authored by Andrey Filippov's avatar Andrey Filippov

Before removing hardwired conditionInitialDS

parent 33b2b603
...@@ -1569,6 +1569,7 @@ public class EyesisCorrectionParameters { ...@@ -1569,6 +1569,7 @@ public class EyesisCorrectionParameters {
// first - scan all file and set sourceDirectory, x3dDirectory, linkedModels,videoDirectory,resultsDirectory // first - scan all file and set sourceDirectory, x3dDirectory, linkedModels,videoDirectory,resultsDirectory
HashMap<String,String> dir_map = new HashMap<String,String>(); HashMap<String,String> dir_map = new HashMap<String,String>();
for (String line:lines){ for (String line:lines){
if (line.split("#").length > 0) {
String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+"); String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+");
if ((tokens.length > 2) && (tokens[0].toUpperCase().equals("SET"))) { if ((tokens.length > 2) && (tokens[0].toUpperCase().equals("SET"))) {
parse_set: parse_set:
...@@ -1581,6 +1582,7 @@ public class EyesisCorrectionParameters { ...@@ -1581,6 +1582,7 @@ public class EyesisCorrectionParameters {
System.out.println("*********** Unknown SET: "+tokens[1]+" in line: "+line); System.out.println("*********** Unknown SET: "+tokens[1]+" in line: "+line);
} }
} }
}
} }
if (dir_map.containsKey("rootDirectory")) { if (dir_map.containsKey("rootDirectory")) {
base_path=base_path.resolve(Paths.get(dir_map.get("rootDirectory"))); base_path=base_path.resolve(Paths.get(dir_map.get("rootDirectory")));
...@@ -1634,20 +1636,22 @@ public class EyesisCorrectionParameters { ...@@ -1634,20 +1636,22 @@ public class EyesisCorrectionParameters {
} }
// process source sequence directories // process source sequence directories
ArrayList<PathFirstLast> path_list= new ArrayList<PathFirstLast>(); ArrayList<PathFirstLast> path_list= new ArrayList<PathFirstLast>();
for (String line:lines){ for (String line:lines){
String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+"); if (line.split("#").length > 0) {
if ((tokens.length > 0) && String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+");
(tokens[0].length() > 0) && if ((tokens.length > 0) &&
(!tokens[0].toUpperCase().equals("SET")) (tokens[0].length() > 0) &&
) { (!tokens[0].toUpperCase().equals("SET"))
Path dir_path = source_path.resolve(Paths.get(tokens[0])); ) {
path_list.add(new PathFirstLast( Path dir_path = source_path.resolve(Paths.get(tokens[0]));
dir_path.toString(), path_list.add(new PathFirstLast(
((tokens.length > 1)? Integer.parseInt(tokens[1]):0), dir_path.toString(),
((tokens.length > 2)? Integer.parseInt(tokens[2]):-1), ((tokens.length > 1)? Integer.parseInt(tokens[1]):0),
((tokens.length > 3)? Integer.parseInt(tokens[3]):-1))); ((tokens.length > 2)? Integer.parseInt(tokens[2]):-1),
} ((tokens.length > 3)? Integer.parseInt(tokens[3]):-1)));
} }
}
}
return path_list.toArray(new PathFirstLast[0]); return path_list.toArray(new PathFirstLast[0]);
} }
......
...@@ -31,11 +31,28 @@ public class EventLogger { ...@@ -31,11 +31,28 @@ public class EventLogger {
e.printStackTrace(); e.printStackTrace();
} }
} }
Arrays.sort(logger_files); // increasing start time stamps Arrays.sort(logger_files); // increasing start time stamps
String out_did_gps_path = "/home/elphel/lwir16-proc/office_04/did_gps";
int gps_mask = 7; // +1 - DID_GPS1_POS, +2 - DID_GPS2_POS, +4 - DID_GPS1_UBX_POS
for (int nf = 0; nf < logger_files.length; nf++) {
System.out.println("Printing all DID_INS_1 data in "+logger_files[nf].abs_path);
try {
logger_files[nf].listGPS(out_did_gps_path+"-"+String.format("%03d", nf)+".out", gps_mask, false);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
String out_did1_path = "/home/elphel/lwir16-proc/office_04/did_ins1";
for (int nf = 0; nf < logger_files.length; nf++) { for (int nf = 0; nf < logger_files.length; nf++) {
System.out.println("Printing all DID_INS_1 data in "+logger_files[nf].abs_path); System.out.println("Printing all DID_INS_1 data in "+logger_files[nf].abs_path);
try { try {
logger_files[nf].listDid1(false); logger_files[nf].listDid1(out_did1_path+"-"+String.format("%03d", nf)+".out",false);
} catch (IOException e) { } catch (IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
......
package com.elphel.imagej.ims; package com.elphel.imagej.ims;
import java.awt.Point; import java.awt.Point;
import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
...@@ -381,12 +382,15 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> { ...@@ -381,12 +382,15 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
} }
} }
public void listDid1( boolean keep) throws IOException { public void listDid1(String path, boolean keep) throws IOException {
double max_offset = 1000; // m double max_offset = 1000; // m
open(); open();
float [] start_ned = null; float [] start_ned = null;
System.out.println ( FileWriter writer = null;
"record "+ if (path != null) {
writer = new FileWriter (path);
}
String header = "record "+
" master TS "+ " master TS "+
" local TS "+ " local TS "+
"timeOfWeek " + "timeOfWeek " +
...@@ -395,9 +399,13 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> { ...@@ -395,9 +399,13 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
" theta "+ " theta "+
" uvw "+ " uvw "+
" lla "+ " lla "+
" ned " " ned \n";
); if (writer != null) {
writer.write(header);
} else {
System.out.print(header);
}
int type = (EventLoggerFileInfo.REC_TYPE_GPS << 4) | EventLoggerFileInfo.REC_SUBTYPE_IMX5; // 0x18 - first subpacket int type = (EventLoggerFileInfo.REC_TYPE_GPS << 4) | EventLoggerFileInfo.REC_SUBTYPE_IMX5; // 0x18 - first subpacket
for (int nrec = 0; nrec < num_recs; nrec++) { for (int nrec = 0; nrec < num_recs; nrec++) {
int [] full_type = getFullType(bb, nrec); int [] full_type = getFullType(bb, nrec);
...@@ -413,7 +421,7 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> { ...@@ -413,7 +421,7 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
bb_payload.order(ByteOrder.LITTLE_ENDIAN); bb_payload.order(ByteOrder.LITTLE_ENDIAN);
Did_ins_1 did_ins_1 = new Did_ins_1(bb_payload); Did_ins_1 did_ins_1 = new Did_ins_1(bb_payload);
if ((did_ins_1.uvw[0] == 0) && (did_ins_1.uvw[1] == 0) && (did_ins_1.uvw[2] == 0)) { if ((did_ins_1.uvw[0] == 0) && (did_ins_1.uvw[1] == 0) && (did_ins_1.uvw[2] == 0)) {
// continue; continue;
} }
if ((start_ned != null) && if ((start_ned != null) &&
( (Math.abs(start_ned[0] - did_ins_1.ned[0]) > max_offset) || ( (Math.abs(start_ned[0] - did_ins_1.ned[0]) > max_offset) ||
...@@ -426,9 +434,9 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> { ...@@ -426,9 +434,9 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
start_ned = did_ins_1.ned.clone(); start_ned = did_ins_1.ned.clone();
} }
start_ned = new float[] {0,0,0}; start_ned = new float[] {0,0,0};
System.out.println (String.format( String line =String.format(
"%6d %17.6f %17.6f %10.3f %08x %08x [%8.4f, %8.4f, %8.4f] "+ "%6d %17.6f %17.6f %10.3f %08x %08x [%8.4f, %8.4f, %8.4f] "+
"[%8.3f, %8.3f, %8.3f] [%12.7f, %12.7f, %12.7f] [%8.3f, %8.3f, %8.3f]", "[%8.3f, %8.3f, %8.3f] [%12.7f, %12.7f, %12.7f] [%8.3f, %8.3f, %8.3f]\n",
nrec, nrec,
getMasterTS(nrec), getMasterTS(nrec),
getLocalTS(nrec), getLocalTS(nrec),
...@@ -439,16 +447,127 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> { ...@@ -439,16 +447,127 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
did_ins_1.uvw[0], did_ins_1.uvw[1], did_ins_1.uvw[2], // Velocity U, V, W in meters per second. Convert to NED velocity using "vectorBodyToReference( uvw, theta, vel_ned )". did_ins_1.uvw[0], did_ins_1.uvw[1], did_ins_1.uvw[2], // Velocity U, V, W in meters per second. Convert to NED velocity using "vectorBodyToReference( uvw, theta, vel_ned )".
did_ins_1.lla[0], did_ins_1.lla[1], did_ins_1.lla[2], // WGS84 latitude, longitude, height above ellipsoid (degrees,degrees,meters) did_ins_1.lla[0], did_ins_1.lla[1], did_ins_1.lla[2], // WGS84 latitude, longitude, height above ellipsoid (degrees,degrees,meters)
did_ins_1.ned[0] - start_ned[0], did_ins_1.ned[1] - start_ned[1], did_ins_1.ned[2] - start_ned[2] // North, east and down (meters) offset from reference latitude, longitude, and altitude to current latitude, longitude, and altitude did_ins_1.ned[0] - start_ned[0], did_ins_1.ned[1] - start_ned[1], did_ins_1.ned[2] - start_ned[2] // North, east and down (meters) offset from reference latitude, longitude, and altitude to current latitude, longitude, and altitude
)); );
if (writer != null) {
writer.write(line);
} else {
System.out.print(line);
}
} }
} }
if (writer != null) {
writer.close();
}
if (!keep) { if (!keep) {
close(); close();
} }
} }
public void listGPS (String path, int gps_mask, boolean keep) throws IOException {
// +1 - DID_GPS1_POS, +2 - DID_GPS2_POS, +4 - DID_GPS1_UBX_POS
// double max_offset = 1000; // m
open();
// float [] start_ned = null;
FileWriter writer = null;
if (path != null) {
writer = new FileWriter (path);
}
String header = "record "+
" master TS "+
" local TS "+
"timeOfWeek " +
"did "+
" status "+
" ecef "+
" lla "+
" hMSL "+ // 7.2f
" hAcc "+ // 7.3f
" vAcc "+ // 7.3f
" pDop "+ // 7.3f
"cnoMean "+ // 7.3f
" towOffset "+ // 11.4f
" lS " + // 3d
"sat " + // 3d
"sgm " + // 3d
"rsv\n";// 3d
if (writer != null) {
writer.write(header);
} else {
System.out.print(header);
}
int type = (EventLoggerFileInfo.REC_TYPE_GPS << 4) | EventLoggerFileInfo.REC_SUBTYPE_IMX5; // 0x18 - first subpacket
for (int nrec = 0; nrec < num_recs; nrec++) {
int [] full_type = getFullType(bb, nrec);
if ((full_type != null) && (full_type[0] == type) &&
(
(((gps_mask & 1) != 0) && (full_type[1] == Imx5.DID_GPS1_POS)) ||
(((gps_mask & 2) != 0) && (full_type[1] == Imx5.DID_GPS2_POS)) ||
(((gps_mask & 4) != 0) && (full_type[1] == Imx5.DID_GPS1_UBX_POS))
)
) {
byte [] payload = getDidPayload(
null, // next_fileinfo, // may be null if payload does not extend beyond single record
nrec);
if (payload == null) {
System.out.println("EventLoggerFileInfo(): payload == null, nrec="+nrec);
break;
}
ByteBuffer bb_payload = ByteBuffer.wrap(payload);
bb_payload.order(ByteOrder.LITTLE_ENDIAN);
Did_gps_pos did_gps_pos = new Did_gps_pos(bb_payload);
if ((did_gps_pos.lla[0] == 0) && (did_gps_pos.lla[1] == 0) && (did_gps_pos.lla[2] == 0)) {
continue;
}
// replace with GPS fix type?
/*
if ((did_ins_1.uvw[0] == 0) && (did_ins_1.uvw[1] == 0) && (did_ins_1.uvw[2] == 0)) {
continue;
}
if ((start_ned != null) &&
( (Math.abs(start_ned[0] - did_ins_1.ned[0]) > max_offset) ||
(Math.abs(start_ned[1] - did_ins_1.ned[1]) > max_offset) ||
(Math.abs(start_ned[2] - did_ins_1.ned[2]) > max_offset)
)){
start_ned = null;
}
if (start_ned == null) {
start_ned = did_ins_1.ned.clone();
}
start_ned = new float[] {0,0,0};
*/
String line =String.format(
"%6d %17.6f %17.6f %10.3f %3d %08x [%13.4f, %13.4f, %13.4f] "+
"[%12.7f, %12.7f, %12.7f] %7.2f %7.3f %7.3f %7.3f %7.3f %11.4f "+
"%3d %3d %3d %3d\n",
nrec,
getMasterTS(nrec),
getLocalTS(nrec),
0.001 * did_gps_pos.timeOfWeekMs,
full_type[1], // DID
did_gps_pos.status,
did_gps_pos.ecef[0], did_gps_pos.ecef[1], did_gps_pos.ecef[2], // Position in ECEF {x,y,z} (m)
did_gps_pos.lla[0], did_gps_pos.lla[1], did_gps_pos.lla[2], // WGS84 latitude, longitude, height above ellipsoid (degrees,degrees,meters)
did_gps_pos.hMSL, did_gps_pos.hAcc, did_gps_pos.vAcc, did_gps_pos.pDop, did_gps_pos.cnoMean,
did_gps_pos.towOffset,
did_gps_pos.leapS, did_gps_pos.satsUsed, did_gps_pos.cnoMeanSigma, did_gps_pos.reserved
);
if (writer != null) {
writer.write(line);
} else {
System.out.print(line);
}
}
}
if (writer != null) {
writer.close();
}
if (!keep) {
close();
}
}
byte [] getDidPayload( byte [] getDidPayload(
......
...@@ -71,6 +71,7 @@ public class IntersceneMatchParameters { ...@@ -71,6 +71,7 @@ public class IntersceneMatchParameters {
public boolean export_ranges = true; public boolean export_ranges = true;
public boolean debug_ranges = false;
public boolean show_ranges = true; public boolean show_ranges = true;
public boolean export_ml_files = false; // export files for DNN training public boolean export_ml_files = false; // export files for DNN training
...@@ -160,13 +161,43 @@ public class IntersceneMatchParameters { ...@@ -160,13 +161,43 @@ public class IntersceneMatchParameters {
public double sky_bottom_override = -300; // maximal average sky value to override lowest_sky_row test public double sky_bottom_override = -300; // maximal average sky value to override lowest_sky_row test
public int sky_override_shrink = 6; // shrink detected sky before finding hottest tile there public int sky_override_shrink = 6; // shrink detected sky before finding hottest tile there
// processing clouds in the sky // processing clouds in the sky
public boolean clouds_en = true; // enable clouds in the sky detection / processing public boolean clouds_en = true; // enable clouds in the sky detection / processing
public double clouds_fom = 30.0; // maximal FOM for clouds (must be <=) public double clouds_fom = 30.0; // maximal FOM for clouds (must be <=)
public double clouds_spread = 60.0; // maximal spread for clouds (must be <=) public double clouds_spread = 60.0; // maximal spread for clouds (must be <=)
public double clouds_disparity = 0.1; // maximal disparity for strong clouds public double clouds_disparity = 0.1; // maximal disparity for strong clouds
public double clouds_strength = 0.3; // maximal strength for near clouds public double clouds_weak = 0.18; // maximal strength for near definite clouds
public double clouds_strength = 0.25; // minimal strength for far strong clouds (definitely cloud)
public double clouds_not_strength = 0.4; // maximal strength for near maybe clouds (if it has strong cloud neighbor)
public boolean clouds_strong = true; // allow weak cloud if it has strong (1.5x) cloud neib
// process smooth walls mistaken for sky (disable for natural environments)
public boolean wall_en = true; // enable smooth walls detection/processing
public boolean wall_dflt = false; // default (undetected) is wall (false - sky)
public double wall_str = 0.1; // minimal strength of the far object (small - just non-NaN disparity)
public double wall_far = 0.2; // maximal disparity to consider cluster to be sky
public double wall_near = 1.0; // minimal disparity to consider cluster to be wall
// processing far treeline that may be confused with clouds. Only behind far objects such as far horizontal surface.
// Maybe add temperature (treeline warmer than sky)?
public boolean treeline_en = true; // enable treeline processing
public boolean treeline_wide = true; // look not only under, but diagonal too.
public int treeline_height = 8; // maximal height of the treeline (tiles)
public int treeline_width = 3; // minimal horizontal width of the treeline (tiles)
public boolean treeline_lim_high = false; // limit too high treeline (false - delete completely)
public double treeline_str = 0.3; // treeline minimal strength
public double treeline_far = 0.03; // treeline min disparity (pix)
public double treeline_near = 0.4; // treeline max disparity (pix)
public double treeline_fg_str = 0.4; // pre-treeline FG objects (such as flat ground) minimal strength
public double treeline_fg_far = 0.2; // pre-treeline FG objects min disparity (pix)
public double treeline_fg_near = 0.6; // pre-treeline FG objects max disparity (pix)
// suspecting indoors (disabling sky)
public boolean indoors_en = true; // allow weak cloud if it has strong (1.5x) cloud neib
public double indoors_str = 0.5; // minimal strength of the far object
public double indoors_disp = 0.8; // maximal minimal outdoor strong disparity
public int indoors_min_out = 10; // minimal strong far tiles to deny indoors
// Increase fom if there are enough LMA-defined similar tiles around // Increase fom if there are enough LMA-defined similar tiles around
public double disp_boost_min = 0.5; public double disp_boost_min = 0.5;
...@@ -407,6 +438,8 @@ public class IntersceneMatchParameters { ...@@ -407,6 +438,8 @@ public class IntersceneMatchParameters {
"Display generated/saved monochrome images (in addition to color) "); "Display generated/saved monochrome images (in addition to color) ");
gd.addCheckbox ("Generate metric depth map", this.export_ranges, gd.addCheckbox ("Generate metric depth map", this.export_ranges,
"Calculate strength, distance, X, and Y in meters"); "Calculate strength, distance, X, and Y in meters");
gd.addCheckbox ("Debug metric depth map", this.debug_ranges,
"Debug metric depth maps");
gd.addCheckbox ("Show metric depth map", this.show_ranges, gd.addCheckbox ("Show metric depth map", this.show_ranges,
"Display calculated depth map in meters"); "Display calculated depth map in meters");
gd.addCheckbox ("Export files for DNN training/testing", this.export_ml_files, gd.addCheckbox ("Export files for DNN training/testing", this.export_ml_files,
...@@ -591,8 +624,60 @@ public class IntersceneMatchParameters { ...@@ -591,8 +624,60 @@ public class IntersceneMatchParameters {
"Maximal spread for clouds (must be <=)."); "Maximal spread for clouds (must be <=).");
gd.addNumericField("Clouds disparity", this.clouds_disparity, 5,7,"pix", gd.addNumericField("Clouds disparity", this.clouds_disparity, 5,7,"pix",
"Maximal disparity for strong clouds."); "Maximal disparity for strong clouds.");
gd.addNumericField("Clouds strength", this.clouds_strength, 5,7,"", gd.addNumericField("Clouds weak", this.clouds_weak, 5,7,"",
"Maximal strength for near clouds."); "Maximal strength for near definite clouds.");
gd.addNumericField("Clouds sure strength", this.clouds_strength, 5,7,"",
"Minimal strength for far strong clouds (definitely cloud).");
gd.addNumericField("Non-clouds strength", this.clouds_not_strength, 5,7,"",
"Maximal strength for near maybe clouds (if it has strong cloud neighbor). Stronger near - definitely not clouds.");
gd.addCheckbox ("Clouds by strong neighbor", this.clouds_strong,
"Treat weak non-cloud as cloud if it has strong (1.5x strength) cloud neighbor.");
gd.addMessage ("Detect smooth walls mistaken for sky. Disable for natural environments");
gd.addCheckbox ("Detect smooth walls", this.wall_en,
"Suspect isolated sky clusters to be smooth walls.");
gd.addCheckbox ("Walls default", this.wall_dflt,
"If unsure (both or none) - treat as a wall (false - as sky).");
gd.addNumericField("Wall strength", this.wall_str, 5,7,"",
"Minimal strength to consider cluster to be a wall or sky. Use very small to use any non-NAN disparity.");
gd.addNumericField("Wall far", this.wall_far, 5,7,"pix",
"Maximal disparity to designate cluster as sky.");
gd.addNumericField("Wall near", this.wall_near, 5,7,"pix",
"Minimal disparity to designate cluster as a wall.");
gd.addMessage ("Processing far treeline/mountains that may be confused with clouds. Only behind far objects such as far horizontal surface");
gd.addCheckbox ("Enable treeline processing", this.treeline_en,
"Enable treeline processing (reduces sky/clouds).");
gd.addCheckbox ("Look not only under, but diagonal too", this.treeline_wide,
"Look not only under, but diagonal too.");
gd.addNumericField("Maximal treeline height", this.treeline_height, 0,3,"tiles",
"Maximal height of the treeline. Increase for mountain ridges.");
gd.addNumericField("Minimal treeline width", this.treeline_width, 0,3,"tiles",
"Minimal horizontal width of the treeline.");
gd.addCheckbox ("Limit treeline height (not delete it)", this.treeline_lim_high,
"Limit too high treeline (false - delete completely).");
gd.addNumericField("Treeline min strength", this.treeline_str, 5,7,"",
"Treeline min strength.");
gd.addNumericField("Treeline min disparity", this.treeline_far, 5,7,"pix",
"Treeline min (far) disparity.");
gd.addNumericField("Treeline max disparity", this.treeline_near, 5,7,"pix",
"Treeline max (near) disparity.");
gd.addNumericField("Pre-treeline FG min strength", this.treeline_fg_str, 5,7,"",
"Pre-treeline FG objects (such as flat ground) minimal strength.");
gd.addNumericField("Pre-treeline FG min disparity", this.treeline_fg_far, 5,7,"pix",
"Pre-treeline FG min (far) disparity.");
gd.addNumericField("Pre-treeline FG max disparity", this.treeline_fg_near, 5,7,"pix",
"Pre-treeline FG max (near) disparity.");
gd.addMessage ("Detect indoors (and disable sky)");
gd.addCheckbox ("Enable indoors", this.indoors_en,
"Enable indoors detection and disable sky (if detected).");
gd.addNumericField("Outdoors objects minimal strength", this.indoors_str, 5,7,"",
"Minimal strength of outdoors (far) objects.");
gd.addNumericField("Outdoors disparity", this.indoors_disp, 5,7,"pix",
"Maximal disparity for strong outdoors objects.");
gd.addNumericField("Minimal outdoor tiles", this.indoors_min_out, 0,3,"tiles",
"Minimal number of far strong tiles to deny indoor mode.");
gd.addMessage ("Boost FOM if there are enough LMA-defined good neighbors around (Thin wires over the sky)"); gd.addMessage ("Boost FOM if there are enough LMA-defined good neighbors around (Thin wires over the sky)");
gd.addNumericField("Minimal disparity", this.disp_boost_min, 5,7,"pix", gd.addNumericField("Minimal disparity", this.disp_boost_min, 5,7,"pix",
...@@ -902,6 +987,7 @@ public class IntersceneMatchParameters { ...@@ -902,6 +987,7 @@ public class IntersceneMatchParameters {
this.show_images_bgfg = gd.getNextBoolean(); this.show_images_bgfg = gd.getNextBoolean();
this.show_images_mono = gd.getNextBoolean(); this.show_images_mono = gd.getNextBoolean();
this.export_ranges = gd.getNextBoolean(); this.export_ranges = gd.getNextBoolean();
this.debug_ranges = gd.getNextBoolean();
this.show_ranges = gd.getNextBoolean(); this.show_ranges = gd.getNextBoolean();
this.export_ml_files = gd.getNextBoolean(); this.export_ml_files = gd.getNextBoolean();
...@@ -994,8 +1080,34 @@ public class IntersceneMatchParameters { ...@@ -994,8 +1080,34 @@ public class IntersceneMatchParameters {
this.clouds_fom = gd.getNextNumber(); this.clouds_fom = gd.getNextNumber();
this.clouds_spread = gd.getNextNumber(); this.clouds_spread = gd.getNextNumber();
this.clouds_disparity = gd.getNextNumber(); this.clouds_disparity = gd.getNextNumber();
this.clouds_weak = gd.getNextNumber();
this.clouds_strength = gd.getNextNumber(); this.clouds_strength = gd.getNextNumber();
this.clouds_not_strength = gd.getNextNumber();
this.clouds_strong = gd.getNextBoolean();
this.wall_en = gd.getNextBoolean();
this.wall_dflt = gd.getNextBoolean();
this.wall_str = gd.getNextNumber();
this.wall_far = gd.getNextNumber();
this.wall_near = gd.getNextNumber();
this.treeline_en = gd.getNextBoolean();
this.treeline_wide = gd.getNextBoolean();
this.treeline_height = (int) gd.getNextNumber();
this.treeline_width = (int) gd.getNextNumber();
this.treeline_lim_high = gd.getNextBoolean();
this.treeline_str = gd.getNextNumber();
this.treeline_far = gd.getNextNumber();
this.treeline_near = gd.getNextNumber();
this.treeline_fg_str = gd.getNextNumber();
this.treeline_fg_far = gd.getNextNumber();
this.treeline_fg_near = gd.getNextNumber();
this.indoors_en = gd.getNextBoolean();
this.indoors_str = gd.getNextNumber();
this.indoors_disp = gd.getNextNumber();
this.indoors_min_out = (int) gd.getNextNumber();
this.disp_boost_min = gd.getNextNumber(); this.disp_boost_min = gd.getNextNumber();
this.disp_boost_diff = gd.getNextNumber(); this.disp_boost_diff = gd.getNextNumber();
this.disp_boost_neibs = (int) gd.getNextNumber(); this.disp_boost_neibs = (int) gd.getNextNumber();
...@@ -1206,8 +1318,9 @@ public class IntersceneMatchParameters { ...@@ -1206,8 +1318,9 @@ public class IntersceneMatchParameters {
properties.setProperty(prefix+"show_images_bgfg", this.show_images_bgfg + ""); // boolean properties.setProperty(prefix+"show_images_bgfg", this.show_images_bgfg + ""); // boolean
properties.setProperty(prefix+"show_images_mono", this.show_images_mono + ""); // boolean properties.setProperty(prefix+"show_images_mono", this.show_images_mono + ""); // boolean
properties.setProperty(prefix+"export_ranges", this.export_ranges + ""); // boolean properties.setProperty(prefix+"export_ranges", this.export_ranges + ""); // boolean
properties.setProperty(prefix+"debug_ranges", this.debug_ranges + ""); // boolean
properties.setProperty(prefix+"show_ranges", this.show_ranges + ""); // boolean properties.setProperty(prefix+"show_ranges", this.show_ranges + ""); // boolean
properties.setProperty(prefix+"export_ml_files", this.export_ml_files + ""); // boolean properties.setProperty(prefix+"export_ml_files", this.export_ml_files + ""); // boolean
properties.setProperty(prefix+"show_color_nan", this.show_color_nan + ""); // boolean properties.setProperty(prefix+"show_color_nan", this.show_color_nan + ""); // boolean
properties.setProperty(prefix+"show_mono_nan", this.show_mono_nan + ""); // boolean properties.setProperty(prefix+"show_mono_nan", this.show_mono_nan + ""); // boolean
...@@ -1290,11 +1403,37 @@ public class IntersceneMatchParameters { ...@@ -1290,11 +1403,37 @@ public class IntersceneMatchParameters {
properties.setProperty(prefix+"clouds_fom", this.clouds_fom+""); // double properties.setProperty(prefix+"clouds_fom", this.clouds_fom+""); // double
properties.setProperty(prefix+"clouds_spread", this.clouds_spread+""); // double properties.setProperty(prefix+"clouds_spread", this.clouds_spread+""); // double
properties.setProperty(prefix+"clouds_disparity", this.clouds_disparity+""); // double properties.setProperty(prefix+"clouds_disparity", this.clouds_disparity+""); // double
properties.setProperty(prefix+"clouds_weak", this.clouds_weak+""); // double
properties.setProperty(prefix+"clouds_strength", this.clouds_strength+""); // double properties.setProperty(prefix+"clouds_strength", this.clouds_strength+""); // double
properties.setProperty(prefix+"clouds_not_strength", this.clouds_not_strength+""); // double
properties.setProperty(prefix+"clouds_strong", this.clouds_strong+""); // boolean
properties.setProperty(prefix+"wall_en", this.wall_en+""); // boolean
properties.setProperty(prefix+"wall_dflt", this.wall_dflt+""); // boolean
properties.setProperty(prefix+"wall_str", this.wall_str+""); // double
properties.setProperty(prefix+"wall_far", this.wall_far+""); // double
properties.setProperty(prefix+"wall_near", this.wall_near+""); // double
properties.setProperty(prefix+"treeline_en", this.treeline_en+""); // boolean
properties.setProperty(prefix+"treeline_wide", this.treeline_wide+""); // boolean
properties.setProperty(prefix+"treeline_height", this.treeline_height+""); // int
properties.setProperty(prefix+"treeline_width", this.treeline_width+""); // int
properties.setProperty(prefix+"treeline_lim_high", this.treeline_lim_high+""); // boolean
properties.setProperty(prefix+"treeline_str", this.treeline_str+""); // double
properties.setProperty(prefix+"treeline_far", this.treeline_far+""); // double
properties.setProperty(prefix+"treeline_near", this.treeline_near+""); // double
properties.setProperty(prefix+"treeline_fg_str", this.treeline_fg_str+""); // double
properties.setProperty(prefix+"treeline_fg_far", this.treeline_fg_far+""); // double
properties.setProperty(prefix+"treeline_fg_near", this.treeline_fg_near+""); // double
properties.setProperty(prefix+"indoors_en", this.indoors_en+""); // boolean
properties.setProperty(prefix+"indoors_str", this.indoors_str+""); // double
properties.setProperty(prefix+"indoors_disp", this.indoors_disp+""); // double
properties.setProperty(prefix+"indoors_min_out", this.indoors_min_out+""); // int
properties.setProperty(prefix+"disp_boost_min", this.disp_boost_min+""); // double properties.setProperty(prefix+"disp_boost_min", this.disp_boost_min+""); // double
properties.setProperty(prefix+"disp_boost_diff", this.disp_boost_diff+""); // int properties.setProperty(prefix+"disp_boost_diff", this.disp_boost_diff+""); // double
properties.setProperty(prefix+"disp_boost_neibs", this.disp_boost_neibs+""); // double properties.setProperty(prefix+"disp_boost_neibs", this.disp_boost_neibs+""); // int
properties.setProperty(prefix+"disp_boost_amount", this.disp_boost_amount+""); // double properties.setProperty(prefix+"disp_boost_amount", this.disp_boost_amount+""); // double
properties.setProperty(prefix+"scale_combo_strength", this.scale_combo_strength+"");// double properties.setProperty(prefix+"scale_combo_strength", this.scale_combo_strength+"");// double
properties.setProperty(prefix+"save_debug_images", this.save_debug_images+""); // boolean properties.setProperty(prefix+"save_debug_images", this.save_debug_images+""); // boolean
...@@ -1455,6 +1594,7 @@ public class IntersceneMatchParameters { ...@@ -1455,6 +1594,7 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"show_images_bgfg")!=null) this.show_images_bgfg=Boolean.parseBoolean(properties.getProperty(prefix+"show_images_bgfg")); if (properties.getProperty(prefix+"show_images_bgfg")!=null) this.show_images_bgfg=Boolean.parseBoolean(properties.getProperty(prefix+"show_images_bgfg"));
if (properties.getProperty(prefix+"show_images_mono")!=null) this.show_images_mono=Boolean.parseBoolean(properties.getProperty(prefix+"show_images_mono")); if (properties.getProperty(prefix+"show_images_mono")!=null) this.show_images_mono=Boolean.parseBoolean(properties.getProperty(prefix+"show_images_mono"));
if (properties.getProperty(prefix+"export_ranges")!=null) this.export_ranges=Boolean.parseBoolean(properties.getProperty(prefix+"export_ranges")); if (properties.getProperty(prefix+"export_ranges")!=null) this.export_ranges=Boolean.parseBoolean(properties.getProperty(prefix+"export_ranges"));
if (properties.getProperty(prefix+"debug_ranges")!=null) this.debug_ranges=Boolean.parseBoolean(properties.getProperty(prefix+"debug_ranges"));
if (properties.getProperty(prefix+"show_ranges")!=null) this.show_ranges=Boolean.parseBoolean(properties.getProperty(prefix+"show_ranges")); if (properties.getProperty(prefix+"show_ranges")!=null) this.show_ranges=Boolean.parseBoolean(properties.getProperty(prefix+"show_ranges"));
if (properties.getProperty(prefix+"export_ml_files")!=null) this.export_ml_files=Boolean.parseBoolean(properties.getProperty(prefix+"export_ml_files")); if (properties.getProperty(prefix+"export_ml_files")!=null) this.export_ml_files=Boolean.parseBoolean(properties.getProperty(prefix+"export_ml_files"));
...@@ -1541,7 +1681,33 @@ public class IntersceneMatchParameters { ...@@ -1541,7 +1681,33 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"clouds_fom")!=null) this.clouds_fom=Double.parseDouble(properties.getProperty(prefix+"clouds_fom")); if (properties.getProperty(prefix+"clouds_fom")!=null) this.clouds_fom=Double.parseDouble(properties.getProperty(prefix+"clouds_fom"));
if (properties.getProperty(prefix+"clouds_spread")!=null) this.clouds_spread=Double.parseDouble(properties.getProperty(prefix+"clouds_spread")); if (properties.getProperty(prefix+"clouds_spread")!=null) this.clouds_spread=Double.parseDouble(properties.getProperty(prefix+"clouds_spread"));
if (properties.getProperty(prefix+"clouds_disparity")!=null) this.clouds_disparity=Double.parseDouble(properties.getProperty(prefix+"clouds_disparity")); if (properties.getProperty(prefix+"clouds_disparity")!=null) this.clouds_disparity=Double.parseDouble(properties.getProperty(prefix+"clouds_disparity"));
if (properties.getProperty(prefix+"clouds_weak")!=null) this.clouds_weak=Double.parseDouble(properties.getProperty(prefix+"clouds_weak"));
if (properties.getProperty(prefix+"clouds_strength")!=null) this.clouds_strength=Double.parseDouble(properties.getProperty(prefix+"clouds_strength")); if (properties.getProperty(prefix+"clouds_strength")!=null) this.clouds_strength=Double.parseDouble(properties.getProperty(prefix+"clouds_strength"));
if (properties.getProperty(prefix+"clouds_not_strength")!=null) this.clouds_not_strength=Double.parseDouble(properties.getProperty(prefix+"clouds_not_strength"));
if (properties.getProperty(prefix+"clouds_strong")!=null) this.clouds_strong=Boolean.parseBoolean(properties.getProperty(prefix+"clouds_strong"));
if (properties.getProperty(prefix+"wall_en")!=null) this.wall_en=Boolean.parseBoolean(properties.getProperty(prefix+"wall_en"));
if (properties.getProperty(prefix+"wall_dflt")!=null) this.indoors_en=Boolean.parseBoolean(properties.getProperty(prefix+"wall_dflt"));
if (properties.getProperty(prefix+"wall_str")!=null) this.wall_str=Double.parseDouble(properties.getProperty(prefix+"wall_str"));
if (properties.getProperty(prefix+"wall_far")!=null) this.wall_far=Double.parseDouble(properties.getProperty(prefix+"wall_far"));
if (properties.getProperty(prefix+"wall_near")!=null) this.wall_near=Double.parseDouble(properties.getProperty(prefix+"wall_near"));
if (properties.getProperty(prefix+"treeline_en")!=null) this.treeline_en=Boolean.parseBoolean(properties.getProperty(prefix+"treeline_en"));
if (properties.getProperty(prefix+"treeline_wide")!=null) this.treeline_wide=Boolean.parseBoolean(properties.getProperty(prefix+"treeline_wide"));
if (properties.getProperty(prefix+"treeline_height")!=null) this.treeline_height=Integer.parseInt(properties.getProperty(prefix+"treeline_height"));
if (properties.getProperty(prefix+"treeline_width")!=null) this.treeline_width=Integer.parseInt(properties.getProperty(prefix+"treeline_width"));
if (properties.getProperty(prefix+"treeline_lim_high")!=null) this.treeline_lim_high=Boolean.parseBoolean(properties.getProperty(prefix+"treeline_lim_high"));
if (properties.getProperty(prefix+"treeline_str")!=null) this.treeline_str=Double.parseDouble(properties.getProperty(prefix+"treeline_str"));
if (properties.getProperty(prefix+"treeline_far")!=null) this.treeline_far=Double.parseDouble(properties.getProperty(prefix+"treeline_far"));
if (properties.getProperty(prefix+"treeline_near")!=null) this.treeline_near=Double.parseDouble(properties.getProperty(prefix+"treeline_near"));
if (properties.getProperty(prefix+"treeline_fg_str")!=null) this.treeline_fg_str=Double.parseDouble(properties.getProperty(prefix+"treeline_fg_str"));
if (properties.getProperty(prefix+"treeline_fg_far")!=null) this.treeline_fg_far=Double.parseDouble(properties.getProperty(prefix+"treeline_fg_far"));
if (properties.getProperty(prefix+"treeline_fg_near")!=null) this.treeline_fg_near=Double.parseDouble(properties.getProperty(prefix+"treeline_fg_near"));
if (properties.getProperty(prefix+"indoors_en")!=null) this.indoors_en=Boolean.parseBoolean(properties.getProperty(prefix+"indoors_en"));
if (properties.getProperty(prefix+"indoors_str")!=null) this.indoors_str=Double.parseDouble(properties.getProperty(prefix+"indoors_str"));
if (properties.getProperty(prefix+"indoors_disp")!=null) this.indoors_disp=Double.parseDouble(properties.getProperty(prefix+"indoors_disp"));
if (properties.getProperty(prefix+"indoors_min_out")!=null) this.indoors_min_out=Integer.parseInt(properties.getProperty(prefix+"indoors_min_out"));
if (properties.getProperty(prefix+"disp_boost_min")!=null) this.disp_boost_min=Double.parseDouble(properties.getProperty(prefix+"disp_boost_min")); if (properties.getProperty(prefix+"disp_boost_min")!=null) this.disp_boost_min=Double.parseDouble(properties.getProperty(prefix+"disp_boost_min"));
if (properties.getProperty(prefix+"disp_boost_diff")!=null) this.disp_boost_diff=Double.parseDouble(properties.getProperty(prefix+"disp_boost_diff")); if (properties.getProperty(prefix+"disp_boost_diff")!=null) this.disp_boost_diff=Double.parseDouble(properties.getProperty(prefix+"disp_boost_diff"));
...@@ -1721,6 +1887,7 @@ public class IntersceneMatchParameters { ...@@ -1721,6 +1887,7 @@ public class IntersceneMatchParameters {
imp.show_images_bgfg = this.show_images_bgfg; imp.show_images_bgfg = this.show_images_bgfg;
imp.show_images_mono = this.show_images_mono; imp.show_images_mono = this.show_images_mono;
imp.export_ranges = this.export_ranges; imp.export_ranges = this.export_ranges;
imp.debug_ranges = this.debug_ranges;
imp.show_ranges = this.show_ranges; imp.show_ranges = this.show_ranges;
imp.export_ml_files = this.export_ml_files; imp.export_ml_files = this.export_ml_files;
...@@ -1808,7 +1975,33 @@ public class IntersceneMatchParameters { ...@@ -1808,7 +1975,33 @@ public class IntersceneMatchParameters {
imp.clouds_fom = this.clouds_fom; imp.clouds_fom = this.clouds_fom;
imp.clouds_spread = this.clouds_spread; imp.clouds_spread = this.clouds_spread;
imp.clouds_disparity = this.clouds_disparity; imp.clouds_disparity = this.clouds_disparity;
imp.clouds_weak = this.clouds_weak;
imp.clouds_strength = this.clouds_strength; imp.clouds_strength = this.clouds_strength;
imp.clouds_not_strength = this.clouds_not_strength;
imp.clouds_strong = this.clouds_strong;
imp.wall_en = this.wall_en;
imp.wall_dflt = this.wall_dflt;
imp.wall_str = this.wall_str;
imp.wall_far = this.wall_far;
imp.wall_near = this.wall_near;
imp.treeline_en = this.treeline_en;
imp.treeline_wide = this.treeline_wide;
imp.treeline_height = this.treeline_height;
imp.treeline_width = this.treeline_width;
imp.treeline_lim_high = this.treeline_lim_high;
imp.treeline_str = this.treeline_str;
imp.treeline_far = this.treeline_far;
imp.treeline_near = this.treeline_near;
imp.treeline_fg_str = this.treeline_fg_str;
imp.treeline_fg_far = this.treeline_fg_far;
imp.treeline_fg_near = this.treeline_fg_near;
imp.indoors_en = this.indoors_en;
imp.indoors_str = this.indoors_str;
imp.indoors_disp = this.indoors_disp;
imp.indoors_min_out = this.indoors_min_out;
imp.disp_boost_min = this.disp_boost_min; imp.disp_boost_min = this.disp_boost_min;
imp.disp_boost_diff = this.disp_boost_diff; imp.disp_boost_diff = this.disp_boost_diff;
......
...@@ -3918,13 +3918,41 @@ public class OpticalFlow { ...@@ -3918,13 +3918,41 @@ public class OpticalFlow {
int disp_boost_neibs = clt_parameters.imp.disp_boost_neibs; // 2; int disp_boost_neibs = clt_parameters.imp.disp_boost_neibs; // 2;
double disp_boost_amount = clt_parameters.imp.disp_boost_amount; // 2.0; double disp_boost_amount = clt_parameters.imp.disp_boost_amount; // 2.0;
boolean clouds_en = clt_parameters.imp.clouds_en; // true; // enable clouds in the sky detection / processing boolean clouds_en = clt_parameters.imp.clouds_en; // true; // enable clouds in the sky detection / processing
double clouds_fom = clt_parameters.imp.clouds_fom; // 30.0; // maximal FOM for clouds (must be <=) double clouds_fom = clt_parameters.imp.clouds_fom; // 30.0; // maximal FOM for clouds (must be <=)
double clouds_spread = clt_parameters.imp.clouds_spread; // 60.0; // maximal spread for clouds (must be <=) double clouds_spread = clt_parameters.imp.clouds_spread; // 60.0; // maximal spread for clouds (must be <=)
double clouds_disparity = clt_parameters.imp.clouds_disparity; // 0.1; // maximal disparity for strong clouds double clouds_disparity = clt_parameters.imp.clouds_disparity; // 0.1; // maximal disparity for strong clouds
double clouds_strength = clt_parameters.imp.clouds_strength; // 0.3; // maximal strength for near clouds double clouds_weak = clt_parameters.imp.clouds_weak; // 0.18;// maximal strength for near definite clouds
double clouds_strength = clt_parameters.imp.clouds_strength; // 0.25;// minimal strength for far strong clouds (definitely cloud)
double clouds_not_strength= clt_parameters.imp.clouds_not_strength;//0.4; // maximal strength for near maybe clouds (if it has strong cloud neighbor)
boolean clouds_strong = clt_parameters.imp.clouds_strong; // true; // allow weak cloud if it has strong (1.5x) cloud neib
// process smooth walls mistaken for sky (disable for natural environments)
boolean wall_en = clt_parameters.imp.wall_en; // true; // enable smooth walls detection/processing
boolean wall_dflt = clt_parameters.imp.wall_dflt; // true; // default (undetected) is wall (false - sky)
double wall_str = clt_parameters.imp.wall_str; // 0.1; // minimal strength of the far object (small - just non-NaN disparity)
double wall_far = clt_parameters.imp.wall_far; // 0.2; // maximal disparity to consider cluster to be sky
double wall_near = clt_parameters.imp.wall_near; // 1.0; // minimal disparity to consider cluster to be wall
// processing far treeline that may be confused with clouds. Only behind far objects such as far horizontal surface.
boolean treeline_en = clt_parameters.imp.treeline_en; // true; // look not only under, but diagonal too.
boolean treeline_wide = clt_parameters.imp.treeline_wide; // true; // enable treeline processing
int treeline_height = clt_parameters.imp.treeline_height; // 5; // maximal height of the treeline (tiles)
int treeline_width = clt_parameters.imp.treeline_width; // 3; // minimal horizontal width of the treeline (tiles)
boolean treeline_lim_high = clt_parameters.imp.treeline_lim_high;// false; // limit too high treeline (false - delete completely)
double treeline_str = clt_parameters.imp.treeline_str; // 0.8; // treeline minimal strength
double treeline_far = clt_parameters.imp.treeline_far; // 0.04; // treeline min disparity (pix)
double treeline_near = clt_parameters.imp.treeline_near; // 0.4; // treeline max disparity (pix)
double treeline_fg_str = clt_parameters.imp.treeline_fg_str; // 0.8; // pre-treeline FG objects (such as flat ground) minimal strength
double treeline_fg_far = clt_parameters.imp.treeline_fg_far; // 0.2; // pre-treeline FG objects min disparity (pix)
double treeline_fg_near = clt_parameters.imp.treeline_fg_near; // 0.5; // pre-treeline FG objects max disparity (pix)
// suspecting indoors (disabling sky)
boolean indoors_en = clt_parameters.imp.indoors_en; // true; // allow weak cloud if it has strong (1.5x) cloud neib
double indoors_str = clt_parameters.imp.indoors_str; // 0.5; // minimal strength of the far object
double indoors_disp = clt_parameters.imp.indoors_disp; // 0.8; // maximal minimal outdoor strong disparity
int indoors_min_out = clt_parameters.imp.indoors_min_out; // 10; // minimal strong far tiles to deny indoors
QuadCLT dbg_scene = clt_parameters.imp.save_debug_images? quadCLT_ref: null; // use to save debug images if not null QuadCLT dbg_scene = clt_parameters.imp.save_debug_images? quadCLT_ref: null; // use to save debug images if not null
boolean [] ref_blue_sky = null; // turn off "lma" in the ML output boolean [] ref_blue_sky = null; // turn off "lma" in the ML output
...@@ -4020,7 +4048,33 @@ public class OpticalFlow { ...@@ -4020,7 +4048,33 @@ public class OpticalFlow {
clouds_fom, // maximal FOM for clouds (must be <=) clouds_fom, // maximal FOM for clouds (must be <=)
clouds_spread, // maximal spread for clouds (must be <=) clouds_spread, // maximal spread for clouds (must be <=)
clouds_disparity, // maximal disparity for strong clouds clouds_disparity, // maximal disparity for strong clouds
clouds_strength, // maximal strength for near clouds clouds_weak, // maximal strength for near definite clouds
clouds_strength, // minimal strength for far strong clouds (definitely cloud)
clouds_not_strength, // maximal strength for near maybe clouds (if it has strong cloud neighbor)
clouds_strong, // true; // allow weak cloud if it has strong (1.5x) cloud neib
wall_en, // enable smooth walls detection/processing
wall_dflt, // default (undetected) is wall (false - sky)
wall_str, // minimal strength of the far object (small - just non-NaN disparity)
wall_far, // maximal disparity to consider cluster to be sky
wall_near, // minimal disparity to consider cluster to be wall
treeline_en, // enable treeline processing
treeline_wide, // look not only under, but diagonal too.
treeline_height, // maximal height of the treeline (tiles)
treeline_width, // minimal horizontal width of the treeline (tiles)
treeline_lim_high, // limit too high treeline (false - delete completely)
treeline_str, // treeline minimal strength
treeline_far, // treeline min disparity (pix)
treeline_near, // treeline max disparity (pix)
treeline_fg_str, // pre-treeline FG objects (such as flat ground) minimal strength
treeline_fg_far, // pre-treeline FG objects min disparity (pix)
treeline_fg_near, // pre-treeline FG objects max disparity (pix)
indoors_en, // true; // allow weak cloud if it has strong (1.5x) cloud neib
indoors_str, // 0.5; // minimal strength of the far object
indoors_disp, // 0.8; // maximal minimal outdoor strong disparity
indoors_min_out, // 10; // minimal strong far tiles to deny indoors
disp_boost_min, // double disp_boost_min, // = 0.5; disp_boost_min, // double disp_boost_min, // = 0.5;
disp_boost_diff, //double disp_boost_diff, // = 0.35; disp_boost_diff, //double disp_boost_diff, // = 0.35;
disp_boost_neibs, //int disp_boost_neibs, // = 2; disp_boost_neibs, //int disp_boost_neibs, // = 2;
...@@ -4125,8 +4179,37 @@ public class OpticalFlow { ...@@ -4125,8 +4179,37 @@ public class OpticalFlow {
double clouds_fom = clt_parameters.imp.clouds_fom; // 30.0; // maximal FOM for clouds (must be <=) double clouds_fom = clt_parameters.imp.clouds_fom; // 30.0; // maximal FOM for clouds (must be <=)
double clouds_spread = clt_parameters.imp.clouds_spread; // 60.0; // maximal spread for clouds (must be <=) double clouds_spread = clt_parameters.imp.clouds_spread; // 60.0; // maximal spread for clouds (must be <=)
double clouds_disparity = clt_parameters.imp.clouds_disparity; // 0.1; // maximal disparity for strong clouds double clouds_disparity = clt_parameters.imp.clouds_disparity; // 0.1; // maximal disparity for strong clouds
double clouds_strength = clt_parameters.imp.clouds_strength; // 0.3; // maximal strength for near clouds double clouds_weak = clt_parameters.imp.clouds_weak; // 0.18;// maximal strength for near definite clouds
double clouds_strength = clt_parameters.imp.clouds_strength; // 0.25;// minimal strength for far strong clouds (definitely cloud)
double clouds_not_strength= clt_parameters.imp.clouds_not_strength;//0.4; // maximal strength for near maybe clouds (if it has strong cloud neighbor)
boolean clouds_strong = clt_parameters.imp.clouds_strong; // true; // allow weak cloud if it has strong (1.5x) cloud neib
// process smooth walls mistaken for sky (disable for natural environments)
boolean wall_en = clt_parameters.imp.wall_en; // true; // enable smooth walls detection/processing
boolean wall_dflt = clt_parameters.imp.wall_dflt; // true; // default (undetected) is wall (false - sky)
double wall_str = clt_parameters.imp.wall_str; // 0.1; // minimal strength of the far object (small - just non-NaN disparity)
double wall_far = clt_parameters.imp.wall_far; // 0.2; // maximal disparity to consider cluster to be sky
double wall_near = clt_parameters.imp.wall_near; // 1.0; // minimal disparity to consider cluster to be wall
// processing far treeline that may be confused with clouds. Only behind far objects such as far horizontal surface.
boolean treeline_en = clt_parameters.imp.treeline_en; // true; // enable treeline processing
boolean treeline_wide = clt_parameters.imp.treeline_wide; // true; // enable treeline processing
int treeline_height = clt_parameters.imp.treeline_height; // 5; // maximal height of the treeline (tiles)
int treeline_width = clt_parameters.imp.treeline_width; // 3; // minimal horizontal width of the treeline (tiles)
boolean treeline_lim_high = clt_parameters.imp.treeline_lim_high;// false; // limit too high treeline (false - delete completely)
double treeline_str = clt_parameters.imp.treeline_str; // 0.8; // treeline minimal strength
double treeline_far = clt_parameters.imp.treeline_far; // 0.04; // treeline min disparity (pix)
double treeline_near = clt_parameters.imp.treeline_near; // 0.4; // treeline max disparity (pix)
double treeline_fg_str = clt_parameters.imp.treeline_fg_str; // 0.8; // pre-treeline FG objects (such as flat ground) minimal strength
double treeline_fg_far = clt_parameters.imp.treeline_fg_far; // 0.2; // pre-treeline FG objects min disparity (pix)
double treeline_fg_near = clt_parameters.imp.treeline_fg_near; // 0.5; // pre-treeline FG objects max disparity (pix)
// suspecting indoors (disabling sky)
boolean indoors_en = clt_parameters.imp.indoors_en; // true; // allow weak cloud if it has strong (1.5x) cloud neib
double indoors_str = clt_parameters.imp.indoors_str; // 0.5; // minimal strength of the far object
double indoors_disp = clt_parameters.imp.indoors_disp; // 0.8; // maximal minimal outdoor strong disparity
int indoors_min_out = clt_parameters.imp.indoors_min_out; // 10; // minimal strong far tiles to deny indoors
QuadCLT dbg_scene = clt_parameters.imp.save_debug_images? quadCLT_ref: null; // use to save debug images if not null QuadCLT dbg_scene = clt_parameters.imp.save_debug_images? quadCLT_ref: null; // use to save debug images if not null
// if (build_ref_dsi) { // if (build_ref_dsi) {
// need to read photometric from reference scene -INTERFRAME.corr-xml, and if it exists - set and propagate to main? // need to read photometric from reference scene -INTERFRAME.corr-xml, and if it exists - set and propagate to main?
...@@ -4212,7 +4295,33 @@ public class OpticalFlow { ...@@ -4212,7 +4295,33 @@ public class OpticalFlow {
clouds_fom, // maximal FOM for clouds (must be <=) clouds_fom, // maximal FOM for clouds (must be <=)
clouds_spread, // maximal spread for clouds (must be <=) clouds_spread, // maximal spread for clouds (must be <=)
clouds_disparity, // maximal disparity for strong clouds clouds_disparity, // maximal disparity for strong clouds
clouds_strength, // maximal strength for near clouds clouds_weak, // maximal strength for near definite clouds
clouds_strength, // minimal strength for far strong clouds (definitely cloud)
clouds_not_strength, // maximal strength for near maybe clouds (if it has strong cloud neighbor)
clouds_strong, // true; // allow weak cloud if it has strong (1.5x) cloud neib
wall_en, // enable smooth walls detection/processing
wall_dflt, // default (undetected) is wall (false - sky)
wall_str, // minimal strength of the far object (small - just non-NaN disparity)
wall_far, // maximal disparity to consider cluster to be sky
wall_near, // minimal disparity to consider cluster to be wall
treeline_en, // enable treeline processing
treeline_wide, // look not only under, but diagonal too.
treeline_height, // maximal height of the treeline (tiles)
treeline_width, // minimal horizontal width of the treeline (tiles)
treeline_lim_high, // limit too high treeline (false - delete completely)
treeline_str, // treeline minimal strength
treeline_far, // treeline min disparity (pix)
treeline_near, // treeline max disparity (pix)
treeline_fg_str, // pre-treeline FG objects (such as flat ground) minimal strength
treeline_fg_far, // pre-treeline FG objects min disparity (pix)
treeline_fg_near, // pre-treeline FG objects max disparity (pix)
indoors_en, // true; // allow weak cloud if it has strong (1.5x) cloud neib
indoors_str, // 0.5; // minimal strength of the far object
indoors_disp, // 0.8; // maximal minimal outdoor strong disparity
indoors_min_out, // 10; // minimal strong far tiles to deny indoors
disp_boost_min, // double disp_boost_min, // = 0.5; disp_boost_min, // double disp_boost_min, // = 0.5;
disp_boost_diff, //double disp_boost_diff, // = 0.35; disp_boost_diff, //double disp_boost_diff, // = 0.35;
...@@ -4570,6 +4679,7 @@ public class OpticalFlow { ...@@ -4570,6 +4679,7 @@ public class OpticalFlow {
boolean export_images = clt_parameters.imp.export_images; boolean export_images = clt_parameters.imp.export_images;
boolean export_dsi_image = clt_parameters.imp.export_ranges; boolean export_dsi_image = clt_parameters.imp.export_ranges;
boolean debug_ranges = clt_parameters.imp.debug_ranges && !batch_mode;
boolean export_ml_files = clt_parameters.imp.export_ml_files; boolean export_ml_files = clt_parameters.imp.export_ml_files;
boolean photo_en = clt_parameters.photo_en; // false; // perform photogrammetric calibration to equalize pixel values boolean photo_en = clt_parameters.photo_en; // false; // perform photogrammetric calibration to equalize pixel values
...@@ -4654,6 +4764,7 @@ public class OpticalFlow { ...@@ -4654,6 +4764,7 @@ public class OpticalFlow {
if (reuse_video) { // disable all other options if (reuse_video) { // disable all other options
generate_mapped = false; generate_mapped = false;
export_images = false; export_images = false;
debug_ranges = false;
export_dsi_image = false; export_dsi_image = false;
show_dsi_image = false; show_dsi_image = false;
export_ml_files = false; export_ml_files = false;
...@@ -4858,6 +4969,20 @@ public class OpticalFlow { ...@@ -4858,6 +4969,20 @@ public class OpticalFlow {
quadCLTs, // QuadCLT [] scenes, quadCLTs, // QuadCLT [] scenes,
colorProcParameters, // ColorProcParameters colorProcParameters, colorProcParameters, // ColorProcParameters colorProcParameters,
debugLevel); // int debug_level debugLevel); // int debug_level
if (clt_parameters.imp.sky_recalc) { // force blue sky recalculation even if it exists
reuseRefDSI(
clt_parameters, // CLTParameters clt_parameters,
colorProcParameters, // ColorProcParameters colorProcParameters,
quadCLT_main, // QuadCLT quadCLT_main, // tiles should be set
quadCLTs[ref_index], // QuadCLT quadCLT_ref, // tiles should be set
batch_mode, // final boolean batch_mode,
threadsMax, // final int threadsMax,
updateStatus, // final boolean updateStatus,
debugLevel); // int debugLevel)
}
quadCLTs[ref_index].inc_accum(); quadCLTs[ref_index].inc_accum();
// save with updated num_accum // save with updated num_accum
...@@ -5696,12 +5821,13 @@ public class OpticalFlow { ...@@ -5696,12 +5821,13 @@ public class OpticalFlow {
combo_dsn_final[COMBO_DSN_INDX_LMA], combo_dsn_final[COMBO_DSN_INDX_LMA],
combo_dsn_final[COMBO_DSN_INDX_STRENGTH] combo_dsn_final[COMBO_DSN_INDX_STRENGTH]
}; };
double [][] ds = conditionInitialDS( int dbg_condition = debug_ranges ? Math.max(1, debugLevel) : debugLevel;
true, // boolean use_conf, // use configuration parameters, false - use following double [][] ds = conditionInitialDS( // Add debug szxy by providing debugLevel=1
clt_parameters, // CLTParameters clt_parameters, true, // boolean use_conf, // use configuration parameters, false - use following
dls, // double [][] dls clt_parameters, // CLTParameters clt_parameters,
quadCLTs[ref_index], // QuadCLT scene, dls, // double [][] dls
debugLevel); // int debug_level) quadCLTs[ref_index], // QuadCLT scene,
dbg_condition); // int debug_level)
double [] disparity = ds[0]; double [] disparity = ds[0];
double [] strength = ds[1]; double [] strength = ds[1];
double [][]szxy = getSceneSZXY( double [][]szxy = getSceneSZXY(
......
...@@ -464,16 +464,43 @@ public class QuadCLTCPU { ...@@ -464,16 +464,43 @@ public class QuadCLTCPU {
int shrink_for_temp, // shrink before finding hottest sky int shrink_for_temp, // shrink before finding hottest sky
double sky_highest_min, // = -50; // 100; // lowest absolute value should not be higher (requires photometric) double sky_highest_min, // = -50; // 100; // lowest absolute value should not be higher (requires photometric)
boolean clouds_en, // enable clouds in the sky detection / processing boolean clouds_en, // enable clouds in the sky detection / processing
double clouds_fom, // maximal FOM for clouds (must be <=) double clouds_fom, // maximal FOM for clouds (must be <=)
double clouds_spread, // maximal spread for clouds (must be <=) double clouds_spread, // maximal spread for clouds (must be <=)
double clouds_disparity,// maximal disparity for strong clouds double clouds_disparity, // maximal disparity for strong clouds
double clouds_strength, // maximal strength for near clouds double clouds_weak, // maximal strength for near definite clouds
double clouds_strength, // minimal strength for far strong clouds (definitely cloud)
double clouds_not_strength, // maximal strength for near maybe clouds (if it has strong cloud neighbor)
boolean clouds_strong, // true; // allow weak cloud if it has strong (1.5x) cloud neib
boolean wall_en, // enable smooth walls detection/processing
boolean wall_dflt, // default (undetected) is wall (false - sky)
double wall_str, // minimal strength of the far object (small - just non-NaN disparity)
double wall_far, // maximal disparity to consider cluster to be sky
double wall_near, // minimal disparity to consider cluster to be wall
boolean treeline_en, // enable treeline processing
boolean treeline_wide, // look not only under, but diagonal too.
int treeline_height, // maximal height of the treeline (tiles)
int treeline_width, // minimal horizontal width of the treeline (tiles)
boolean treeline_lim_high, // limit too high treeline (false - delete completely)
double treeline_str, // treeline minimal strength
double treeline_far, // treeline min disparity (pix)
double treeline_near, // treeline max disparity (pix)
double treeline_fg_str, // pre-treeline FG objects (such as flat ground) minimal strength
double treeline_fg_far, // pre-treeline FG objects min disparity (pix)
double treeline_fg_near, // pre-treeline FG objects max disparity (pix)
double disp_boost_min, // = 0.5; boolean indoors_en, // true; // allow weak cloud if it has strong (1.5x) cloud neib
double disp_boost_diff, // = 0.35; double indoors_str, // 0.5; // minimal strength of the far object
int disp_boost_neibs, // = 2; double indoors_disp, // 0.8; // maximal minimal outdoor strong disparity
double disp_boost_amount, // = 2.0; int indoors_min_out, // 10; // minimal strong far tiles to deny indoors
double disp_boost_min, // = 0.5;
double disp_boost_diff, // = 0.35;
int disp_boost_neibs, // = 2;
double disp_boost_amount, // = 2.0;
int width, int width,
double [] strength, double [] strength,
...@@ -482,9 +509,14 @@ public class QuadCLTCPU { ...@@ -482,9 +509,14 @@ public class QuadCLTCPU {
double [] avg_val, double [] avg_val,
QuadCLT scene, // use to save debug images if not null QuadCLT scene, // use to save debug images if not null
int debugLevel) { // >0 to show int debugLevel) { // >0 to show
boolean clouds_fill_isolated = true;
int max_proh_neibs = 0;
if ((strength == null) || (spread==null)) { if ((strength == null) || (spread==null)) {
return null; return null;
} }
int height = strength.length/width;
int dbg_tile = -1150;
// int sky_bottleneck = 5; // shrink full selection, then re-expand from seed to disable // int sky_bottleneck = 5; // shrink full selection, then re-expand from seed to disable
// small (narrow) leaks (or just disable leaks near margins)? // small (narrow) leaks (or just disable leaks near margins)?
// int shrink_for_temp = 10; // int shrink_for_temp = 10;
...@@ -493,7 +525,6 @@ public class QuadCLTCPU { ...@@ -493,7 +525,6 @@ public class QuadCLTCPU {
boolean failure = false; boolean failure = false;
double temp_cold = Double.NaN; double temp_cold = Double.NaN;
double temp_hot = Double.NaN; double temp_hot = Double.NaN;
if (avg_val != null) { if (avg_val != null) {
int num_bins = 1000; int num_bins = 1000;
double min_temp = Double.NaN, max_temp=Double.NaN, avg_temp = 0; double min_temp = Double.NaN, max_temp=Double.NaN, avg_temp = 0;
...@@ -572,10 +603,10 @@ public class QuadCLTCPU { ...@@ -572,10 +603,10 @@ public class QuadCLTCPU {
String [] dbg_in_titles = {"fom", "strength", "spread", "disparity", "avg_val", "tscale"}; String [] dbg_in_titles = {"fom", "strength", "spread", "disparity", "avg_val", "tscale"};
String [] dbg_titles = {"sky", "seed", "max", "expanded", "shrank","temp_shrank","neck_shrank","reexpand"}; String [] dbg_titles = {"sky", "pre-fail", "treeline", "treeline_filt","wall", "clouds0", "clouds1", "clouds2", "seed", "max", "expanded", "shrank","temp_shrank","neck_shrank","reexpand"};
double [][] dbg_img = ((debugLevel>0) || (scene != null))? new double [dbg_titles.length][strength.length]:null; double [][] dbg_img = ((debugLevel>0) || (scene != null))? new double [dbg_titles.length][strength.length]:null;
TileNeibs tn = new TileNeibs(width,strength.length/width); TileNeibs tn = new TileNeibs(width,height);
boolean [] sky_tiles = new boolean [strength.length]; boolean [] sky_tiles = new boolean [strength.length];
boolean [] prohibit_tiles = new boolean [strength.length]; boolean [] prohibit_tiles = new boolean [strength.length];
...@@ -624,30 +655,251 @@ public class QuadCLTCPU { ...@@ -624,30 +655,251 @@ public class QuadCLTCPU {
double max_temp_seed = temp_cold * (1.0 - seed_temp) + temp_hot * seed_temp; double max_temp_seed = temp_cold * (1.0 - seed_temp) + temp_hot * seed_temp;
double max_temp_lim = temp_cold * (1.0 - lim_temp) + temp_hot * lim_temp; double max_temp_lim = temp_cold * (1.0 - lim_temp) + temp_hot * lim_temp;
boolean [][] clouds = clouds_en ? new boolean [3][strength.length]:null; // {clouds, clouds_strong, clouds_neib}
boolean [] treeline = new boolean[strength.length]; // define always, will all be false if not used
// Process treeline (and possibly far mountain ridge) that limits clouds/sky
int [] down_diag = {TileNeibs.DIR_SE,TileNeibs.DIR_SW};
if (treeline_en) {
// for now single-threaded
for (int tile = treeline.length-width-1; tile >=0; tile--) {
// see if the tile itself is OK
if ((strength[tile] >= treeline_str) &&
(disparity[tile] >= treeline_far) &&
(disparity[tile] <= treeline_near)) {
int tile_s = tn.getNeibIndex(tile, TileNeibs.DIR_S);
if (tile_s < 0) {
continue;
}
if (treeline[tile_s] || (
((strength[tile_s] >= treeline_fg_str) &&
(disparity[tile_s] >= treeline_fg_far) &&
(disparity[tile_s] <= treeline_fg_near)))) {
treeline[tile] = true;
continue;
}
if (treeline_wide) { // try diagonals
for (int dir:down_diag) {
int tile_d = tn.getNeibIndex(tile, dir);
if (tile_d < 0) {
continue;
}
if (treeline[tile_d] || (
((strength[tile_d] >= treeline_fg_str) &&
(disparity[tile_d] >= treeline_fg_far) &&
(disparity[tile_d] <= treeline_fg_near)))) {
treeline[tile] = true;
continue;
}
}
}
}
}
// filter from too high, too wide
if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[2][i] = treeline[i]? 1 : 0;
}
}
if (treeline_height > 0) { // filter by treeline maximal height
for (int x = 0; x < width; x++) {
for (int y0 = height-1; y0 >= 0;) { // iterate over bottoms of treelines (normally just 1)
for (; y0 >= 0; y0--) {
if (treeline[y0 * width + x]) {
break;
}
}
if (y0 >= 0) {
int y1 = y0 - 1;
for (; y1 >= 0; y1--) {
if (!treeline[y1 * width + x]) {
break;
}
}
if ((y0 - y1) > treeline_height) {
int yl = y0 + (treeline_lim_high ? treeline_height : 0);
for (int y = yl; y > y1; y--) {
treeline[y * width + x] = false;
}
}
y0 = y1;
}
}
}
}
if (treeline_width > 0) { // filter by treeline minimal width
for (int y=0; y < (height - 1); y++) {
for (int x0 = 0; x0 < width; ) {
for (; x0 < width; x0++) {
if (treeline[y * width + x0]) {
break;
}
}
if (x0 < width) {
int x1 = x0 + 1;
for (; x1 < width; x1++) {
if (!treeline[y * width + x1]) {
break;
}
}
if ((x1 - x0) < treeline_width) {
for (int x = x0; x < x1; x++) {
treeline[y * width + x] = false;
}
}
x0 = x1;
}
}
}
}
if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[3][i] = treeline[i]? 1 : 0;
}
}
}
for (int i = 0; i < sky_tiles.length; i++) { for (int i = 0; i < sky_tiles.length; i++) {
if (i == dbg_tile) {
System.out.println("i="+i);
}
prohibit_tiles[i] = (fom[i] >= sky_lim) || prohibit_tiles[i] = (fom[i] >= sky_lim) ||
((strength[i] >= max_disparity_strength) && (disparity[i] >= max_disparity)); ((strength[i] >= max_disparity_strength) && (disparity[i] >= max_disparity));
if (treeline[i]) {
if (clouds_en && prohibit_tiles[i]) { prohibit_tiles[i] = true;
if ( (fom[i] <= clouds_fom) && } else if (clouds_en) { // && prohibit_tiles[i]) {
(spread[i] <= clouds_spread) && if ((fom[i] <= clouds_fom) && (spread[i] <= clouds_spread)) {
((disparity[i] <= clouds_disparity) || (strength[i] <= clouds_strength))) { if ((strength[i] > clouds_not_strength) && (disparity[i] > clouds_disparity)) {
prohibit_tiles[i] = false; // definitely not cloud
} else {
if (strength[i] <= clouds_strength) {
clouds[0][i] = true;
prohibit_tiles[i] = false;
} else {
if (disparity[i] <= clouds_disparity) {
clouds[0][i] = true;
prohibit_tiles[i] = false;
if (strength[i] > clouds_strength) {
clouds[1][i] = true; // strong cloud, helps weak non-clouds
}
} else {
clouds[2][i] = true; // maybe, if has strong neighbors
if (clouds_strong) {
prohibit_tiles[i] = false; // will restore if failed
}
}
}
}
/*
if (strength[i] > clouds_strength_strong) {
if (disparity[i] <= clouds_disparity) {
clouds[0][i] = true;
clouds[1][i] = true;
prohibit_tiles[i] = false;
}
} else if ((strength[i] <= clouds_strength) || (disparity[i] <= clouds_disparity)) {
clouds[0][i] = true;
prohibit_tiles[i] = false;
} else {
clouds[2][i] = true; // maybe, if has strong neighbors
prohibit_tiles[i] = false; // will restore if failed
}
*/
} }
} }
prohibit_tiles[i] |= (avg_val[i] >= max_temp_lim); prohibit_tiles[i] |= (avg_val[i] >= max_temp_lim);
}
boolean indoors = false;
if (indoors_en) {
int num_outdoor = 0;
for (int i = 0; i < sky_tiles.length; i++) {
if ((strength[i] >= indoors_str) && (disparity[i] <= indoors_disp)) {
num_outdoor++;
}
}
indoors = num_outdoor < indoors_min_out; // too few definitely outdoor (far strong) tiles
if (debugLevel > -3) {
System.out.println("Number of far strong tiles: "+num_outdoor+ " (threshold="+indoors_min_out+")");
}
if (debugLevel > -3) {
System.out.println("Indoors mode = "+indoors);
}
failure = indoors; // do not use sky
}
if (clouds_en && clouds_strong) {
// grow strong clouds
tn.growSelection(
2 , // int shrink, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
clouds[1], // boolean [] tiles,
null); // (null - with diagonals )prohibit_tiles); // boolean [] prohibit)
for (int i = 0; i < sky_tiles.length; i++) {
if (i == dbg_tile) {
System.out.println("i="+i);
}
if (clouds[2][i]) { // "maybe" prohibit was turned off
clouds [0][i] |= clouds[1][i];
prohibit_tiles[i] |= !clouds[1][i];
}
clouds [0][i] &= !prohibit_tiles[i]; // from (avg_val[i] >= max_temp_lim)
//clouds_fill_isolated
}
if (clouds_fill_isolated) { // fill isolated gaps in clouds
for (int i = 0; i < sky_tiles.length; i++) {
if (clouds[2][i] && prohibit_tiles[i]) {
int num_proh_neibs = 0;
for (int dir = 0; dir <8; dir++) {
int tile1 = tn.getNeibIndex(i, dir);
if ((tile1 >= 0) && prohibit_tiles[tile1]) {
num_proh_neibs++;
}
}
clouds [0][i] |= (num_proh_neibs <= max_proh_neibs);
}
}
for (int i = 0; i < sky_tiles.length; i++) {
prohibit_tiles[i] &= !clouds [0][i];
}
}
}
// prohibit border tiles if they do not have non-border orthogonal neighbors
for (int i = 0; i < width; i++) {
prohibit_tiles[i] |= prohibit_tiles[i + width];
prohibit_tiles[i+(height -1) * width] |= prohibit_tiles[i + (height - 2) * width];
}
for (int i = 0; i < height; i++) {
prohibit_tiles[i * width] |= prohibit_tiles[i * width + 1];
prohibit_tiles[i * width +(width - 1)] |= prohibit_tiles[i * width +(width - 2)];
}
if ((dbg_img != null) && (clouds != null)) {
for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[5][i] = clouds[0][i]? 1 : 0;
dbg_img[6][i] = clouds[1][i]? 1 : 0;
dbg_img[7][i] = clouds[2][i]? 1 : 0;
}
}
for (int i = 0; i < sky_tiles.length; i++) {
sky_tiles[i] = (fom[i] < sky_seed) && sky_tiles[i] = (fom[i] < sky_seed) &&
!(disparity[i] > disparity_seed) && !(disparity[i] > disparity_seed) &&
!prohibit_tiles[i] && !prohibit_tiles[i] &&
(avg_val[i] < max_temp_seed); (avg_val[i] < max_temp_seed);
} }
//seed_rows //seed_rows
if (dbg_img != null) { if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) { for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[1][i] = sky_tiles[i]? 1 : 0; dbg_img[8][i] = sky_tiles[i]? 1 : 0;
dbg_img[2][i] = prohibit_tiles[i]? 0 : 1; dbg_img[9][i] = prohibit_tiles[i]? 0 : 1;
} }
} }
tn.shrinkSelection( tn.shrinkSelection(
...@@ -660,7 +912,7 @@ public class QuadCLTCPU { ...@@ -660,7 +912,7 @@ public class QuadCLTCPU {
boolean [] seed_sky = sky_tiles.clone(); boolean [] seed_sky = sky_tiles.clone();
if (dbg_img != null) { if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) { for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[4][i] = sky_tiles[i]? 1 : 0; dbg_img[11][i] = sky_tiles[i]? 1 : 0;
} }
} }
...@@ -678,7 +930,7 @@ public class QuadCLTCPU { ...@@ -678,7 +930,7 @@ public class QuadCLTCPU {
} }
if (dbg_img != null) { if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) { for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[3][i] = sky_tiles[i]? 1 : 0; dbg_img[10][i] = sky_tiles[i]? 1 : 0;
} }
} }
...@@ -704,8 +956,8 @@ public class QuadCLTCPU { ...@@ -704,8 +956,8 @@ public class QuadCLTCPU {
prohibit_tiles); // boolean [] prohibit) prohibit_tiles); // boolean [] prohibit)
if (dbg_img != null) { if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) { for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[6][i] = prohibit_neck[i]? 0 : 1; dbg_img[13][i] = prohibit_neck[i]? 0 : 1;
dbg_img[7][i] = sky_tiles[i]? 1 : 0; dbg_img[14][i] = sky_tiles[i]? 1 : 0;
} }
} }
...@@ -727,14 +979,66 @@ public class QuadCLTCPU { ...@@ -727,14 +979,66 @@ public class QuadCLTCPU {
} }
if (dbg_img != null) { if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) { for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[5][i] = shrank_sky[i]? 1 : 0; dbg_img[12][i] = shrank_sky[i]? 1 : 0;
} }
} }
} }
for (int i = lowest_sky_row*width; i < sky_tiles.length; i++) {
if (sky_tiles[i]) {
System.out.println("getBlueSky(): sky area appeared too low - at row "+(i/width)+" >= "+lowest_sky_row+" removing blue sky");
if (sky_max_temp < sky_temp_override) {
System.out.println("But detected sky is cold enough ("+sky_max_temp+" < "+sky_temp_override+
"), so this test is bypassed");
} else {
failure = true;
}
break;
}
}
if (!failure && wall_en) {
int [] num_clusters = new int [1];
int [] clusters = tn.enumerateClusters(
sky_tiles, // boolean [] tiles,
num_clusters, // int [] num_clusters,
false); // boolean ordered)
if (num_clusters[0] > 1) { // do not filter single-clusters
boolean [][] has_near_far = new boolean [num_clusters[0]][2];
for (int i = 0; i < sky_tiles.length; i++) if (sky_tiles[i]) {
if (!Double.isNaN(disparity[i]) && (strength[i] >= wall_str)) {
int clust = clusters[i] - 1;
has_near_far[clust][0] |= disparity[i] <= wall_far;
has_near_far[clust][1] |= disparity[i] > wall_near;
}
}
boolean [] is_wall = new boolean [has_near_far.length];
for (int clust = 0; clust < has_near_far.length; clust++) {
is_wall[clust] = wall_dflt;
if (has_near_far[clust][0] && !has_near_far[clust][1]) {
is_wall[clust] = false;
} else if (has_near_far[clust][1] && !has_near_far[clust][0]) {
is_wall[clust] = true;
}
}
for (int i = 0; i < sky_tiles.length; i++) if (sky_tiles[i]) {
int clust = clusters[i] - 1;
if (is_wall[clust]) {
sky_tiles[i] = false;
if (dbg_img != null) {
dbg_img[4][i] = 1.0;
}
}
}
}
}
if (dbg_img != null) { if (dbg_img != null) {
for (int i = 0; i < sky_tiles.length; i++) { for (int i = 0; i < sky_tiles.length; i++) {
dbg_img[0][i] = sky_tiles[i]? 1 : 0; dbg_img[0][i] = (!failure && sky_tiles[i])? 1 : 0;
dbg_img[1][i] = sky_tiles[i]? 1 : 0;
} }
if (debugLevel>0) { if (debugLevel>0) {
ShowDoubleFloatArrays.showArrays( ShowDoubleFloatArrays.showArrays(
...@@ -755,22 +1059,11 @@ public class QuadCLTCPU { ...@@ -755,22 +1059,11 @@ public class QuadCLTCPU {
} }
} }
for (int i = lowest_sky_row*width; i < sky_tiles.length; i++) {
if (sky_tiles[i]) {
System.out.println("getBlueSky(): sky area appeared too low - at row "+(i/width)+" >= "+lowest_sky_row+" removing blue sky");
if (sky_max_temp < sky_temp_override) {
System.out.println("But detected sky is cold enough ("+sky_max_temp+" < "+sky_temp_override+
"), so this test is bypassed");
} else {
failure = true;
}
break;
}
}
if (failure) { // Will still show in debug images !!! if (failure) { // Will still show in debug images !!!
Arrays.fill(sky_tiles, false); Arrays.fill(sky_tiles, false);
} }
return sky_tiles; return sky_tiles;
} }
...@@ -839,11 +1132,37 @@ public class QuadCLTCPU { ...@@ -839,11 +1132,37 @@ public class QuadCLTCPU {
int shrink_for_temp, // shrink before finding hottest sky int shrink_for_temp, // shrink before finding hottest sky
double sky_highest_max, // = 100; // lowest absolute value should not be higher (requires photometric) double sky_highest_max, // = 100; // lowest absolute value should not be higher (requires photometric)
boolean clouds_en, // enable clouds in the sky detection / processing boolean clouds_en, // enable clouds in the sky detection / processing
double clouds_fom, // maximal FOM for clouds (must be <=) double clouds_fom, // maximal FOM for clouds (must be <=)
double clouds_spread, // maximal spread for clouds (must be <=) double clouds_spread, // maximal spread for clouds (must be <=)
double clouds_disparity,// maximal disparity for strong clouds double clouds_disparity, // maximal disparity for strong clouds
double clouds_strength, // maximal strength for near clouds double clouds_weak, // maximal strength for near definite clouds
double clouds_strength, // minimal strength for far strong clouds (definitely cloud)
double clouds_not_strength, // maximal strength for near maybe clouds (if it has strong cloud neighbor)
boolean clouds_strong, // true; // allow weak cloud if it has strong (1.5x) cloud neib
boolean wall_en, // enable smooth walls detection/processing
boolean wall_dflt, // default (undetected) is wall (false - sky)
double wall_str, // minimal strength of the far object (small - just non-NaN disparity)
double wall_far, // maximal disparity to consider cluster to be sky
double wall_near, // minimal disparity to consider cluster to be wall
boolean treeline_en, // enable treeline processing
boolean treeline_wide, // look not only under, but diagonal too.
int treeline_height, // maximal height of the treeline (tiles)
int treeline_width, // minimal horizontal width of the treeline (tiles)
boolean treeline_lim_high, // limit too high treeline (false - delete completely)
double treeline_str, // treeline minimal strength
double treeline_far, // treeline min disparity (pix)
double treeline_near, // treeline max disparity (pix)
double treeline_fg_str, // pre-treeline FG objects (such as flat ground) minimal strength
double treeline_fg_far, // pre-treeline FG objects min disparity (pix)
double treeline_fg_near, // pre-treeline FG objects max disparity (pix)
boolean indoors_en, // true; // allow weak cloud if it has strong (1.5x) cloud neib
double indoors_str, // 0.5; // minimal strength of the far object
double indoors_disp, // 0.8; // maximal minimal outdoor strong disparity
int indoors_min_out, // 10; // minimal strong far tiles to deny indoors
double disp_boost_min, // = 0.5; double disp_boost_min, // = 0.5;
double disp_boost_diff, // = 0.35; double disp_boost_diff, // = 0.35;
...@@ -869,21 +1188,47 @@ public class QuadCLTCPU { ...@@ -869,21 +1188,47 @@ public class QuadCLTCPU {
sky_expand_extra, // = 100; // 1? sky_expand_extra, // = 100; // 1?
sky_bottleneck, // sky_bottleneck, //
sky_reexpand_extra, // int sky_reexpand_extra, // 9; re-expand after bottleneck in addition to how it was shrank sky_reexpand_extra, // int sky_reexpand_extra, // 9; re-expand after bottleneck in addition to how it was shrank
cold_scale, // = 0.2; // <=1.0. 1.0 - disables temperature dependence cold_scale, // 0.2; // <=1.0. 1.0 - disables temperature dependence
cold_frac, // = 0.005; // this and lower will scale fom by cold_scale cold_frac, // 0.005; // this and lower will scale fom by cold_scale
hot_frac, // = 0.9; // this and above will scale fom by 1.0 hot_frac, // 0.9; // this and above will scale fom by 1.0
min_strength, // = 0.08; min_strength, // 0.08;
seed_rows, // = 5; // sky should appear in this top rows seed_rows, // 5; // sky should appear in this top rows
lowest_sky_row, // = 50;// appears that low - invalid, remove completely lowest_sky_row, //50;// appears that low - invalid, remove completely
sky_temp_override, // double sky_temp_override, // really cold average seed - ignore lowest_sky_row filter sky_temp_override, // double sky_temp_override, // really cold average seed - ignore lowest_sky_row filter
shrink_for_temp, // int shrink_for_temp, // shrink before finding hottest sky shrink_for_temp, // int shrink_for_temp, // shrink before finding hottest sky
sky_highest_max, // = 100; // lowest absolute value should not be higher (requires photometric) sky_highest_max, // 100; // lowest absolute value should not be higher (requires photometric)
clouds_en, // enable clouds in the sky detection / processing clouds_en, // enable clouds in the sky detection / processing
clouds_fom, // maximal FOM for clouds (must be <=) clouds_fom, // maximal FOM for clouds (must be <=)
clouds_spread, // maximal spread for clouds (must be <=) clouds_spread, // maximal spread for clouds (must be <=)
clouds_disparity,// maximal disparity for strong clouds clouds_disparity, // maximal disparity for strong clouds
clouds_strength, // maximal strength for near clouds clouds_weak, // maximal strength for near definite clouds
clouds_strength, // minimal strength for far strong clouds (definitely cloud)
clouds_not_strength, // maximal strength for near maybe clouds (if it has strong cloud neighbor)
clouds_strong, // true; // allow weak cloud if it has strong (1.5x) cloud neib
wall_en, // enable smooth walls detection/processing
wall_dflt, // default (undetected) is wall (false - sky)
wall_str, // minimal strength of the far object (small - just non-NaN disparity)
wall_far, // maximal disparity to consider cluster to be sky
wall_near, // minimal disparity to consider cluster to be wall
treeline_en, // enable treeline processing
treeline_wide, // look not only under, but diagonal too.
treeline_height, // maximal height of the treeline (tiles)
treeline_width, // minimal horizontal width of the treeline (tiles)
treeline_lim_high, // limit too high treeline (false - delete completely)
treeline_str, // treeline minimal strength
treeline_far, // treeline min disparity (pix)
treeline_near, // treeline max disparity (pix)
treeline_fg_str, // pre-treeline FG objects (such as flat ground) minimal strength
treeline_fg_far, // pre-treeline FG objects min disparity (pix)
treeline_fg_near, // pre-treeline FG objects max disparity (pix)
indoors_en, // true; // allow weak cloud if it has strong (1.5x) cloud neib
indoors_str, // 0.5; // minimal strength of the far object
indoors_disp, // 0.8; // maximal minimal outdoor strong disparity
indoors_min_out, // 10; // minimal strong far tiles to deny indoors
disp_boost_min, // = 0.5; disp_boost_min, // = 0.5;
disp_boost_diff, // = 0.35; disp_boost_diff, // = 0.35;
......
...@@ -232,7 +232,36 @@ public class LwirWorld { ...@@ -232,7 +232,36 @@ public class LwirWorld {
double clouds_fom = clt_parameters.imp.clouds_fom; // 30.0; // maximal FOM for clouds (must be <=) double clouds_fom = clt_parameters.imp.clouds_fom; // 30.0; // maximal FOM for clouds (must be <=)
double clouds_spread = clt_parameters.imp.clouds_spread; // 60.0; // maximal spread for clouds (must be <=) double clouds_spread = clt_parameters.imp.clouds_spread; // 60.0; // maximal spread for clouds (must be <=)
double clouds_disparity = clt_parameters.imp.clouds_disparity; // 0.1; // maximal disparity for strong clouds double clouds_disparity = clt_parameters.imp.clouds_disparity; // 0.1; // maximal disparity for strong clouds
double clouds_strength = clt_parameters.imp.clouds_strength; // 0.3; // maximal strength for near clouds double clouds_weak = clt_parameters.imp.clouds_weak; // 0.18;// maximal strength for near definite clouds
double clouds_strength = clt_parameters.imp.clouds_strength; // 0.25;// minimal strength for far strong clouds (definitely cloud)
double clouds_not_strength= clt_parameters.imp.clouds_not_strength;//0.4; // maximal strength for near maybe clouds (if it has strong cloud neighbor)
boolean clouds_strong = clt_parameters.imp.clouds_strong; // true; // allow weak cloud if it has strong (1.5x) cloud neib
// process smooth walls mistaken for sky (disable for natural environments)
boolean wall_en = clt_parameters.imp.wall_en; // true; // enable smooth walls detection/processing
boolean wall_dflt = clt_parameters.imp.wall_dflt; // true; // default (undetected) is wall (false - sky)
double wall_str = clt_parameters.imp.wall_str; // 0.1; // minimal strength of the far object (small - just non-NaN disparity)
double wall_far = clt_parameters.imp.wall_far; // 0.2; // maximal disparity to consider cluster to be sky
double wall_near = clt_parameters.imp.wall_near; // 1.0; // minimal disparity to consider cluster to be wall
// processing far treeline that may be confused with clouds. Only behind far objects such as far horizontal surface.
boolean treeline_en = clt_parameters.imp.treeline_en; // true; // enable treeline processing
boolean treeline_wide = clt_parameters.imp.treeline_wide; // true; // enable treeline processing
int treeline_height = clt_parameters.imp.treeline_height; // 5; // maximal height of the treeline (tiles)
int treeline_width = clt_parameters.imp.treeline_width; // 3; // minimal horizontal width of the treeline (tiles)
boolean treeline_lim_high = clt_parameters.imp.treeline_lim_high;// false; // limit too high treeline (false - delete completely)
double treeline_str = clt_parameters.imp.treeline_str; // 0.8; // treeline minimal strength
double treeline_far = clt_parameters.imp.treeline_far; // 0.04; // treeline min disparity (pix)
double treeline_near = clt_parameters.imp.treeline_near; // 0.4; // treeline max disparity (pix)
double treeline_fg_str = clt_parameters.imp.treeline_fg_str; // 0.8; // pre-treeline FG objects (such as flat ground) minimal strength
double treeline_fg_far = clt_parameters.imp.treeline_fg_far; // 0.2; // pre-treeline FG objects min disparity (pix)
double treeline_fg_near = clt_parameters.imp.treeline_fg_near; // 0.5; // pre-treeline FG objects max disparity (pix)
// suspecting indoors (disabling sky)
boolean indoors_en = clt_parameters.imp.indoors_en; // true; // allow weak cloud if it has strong (1.5x) cloud neib
double indoors_str = clt_parameters.imp.indoors_str; // 0.5; // minimal strength of the far object
double indoors_disp = clt_parameters.imp.indoors_disp; // 0.8; // maximal minimal outdoor strong disparity
int indoors_min_out = clt_parameters.imp.indoors_min_out; // 10; // minimal strong far tiles to deny indoors
boolean [] ref_blue_sky = null; // turn off "lma" in the ML output boolean [] ref_blue_sky = null; // turn off "lma" in the ML output
int earliest_scene = 0; // increase on failure int earliest_scene = 0; // increase on failure
...@@ -404,7 +433,33 @@ public class LwirWorld { ...@@ -404,7 +433,33 @@ public class LwirWorld {
clouds_fom, // maximal FOM for clouds (must be <=) clouds_fom, // maximal FOM for clouds (must be <=)
clouds_spread, // maximal spread for clouds (must be <=) clouds_spread, // maximal spread for clouds (must be <=)
clouds_disparity, // maximal disparity for strong clouds clouds_disparity, // maximal disparity for strong clouds
clouds_strength, // maximal strength for near clouds clouds_weak, // maximal strength for near definite clouds
clouds_strength, // minimal strength for far strong clouds (definitely cloud)
clouds_not_strength, // maximal strength for near maybe clouds (if it has strong cloud neighbor)
clouds_strong, // true; // allow weak cloud if it has strong (1.5x) cloud neib
wall_en, // enable smooth walls detection/processing
wall_dflt, // default (undetected) is wall (false - sky)
wall_str, // minimal strength of the far object (small - just non-NaN disparity)
wall_far, // maximal disparity to consider cluster to be sky
wall_near, // minimal disparity to consider cluster to be wall
treeline_en, // enable treeline processing
treeline_wide, // look not only under, but diagonal too.
treeline_height, // maximal height of the treeline (tiles)
treeline_width, // minimal horizontal width of the treeline (tiles)
treeline_lim_high, // limit too high treeline (false - delete completely)
treeline_str, // treeline minimal strength
treeline_far, // treeline min disparity (pix)
treeline_near, // treeline max disparity (pix)
treeline_fg_str, // pre-treeline FG objects (such as flat ground) minimal strength
treeline_fg_far, // pre-treeline FG objects min disparity (pix)
treeline_fg_near, // pre-treeline FG objects max disparity (pix)
indoors_en, // true; // allow weak cloud if it has strong (1.5x) cloud neib
indoors_str, // 0.5; // minimal strength of the far object
indoors_disp, // 0.8; // maximal minimal outdoor strong disparity
indoors_min_out, // 10; // minimal strong far tiles to deny indoors
disp_boost_min, // double disp_boost_min, // = 0.5; disp_boost_min, // double disp_boost_min, // = 0.5;
disp_boost_diff, //double disp_boost_diff, // = 0.35; disp_boost_diff, //double disp_boost_diff, // = 0.35;
...@@ -515,7 +570,30 @@ public class LwirWorld { ...@@ -515,7 +570,30 @@ public class LwirWorld {
clouds_fom, // maximal FOM for clouds (must be <=) clouds_fom, // maximal FOM for clouds (must be <=)
clouds_spread, // maximal spread for clouds (must be <=) clouds_spread, // maximal spread for clouds (must be <=)
clouds_disparity, // maximal disparity for strong clouds clouds_disparity, // maximal disparity for strong clouds
clouds_strength, // maximal strength for near clouds clouds_weak, // maximal strength for near definite clouds
clouds_strength, // minimal strength for far strong clouds (definitely cloud)
clouds_not_strength, // maximal strength for near maybe clouds (if it has strong cloud neighbor)
clouds_strong, // true; // allow weak cloud if it has strong (1.5x) cloud neib
wall_en, // enable smooth walls detection/processing
wall_dflt, // default (undetected) is wall (false - sky)
wall_str, // minimal strength of the far object (small - just non-NaN disparity)
wall_far, // maximal disparity to consider cluster to be sky
wall_near, // minimal disparity to consider cluster to be wall
treeline_en, // enable treeline processing
treeline_wide, // look not only under, but diagonal too.
treeline_height, // maximal height of the treeline (tiles)
treeline_width, // minimal horizontal width of the treeline (tiles)
treeline_lim_high, // limit too high treeline (false - delete completely)
treeline_str, // treeline minimal strength
treeline_far, // treeline min disparity (pix)
treeline_near, // treeline max disparity (pix)
treeline_fg_str, // pre-treeline FG objects (such as flat ground) minimal strength
treeline_fg_far, // pre-treeline FG objects min disparity (pix)
treeline_fg_near, // pre-treeline FG objects max disparity (pix)
indoors_en, // true; // allow weak cloud if it has strong (1.5x) cloud neib
indoors_str, // 0.5; // minimal strength of the far object
indoors_disp, // 0.8; // maximal minimal outdoor strong disparity
indoors_min_out, // 10; // minimal strong far tiles to deny indoors
disp_boost_min, // double disp_boost_min, // = 0.5; disp_boost_min, // double disp_boost_min, // = 0.5;
disp_boost_diff, //double disp_boost_diff, // = 0.35; disp_boost_diff, //double disp_boost_diff, // = 0.35;
disp_boost_neibs, //int disp_boost_neibs, // = 2; disp_boost_neibs, //int disp_boost_neibs, // = 2;
......
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