Commit df71e1d0 authored by Andrey Filippov's avatar Andrey Filippov

Before removing hardwired conditionInitialDS

parent 33b2b603
......@@ -1569,6 +1569,7 @@ public class EyesisCorrectionParameters {
// first - scan all file and set sourceDirectory, x3dDirectory, linkedModels,videoDirectory,resultsDirectory
HashMap<String,String> dir_map = new HashMap<String,String>();
for (String line:lines){
if (line.split("#").length > 0) {
String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+");
if ((tokens.length > 2) && (tokens[0].toUpperCase().equals("SET"))) {
parse_set:
......@@ -1581,6 +1582,7 @@ public class EyesisCorrectionParameters {
System.out.println("*********** Unknown SET: "+tokens[1]+" in line: "+line);
}
}
}
}
if (dir_map.containsKey("rootDirectory")) {
base_path=base_path.resolve(Paths.get(dir_map.get("rootDirectory")));
......@@ -1634,20 +1636,22 @@ public class EyesisCorrectionParameters {
}
// process source sequence directories
ArrayList<PathFirstLast> path_list= new ArrayList<PathFirstLast>();
for (String line:lines){
String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+");
if ((tokens.length > 0) &&
(tokens[0].length() > 0) &&
(!tokens[0].toUpperCase().equals("SET"))
) {
Path dir_path = source_path.resolve(Paths.get(tokens[0]));
path_list.add(new PathFirstLast(
dir_path.toString(),
((tokens.length > 1)? Integer.parseInt(tokens[1]):0),
((tokens.length > 2)? Integer.parseInt(tokens[2]):-1),
((tokens.length > 3)? Integer.parseInt(tokens[3]):-1)));
}
}
for (String line:lines){
if (line.split("#").length > 0) {
String[] tokens = line.split("#")[0].trim().split("[\\s,;=]+");
if ((tokens.length > 0) &&
(tokens[0].length() > 0) &&
(!tokens[0].toUpperCase().equals("SET"))
) {
Path dir_path = source_path.resolve(Paths.get(tokens[0]));
path_list.add(new PathFirstLast(
dir_path.toString(),
((tokens.length > 1)? Integer.parseInt(tokens[1]):0),
((tokens.length > 2)? Integer.parseInt(tokens[2]):-1),
((tokens.length > 3)? Integer.parseInt(tokens[3]):-1)));
}
}
}
return path_list.toArray(new PathFirstLast[0]);
}
......
......@@ -31,11 +31,28 @@ public class EventLogger {
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++) {
System.out.println("Printing all DID_INS_1 data in "+logger_files[nf].abs_path);
try {
logger_files[nf].listDid1(false);
logger_files[nf].listDid1(out_did1_path+"-"+String.format("%03d", nf)+".out",false);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
......
package com.elphel.imagej.ims;
import java.awt.Point;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
......@@ -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
open();
float [] start_ned = null;
System.out.println (
"record "+
FileWriter writer = null;
if (path != null) {
writer = new FileWriter (path);
}
String header = "record "+
" master TS "+
" local TS "+
"timeOfWeek " +
......@@ -395,9 +399,13 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
" theta "+
" uvw "+
" 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
for (int nrec = 0; nrec < num_recs; nrec++) {
int [] full_type = getFullType(bb, nrec);
......@@ -413,7 +421,7 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
bb_payload.order(ByteOrder.LITTLE_ENDIAN);
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)) {
// continue;
continue;
}
if ((start_ned != null) &&
( (Math.abs(start_ned[0] - did_ins_1.ned[0]) > max_offset) ||
......@@ -426,9 +434,9 @@ public class EventLoggerFileInfo implements Comparable<EventLoggerFileInfo> {
start_ned = did_ins_1.ned.clone();
}
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] "+
"[%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,
getMasterTS(nrec),
getLocalTS(nrec),
......@@ -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.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
));
);
if (writer != null) {
writer.write(line);
} else {
System.out.print(line);
}
}
}
if (writer != null) {
writer.close();
}
if (!keep) {
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(
......
......@@ -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_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_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
int earliest_scene = 0; // increase on failure
......@@ -404,7 +433,33 @@ public class LwirWorld {
clouds_fom, // maximal FOM for clouds (must be <=)
clouds_spread, // maximal spread for clouds (must be <=)
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_diff, //double disp_boost_diff, // = 0.35;
......@@ -515,7 +570,30 @@ public class LwirWorld {
clouds_fom, // maximal FOM for clouds (must be <=)
clouds_spread, // maximal spread for clouds (must be <=)
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_diff, //double disp_boost_diff, // = 0.35;
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