Commit a12d2254 authored by Andrey Filippov's avatar Andrey Filippov

working snapshot

parent 971025da
......@@ -187,6 +187,10 @@ public class ErsCorrection extends GeometryCorrection {
DP_DVX, DP_DVY, DP_DVZ,
DP_DSVAZ, DP_DSVTL, DP_DSVRL,
DP_DSVX, DP_DSVY, DP_DSVZ};
public static final int [] DP_XYZR_INDICES = {DP_DSX,DP_DSY,DP_DSZ,DP_DSRL};
public static final int [] DP_AT_INDICES = {DP_DSAZ,DP_DSTL};
public static final int [] DP_ATT_ERS_INDICES = {DP_DSVAZ,DP_DSVTL};
public static final RotationConvention ROT_CONV = RotationConvention.FRAME_TRANSFORM;
static final double THRESHOLD = 1E-10;
static final double LINE_ERR = 0.001; // line accuracy for ERS when converting from world to pixels.
......@@ -223,8 +227,29 @@ public class ErsCorrection extends GeometryCorrection {
if (d > 0) return 1.0/ERS_MIN_DISPARITY;
return -1.0/ERS_MIN_DISPARITY;
}
public static final int [] DP_XYZR_INDICES = {DP_DSX,DP_DSY,DP_DSZ,DP_DSRL};
public static final int [] DP_AT_INDICES = {DP_DSAZ,DP_DSTL};
public static final int [] DP_ATT_ERS_INDICES = {DP_DSVAZ,DP_DSVTL};
*/
public static boolean [] getParamSelect(
boolean use_AT,
boolean use_ERS) {
boolean [] param_select = new boolean[DP_NUM_PARS];
for (int i:DP_XYZR_INDICES) param_select[i] = true;
if (use_AT) for (int i:DP_AT_INDICES) param_select[i] = true;
if (use_ERS) for (int i:DP_ATT_ERS_INDICES) param_select[i] = true;
return param_select;
}
public static double [] getParamRegWeights(
double reg_weight,
boolean use_AT) {
double [] reg_weights = new double[DP_NUM_PARS];
reg_weights[DP_DSX] = reg_weight;
reg_weights[DP_DSY] = reg_weight;
return reg_weights;
}
public void setPose(
double [] camera_xyz,
double [] camera_atr) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4712,11 +4712,16 @@ public class OpticalFlow {
int test_ers0 = clt_parameters.imp.test_ers0; // try adjusting a pair of scenes with ERS. Reference scene index
int test_ers1 = clt_parameters.imp.test_ers1; // try adjusting a pair of scenes with ERS. Other scene index
test_ers &= (test_ers0 >= 0) && (test_ers1 >= 0);
boolean use_combo_relaible = clt_parameters.imp.use_combo_relaible;
boolean use_combo_relaible = clt_parameters.imp.use_combo_reliable;
boolean ref_need_lma = clt_parameters.imp.ref_need_lma;
boolean ref_need_lma_combo = clt_parameters.imp.ref_need_lma_combo;
double min_ref_str = clt_parameters.imp.min_ref_str;
boolean sfm_filter = clt_parameters.imp.sfm_filter; //true; // use SfM filtering if available
double sfm_minmax = clt_parameters.imp.sfm_minmax; //10.0; // minimal value of the SfM gain maximum to consider available
double sfm_fracmax = clt_parameters.imp.sfm_fracmax; // 0.75; // minimal fraction of the SfM maximal gain
double sfm_fracall = clt_parameters.imp.sfm_fracall; // 0.3; // minimal relative area of the SfM-enabled tiles (do not apply filter if less)
double min_ref_frac= clt_parameters.imp.min_ref_frac;
double [] ref_blue_sky = null; // turn off "lma" in the ML output
if (reuse_video) { // disable all other options
......@@ -5234,8 +5239,12 @@ public class OpticalFlow {
min_ref_frac, // double min_ref_frac,
ref_need_lma, // boolean needs_lma);
ref_need_lma_combo, // boolean needs_lma);
reduced_strength); // if not null will return >0 if had to reduce strength (no change if did not reduce)
sfm_filter, // boolean sfm_filter, // use SfM filtering if available
sfm_minmax, // double sfm_minmax, // minimal value of the SfM gain maximum to consider available
sfm_fracmax, // double sfm_fracmax,// minimal fraction of the SfM maximal gain
sfm_fracall, // double sfm_fracall,// minimal relative area of the SfM-enabled tiles (do not apply filter if less)
reduced_strength, // if not null will return >0 if had to reduce strength (no change if did not reduce)
debugLevel); // int debugLevel)
if (show_reliable_ref) {
double [] dbg_img = new double [reliable_ref.length];
for (int i = 0; i < dbg_img.length; i++) {
......
......@@ -356,7 +356,7 @@ public class QuadCLTCPU {
double [] ims_ortho = clt_parameters.imp.ims_ortho;
double [] ims_mount_atr = clt_parameters.imp.getImsMountATR(); // converts to radians
double [][][] scenes_xyzatr = new double [quadCLTs.length][][];
// scenes_xyzatr[ref_index] = new double[2][3]; // all zeros
// scenes_xyzatr[ref_index] = new double[2][3]; // all zeros
Did_ins_2 d2_ref = did_ins_2;
// apply correction to orientation - better not to prevent extra loops.
......@@ -485,11 +485,11 @@ public class QuadCLTCPU {
}
}
return fl;
// if ((fl[0] >= 0) && (fl[1] >= 0)) {
// return fl;
// } else {
// return null;
// }
// if ((fl[0] >= 0) && (fl[1] >= 0)) {
// return fl;
// } else {
// return null;
// }
}
/**
......@@ -989,7 +989,7 @@ public class QuadCLTCPU {
d2.getQEnu(),
ims_mount_atr,
ims_ortho);
//
//
double [] quat_corr = getQuatCorr();
if (apply_quat_corr && (quat_corr != null)) {
cam_quat_enu=Imx5.applyQuaternionToQuaternion(quat_corr, cam_quat_enu, false);
......@@ -1030,7 +1030,7 @@ public class QuadCLTCPU {
xy_range, // double [][] xy_range, // should be double[2][]; meters
debug_level); // int debug_level)
// camera position and orientation relative to the same lat/long on the ground below it
// double [][] scene_abs_xyzatr_enu = new double [][] {new double[] {0,0,-agl}, scene_abs_atr_enu};
// double [][] scene_abs_xyzatr_enu = new double [][] {new double[] {0,0,-agl}, scene_abs_atr_enu};
double [][] scene_abs_xyzatr_enu = new double [][] {new double[] {0,0,use_parallel_proj?0:-agl}, scene_abs_atr_enu};
// double [][] ground_xyzatr = new double [][] {
// {0, 0, z_tilts[0]},
......@@ -1102,7 +1102,7 @@ public class QuadCLTCPU {
double hist_rlow = 0.5;
double hist_rhigh = 2.0;
int min_good = 20; //number of good tiles
// double rel_hight = 0.2; // when calculating scale, ignore objects far from plane
// double rel_hight = 0.2; // when calculating scale, ignore objects far from plane
int num_bins = 1000;
double sw=0, swd=0;
boolean [] good_tiles = new boolean[ref_disparity.length];
......@@ -1176,8 +1176,8 @@ public class QuadCLTCPU {
return Double.NaN;
}
// double dl = discard_low * sw;
// double dh = discard_high * sw;
// double dl = discard_low * sw;
// double dh = discard_high * sw;
double dl = discard_high * sw;
double dh = discard_low * sw;
double sh = 0.0;
......@@ -1234,7 +1234,7 @@ public class QuadCLTCPU {
public double [][] getDLS(){ // get disparity, disparity_lma, strength, sfm_gain
if (dsi == null) {
// System.out.println("dsi== null, use spawnQuadCLT(), restoreFromModel(), ... to set it");
// System.out.println("dsi== null, use spawnQuadCLT(), restoreFromModel(), ... to set it");
return null;
}
double [][] dls = new double[4][];
......@@ -1294,7 +1294,7 @@ public class QuadCLTCPU {
this.new_image_data = qParent.new_image_data;
if (qParent.saturation_imp != null) this.saturation_imp = qParent.saturation_imp.clone(); // each camera will be re-written, not just modified, so shallow copy
this.is_aux = qParent.is_aux;
// this.is_mono = qParent.is_mono;
// this.is_mono = qParent.is_mono;
this.photometric_scene = qParent.photometric_scene;
this.lwir_offsets = ErsCorrection.clone1d(qParent.lwir_offsets);
......@@ -1404,7 +1404,7 @@ public class QuadCLTCPU {
public static double getTimeStamp(String ts) {
String sts = ts.replace("_", ".");
// Matcher m = Pattern.compile("\\d").matcher(sts);
// Matcher m = Pattern.compile("\\d").matcher(sts);
Matcher m = Pattern.compile("\\d{5,10}\\.\\d{6}").matcher(sts);
//
if(m.find()) {
......@@ -1556,10 +1556,10 @@ public class QuadCLTCPU {
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)?
// int shrink_for_temp = 10;
// double sky_temp_override = -300; // really cold average seed - ignore lowest_sky_row filter
// int shrink_for_temp = 10;
// double sky_temp_override = -300; // really cold average seed - ignore lowest_sky_row filter
double [] temp_scales = null;
boolean failure = false;
double temp_cold = Double.NaN;
......@@ -2130,7 +2130,7 @@ public class QuadCLTCPU {
}
// @Deprecated
// @Deprecated
public void setBlueSky (boolean [] blue_sky) {
double [] double_blue_sky = new double [blue_sky.length];
for (int i = 0; i < blue_sky.length; i++) {
......@@ -2214,7 +2214,7 @@ public class QuadCLTCPU {
QuadCLT dbg_scene, // use to save debug images if not null
int debugLevel) {
int width = tp.getTilesX();
// this.blue_sky = getBlueSky (
// this.blue_sky = getBlueSky (
setBlueSky(getBlueSky (
max_disparity,
max_disparity_strength,
......@@ -2403,23 +2403,27 @@ public class QuadCLTCPU {
dsi,
silent);
}
//min_ref_frac
//min_ref_frac
public boolean [] getReliableTiles(
boolean use_combo,
double min_strength,
double min_ref_frac,
boolean needs_lma,
boolean needs_lma_combo,
double [] reduced_strength // if not null will return >0 if had to reduce strength (no change if did not reduce)
boolean sfm_filter,
double sfm_minmax,
double sfm_fracmax,
double sfm_fracall,
double [] reduced_strength, // if not null will return >0 if had to reduce strength (no change if did not reduce)
int debugLevel
) {
int NUM_BINS = 1024;
// 10.15.2023 - was error here, readComboDSI (silent) returns combo_dsi, not converted to this.dsi format;
// double [][] main_dsi = use_combo? readComboDSI (silent): readDsiMain();
// 10.15.2023 - was error here, readComboDSI (silent) returns combo_dsi, not converted to this.dsi format;
// double [][] main_dsi = use_combo? readComboDSI (silent): readDsiMain();
double [][] main_dsi = null;
boolean silent = false;
if (use_combo) {
readComboDSI (silent);
main_dsi = this.dsi;
needs_lma = needs_lma_combo;
} else {
main_dsi = readDsiMain();
......@@ -2427,6 +2431,7 @@ public class QuadCLTCPU {
if (main_dsi == null) {
return null;
}
double [] disparity_lma = main_dsi[isAux()?TwoQuadCLT.DSI_DISPARITY_AUX_LMA:TwoQuadCLT.DSI_DISPARITY_MAIN_LMA];
double [] strength = main_dsi[isAux()?TwoQuadCLT.DSI_STRENGTH_AUX:TwoQuadCLT.DSI_STRENGTH_MAIN];
double [] sfm_gain = main_dsi[isAux()?TwoQuadCLT.DSI_SFM_GAIN_AUX:TwoQuadCLT.DSI_SFM_GAIN_MAIN];
......@@ -2449,22 +2454,34 @@ public class QuadCLTCPU {
}
}
}
if (sfm_gain != null) {
if (sfm_filter && (sfm_gain != null)) {
double sfm_max = 0.0;
for (int i = 0; i < reliable.length; i++) {
if (sfm_gain[i] > sfm_max) sfm_max = sfm_gain[i];
}
if (sfm_max > sfm_minmax) {
double sfm_thresh = sfm_max * sfm_fracmax;
boolean [] sfm_good = new boolean [reliable.length];
int num_sfm_gain = 0;
for (int i = 0; i < reliable.length; i++) {
if (sfm_gain[i] >0) {
if (sfm_gain[i] >= sfm_thresh) {
sfm_good[i] = true;
num_sfm_gain++;
}
}
if (num_sfm_gain > min_reliable) {
if (num_sfm_gain > (sfm_fracall * reliable.length)) {
if (debugLevel > -3) {
System.out.println("getReliableTiles(): Using SfM filter");
}
for (int i = 0; i < reliable.length; i++) {
if (sfm_gain[i] <= 0){
if (!sfm_good[i]) { // sfm_gain[i] <= 0){
reliable[i] = false;
strength[i] = 0.0;
}
}
}
}
}
int num_reliable = 0;
for (boolean b: reliable) if (b) num_reliable++;
if (num_reliable < min_reliable) { // not enough, select best tiles, ignoring LMA
......@@ -2697,7 +2714,7 @@ public class QuadCLTCPU {
// Moving here form QC:
// Moving here form QC:
public double [][] getDSRBG (){
return dsrbg;
}
......
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