finaldoubletop_percent,// = 0.5; // remove above 50% center intersection
finalintmin_macro_tiles,// = 3;
finaldoublenormal_damping,
finalintwidth,
finalboolean[]good_tiles,// null or boolean[data.length] // should all be false
finaldouble[]gnd_disp,// if not null
finalStringdbg_title,
finalintdebugLevel){
booleanprint_histogram=debugLevel>0;
finaldoublegnd_percent_low=clt_parameters.imp.fgnd_percent_low;// 0.01; // Discard lowest outliers. Percentile to remove lowest elevation outliers during initial terrain filtering
finaldoublegnd_percent_high=clt_parameters.imp.fgnd_percent_high;// 0.2; // Discard highest outliers. Percentile to remove highest elevation outliers during initial terrain filtering.
finaldoublegnd_max_high_over=clt_parameters.imp.fgnd_max_high_over;// 0.1; // Absolute disparity over lowest. Absolute disparity over lowest. Minimal of this value and the one determined by the highest outliers percentile will be applied. // pix = make dependent on average disparity?
// final int min_good1 = clt_parameters.imp.fgnd_min_good1; //10; // Minimal good tiles in stage 1. Minimal number of remaining tiles after the first stage filtering.
finaldoublemax_abs_diff=clt_parameters.imp.fgnd_max_abs_diff;// 0.03; // Absolute disparity from plane. Maximal absolute disparity difference from the stage 1 - found plane (stage2 mask).
finaldoublemax_rel_diff=clt_parameters.imp.fgnd_max_rel_diff;// 0.03; // Relative disparity from plane. Maximal relative disparity difference from the stage 1 - found plane (stage2 mask).
finaldoubleblur_frac=clt_parameters.imp.fgnd_blur_frac;// 0.01; // Elevation histogram relative sigma. Elevation (relative to the plane) histogram LPF sigma as a fraction of the full range minimal of the absolute and relative above.
finaldoubleweight_frac=clt_parameters.imp.fgnd_weight_frac;// 0.3; // Scale outliers from plane weights. Relative to full range disparity from plane to reduce weight twice - multiply remaining tiles weights by w= 1/(1 + (diff_from_plane^2/k_max_diff)^2).
finalintmtile_size=clt_parameters.imp.fgnd_mtile_size;//16; // Macrotile size (50% overlapping). Size of the 50%-overlapping square macrotiles (in tiles).
finaldoublemin_ev_rel=clt_parameters.imp.fgnd_min_ev_rel;// 0.3; // Minimal macrotile eigenvalues product. Square root of the eigenvalues product. Measure of how well is the macrotile local plane is defined. Fully populated macrotile has it 1.0.
finaldoublemax_tilt=clt_parameters.imp.fgnd_max_tilt;// 0.2; // Maximal macrotile tilt. Maximal absolute value of the macrotile plane tilt: z to sqrt (x^2+y^2).
finaldoubletop_percent=clt_parameters.imp.fgnd_top_percent;// 0.5; // High elevation outliers percentile. Remove macrotiles that have the highest elevations (measured at the full camera FOV center).
finalintmin_macro_tiles=clt_parameters.imp.fgnd_min_macro_tiles;// 3; // Minimal number of macrotiles for high outliers. Minimal number of remaining macrotiles before removing high outpliers.
finaldoublenormal_damping=clt_parameters.imp.fgnd_normal_damping;// 0.001; // Damping parameter for planes. Pull planes to horizontal when there is not enough data for tilts.
// boolean eig_weight = false;
booleanuse_lma=true;
intnum_bins=1000;
...
...
@@ -511,6 +491,10 @@ public class GroundPlane {
dbg_title+"-metric",// final String dbg_title,
debugLevel);// final int debugLevel) {
if(to_ground_xyzatr==null){
returnnewdouble[][]{{0,0,0},{0,0,0},{0}};
}
double[][]macroplanes=getMacroPlanes(// no weights
wxyz,// final double [][] wxyz,
mask3,// final boolean [] mask,
...
...
@@ -532,11 +516,26 @@ public class GroundPlane {
mtile_size,// int mtile_size,
debugLevel);// int debugLevel)
// re-run with updated mask
to_ground_xyzatr=getPlane(// from the camera coordinates to in-plane coordinates
wxyz,// final double [][] wxyz,
use_parallel_proj,// final boolean use_parallel_proj, // for parallel xyz is 0, otherwise - point on the ground under the camera
macro_mask,// mask3, // final boolean [] mask,
weights,// final double [] weight,
width,// final int width,
normal_damping,// final double normal_damping,
dbg_title+"-metric",// final String dbg_title,
debugLevel);// final int debugLevel) {
if(to_ground_xyzatr==null){
returnnewdouble[][]{{0,0,0},{0,0,0},{0}};
}
double[][]macroplanes_weights=getMacroPlanes(
wxyz,// final double [][] wxyz,
mask3,// final boolean [] mask,
weights,// final double [] weight,
true,// final boolean eig_weight, // use weights when calculating eiget values (false - only mask)
true,// final boolean eig_weight, // use weights when calculating eigen values (false - only mask)
publicstaticdouble[]getDisparityPlaneDualPass(// returns to_ground_xyzatr (rotated around the ground point nadir of teh drone)
finalCLTParametersclt_parameters,
finalQuadCLTref_Clt,
finaldoublegnd_percent_low,
finaldoublegnd_percent_high,
finaldoublegnd_max_high_over,
finalintmin_good1,// minimal good tiles after pass1
finaldoublemax_abs_diff,// maximal absolute disparity difference from the plane
finaldoublemax_rel_diff,// maximal relative disparity difference from the plane
finaldoublenormal_damping,
finalintwidth,
finalboolean[]good_tiles,// null or boolean[data.length] // should all be false
finaldouble[]gnd_disp,// if not null
finalStringdbg_title,
finalintdebugLevel){
booleanprint_histogram=debugLevel>0;
doubleblur_frac=0.01;// 0.03
doubleweight_frac=0.3;// multiply weight by w= 1/(1 + (err/k_max_diff)^2)
finaldoublegnd_percent_low=clt_parameters.imp.fgnd_percent_low;// 0.01; // Discard lowest outliers. Percentile to remove lowest elevation outliers during initial terrain filtering
finaldoublegnd_percent_high=clt_parameters.imp.fgnd_percent_high;// 0.2; // Discard highest outliers. Percentile to remove highest elevation outliers during initial terrain filtering.
finaldoublegnd_max_high_over=clt_parameters.imp.fgnd_max_high_over;// 0.1; // Absolute disparity over lowest. Absolute disparity over lowest. Minimal of this value and the one determined by the highest outliers percentile will be applied. // pix = make dependent on average disparity?
// final int min_good1 = clt_parameters.imp.fgnd_min_good1; //10; // Minimal good tiles in stage 1. Minimal number of remaining tiles after the first stage filtering.
finaldoublemax_abs_diff=clt_parameters.imp.fgnd_max_abs_diff;// 0.03; // Absolute disparity from plane. Maximal absolute disparity difference from the stage 1 - found plane (stage2 mask).
finaldoublemax_rel_diff=clt_parameters.imp.fgnd_max_rel_diff;// 0.03; // Relative disparity from plane. Maximal relative disparity difference from the stage 1 - found plane (stage2 mask).
finaldoublenormal_damping=clt_parameters.imp.fgnd_normal_damping;// 0.001; // Damping parameter for planes. Pull planes to horizontal when there is not enough data for tilts.
finaldoubleblur_frac=clt_parameters.imp.fgnd_blur_frac;// 0.01; // Elevation histogram relative sigma. Elevation (relative to the plane) histogram LPF sigma as a fraction of the full range minimal of the absolute and relative above.
finaldoubleweight_frac=clt_parameters.imp.fgnd_weight_frac;// 0.3; // Scale outliers from plane weights. Relative to full range disparity from plane to reduce weight twice - multiply remaining tiles weights by w= 1/(1 + (diff_from_plane^2/k_max_diff)^2).
double [] disparity_plane = new double[ref_disparity.length];
/**
* After mask is already defined from matric including macrotiles
* @param clt_parameters
* @param ref_Clt
* @param width
* @param good_tiles
* @param dbg_title
* @param debugLevel
* @return
*/
publicstaticdouble[]getDisparityPlaneSinglePass(// returns to_ground_xyzatr (rotated around the ground point nadir of teh drone)
finalCLTParametersclt_parameters,
finalQuadCLTref_Clt,
finalintwidth,
finalboolean[]good_tiles,// null or boolean[data.length] // should all be false
finalStringdbg_title,
finalintdebugLevel){
finaldoublenormal_damping=clt_parameters.imp.fgnd_normal_damping;// 0.001; // Damping parameter for planes. Pull planes to horizontal when there is not enough data for tilts.
finalintmin_good1,// minimal good tiles after pass1
finaldoublemax_abs_diff,// maximal absolute disparity difference from the plane
finaldoublemax_rel_diff,// maximal relative disparity difference from the plane
finaldoublenormal_damping,
finalintwidth,
finalboolean[]good_tiles,// null or boolean[data.length] // should all be false
finalStringdbg_title,
finalQuadCLTdbg_scene,
finalintdebugLevel){
finaldoublegnd_percent_low=clt_parameters.imp.fgnd_percent_low;// 0.01; // Discard lowest outliers. Percentile to remove lowest elevation outliers during initial terrain filtering
finaldoublegnd_percent_high=clt_parameters.imp.fgnd_percent_high;// 0.2; // Discard highest outliers. Percentile to remove highest elevation outliers during initial terrain filtering.
finaldoublegnd_max_high_over=clt_parameters.imp.fgnd_max_high_over;// 0.1; // Absolute disparity over lowest. Absolute disparity over lowest. Minimal of this value and the one determined by the highest outliers percentile will be applied. // pix = make dependent on average disparity?
// final int min_good1 = clt_parameters.imp.fgnd_min_good1; //10; // Minimal good tiles in stage 1. Minimal number of remaining tiles after the first stage filtering.
finaldoublemax_abs_diff=clt_parameters.imp.fgnd_max_abs_diff;// 0.03; // Absolute disparity from plane. Maximal absolute disparity difference from the stage 1 - found plane (stage2 mask).
finaldoublemax_rel_diff=clt_parameters.imp.fgnd_max_rel_diff;// 0.03; // Relative disparity from plane. Maximal relative disparity difference from the stage 1 - found plane (stage2 mask).
finaldoublenormal_damping=clt_parameters.imp.fgnd_normal_damping;// 0.001; // Damping parameter for planes. Pull planes to horizontal when there is not enough data for tilts.
publicbooleanair_disp_corr=true;// refine disparity offset from IMS movements
publicbooleanair_disp_corr_save=false;// apply disparity correction to the geometry correction of the master_CLT
// Flat ground detection
publicdoublefgnd_percent_low=0.01;// Discard lowest outliers. Percentile to remove lowest elevation outliers during initial terrain filtering
publicdoublefgnd_percent_high=0.2;// Discard highest outliers. Percentile to remove highest elevation outliers during initial terrain filtering.
publicdoublefgnd_max_high_over=0.1;// Absolute disparity over lowest. Absolute disparity over lowest. Minimal of this value and the one determined by the highest outliers percentile will be applied. // pix = make dependent on average disparity?
publicintfgnd_min_good1=10;// Minimal good tiles in stage 1. Minimal number of remaining tiles after the first stage filtering.
publicdoublefgnd_max_abs_diff=0.03;// Absolute disparity from plane. Maximal absolute disparity difference from the stage 1 - found plane (stage2 mask).
publicdoublefgnd_max_rel_diff=0.03;// Relative disparity from plane. Maximal relative disparity difference from the stage 1 - found plane (stage2 mask).
publicdoublefgnd_blur_frac=0.01;// Elevation histogram relative sigma. Elevation (relative to the plane) histogram LPF sigma as a fraction of the full range minimal of the absolute and relative above.
publicdoublefgnd_weight_frac=0.3;// Scale outliers from plane weights. Relative to full range disparity from plane to reduce weight twice - multiply remaining tiles weights by w= 1/(1 + (diff_from_plane^2/k_max_diff)^2).
publicintfgnd_mtile_size=16;// Macrotile size (50% overlapping). Size of the 50%-overlapping square macrotiles (in tiles).
publicdoublefgnd_min_ev_rel=0.3;// Minimal macrotile eigenvalues product. Square root of the eigenvalues product. Measure of how well is the macrotile local plane is defined. Fully populated macrotile has it 1.0.
publicdoublefgnd_max_tilt=0.2;// Maximal macrotile tilt. Maximal absolute value of the macrotile plane tilt: z to sqrt (x^2+y^2).
publicdoublefgnd_top_percent=0.5;// High elevation outliers percentile. Remove macrotiles that have the highest elevations (measured at the full camera FOV center).
publicintfgnd_min_macro_tiles=3;// Minimal number of macrotiles for high outliers. Minimal number of remaining macrotiles before removing high outpliers.
publicdoublefgnd_normal_damping=0.001;// Damping parameter for planes. Pull planes to horizontal when there is not enough data for tilts.
// TODO: move next parameters elsewhere - they are not the motion blur ones.
publicintmb_gain_index_pose=5;// pose readjust pass to switch to full mb_max_gain from mb_max_gain_inter
...
...
@@ -1766,7 +1781,7 @@ min_str_neib_fpn 0.35
gd.addCheckbox("LY infinity from IMS",this.run_ly_ims,
"Use horizontal movement from the IMS to adjust infinity disparity (if enabled above).");
gd.addCheckbox("Use LMA for LY adjustments",this.run_ly_lma,
"Use LMA for LY adjustments.");
"Use LMA for LY adjustments. Should be set!");
gd.addCheckbox("Fine-match images to IMS timing",this.match_ims_timing,
"Correlate image rotations with IMS ones. Only used when manually matching ims with images (sync lost). Fine-tuning offset by rotations.");
...
...
@@ -1959,7 +1974,7 @@ min_str_neib_fpn 0.35
"Other scene index in a scene sequence (should have a very different angular/linear velocity component)");
gd.addTab("Fiter DSI","Filter DSI before use (interscene fitting, interscene accumulation, ML generation");
gd.addTab("Filter DSI","Filter DSI before use (interscene fitting, interscene accumulation, ML generation");
"Elevation (relative to the plane) histogram LPF sigma as a fraction of the full range minimal of the absolute and relative above.");
gd.addNumericField("Scale outliers from plane weights",this.fgnd_weight_frac,5,7,"x",
"Relative to full range disparity from plane to reduce weight twice - multiply remaining tiles weights by w= 1/(1 + (diff_from_plane^2/k_max_diff)^2).");
gd.addMessage("Filtering by local planes intersection with the camera view ray");
System.out.println("getLYData(): run_ly_lma is false, it should be true. Set it in clt_parameters.imp.run_ly_lma . Temporarily overwriting configuration using true");
run_ly_lma=true;
}
// Does not use disparity_map[DISPARITY_STRENGTH_INDEX]
image_dtt.clt_process_tl_correlations(// convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
clt_parameters.img_dtt,// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
...
...
@@ -1045,7 +1054,7 @@ public class MultisceneLY {
//optional, may be null
disparity_map,// final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
ddnd,// [tilesY][tilesX][num_sensors][2] data for LY. Should be either null or [tilesY][tilesX][][]. disparity_map should be non-null
clt_parameters.imp.run_ly_lma,// correlate_lma, // final boolean run_lma, // calculate LMA, false - CM only
run_ly_lma,// correlate_lma, // final boolean run_lma, // calculate LMA, false - CM only
// define combining of all 2D correlation pairs for CM (LMA does not use them)
clt_parameters.img_dtt.mcorr_comb_width,//final int mcorr_comb_width, // combined correlation tile width (set <=0 to skip combined correlations)
clt_parameters.img_dtt.mcorr_comb_height,//final int mcorr_comb_height, // combined correlation tile full height