Commit 816eae59 authored by Andrey Filippov's avatar Andrey Filippov

Testing multiscene LY derivatives

parent 9ec32785
......@@ -115,7 +115,7 @@ public class Corr2dLMA {
private double [][] last_jt = null;
private int ddisp_index; // = G0_INDEX + NUM_PAIRS; // disparity offset per camera (at least 1 should be disabled)
private int ndisp_index; // = ddisp_index + NUM_CAMS; // disparity offset per camera - none should be disable
private int ndisp_index; // = ddisp_index + NUM_CAMS; // disparity offset per camera - none should be disabled
private int num_all_pars; // = ndisp_index+ NUM_CAMS; // maximal number of parameters
private final int [] used_cams_map; // = new int[NUM_CAMS]; // for each camera index return used index ???
......@@ -1507,7 +1507,8 @@ public class Corr2dLMA {
if (par_map[ndisp_index + f] >= 0) jt[par_map[ndisp_index + f]][ns] = 0.0;
}
}
double [] dd_deriv = new double[3]; // derivatives by dependent dd_pre_lars, dd_last and nd_last (calculated on demand) with sign according to first/second in a pair
double [] dd_deriv = new double[3]; // derivatives by dependent dd_pre_last (0), dd_last (1) and nd_last (1)
// (calculated on demand) with sign according to first/second in a pair
if ((fs[0] == pre_last_cam)) {
dd_deriv[0] = 2 * WGp * lim_negative *
( (A * xmxp + B * ymyp) * m_disp[s.tile][pre_last_cam].get(0, 0)+
......@@ -1551,7 +1552,6 @@ public class Corr2dLMA {
(B * xmxp + C * ymyp) * m_disp[s.tile][fs[0]].get(1, 1));
}
if (par_map[ndisp_index + fs[1]] >= 0) {
jt[par_map[ndisp_index + fs[1]]][ns] -= 2 * WGp * lim_negative *
( (A * xmxp + B * ymyp) * m_disp[s.tile][fs[1]].get(0, 1)+
(B * xmxp + C * ymyp) * m_disp[s.tile][fs[1]].get(1, 1));
......
......@@ -245,7 +245,7 @@ public class ExtrinsicAdjustment {
double min_strength) {
if (ref_data == null) ref_data = data;
double [] avg = new double [indx_length];
double [] weights = new double [data.length];
double [] weights = new double [data.length]; // nullp
double sw = 0;
for (int cluster = 0; cluster < weights.length; cluster++) if ((ref_data[cluster] != null) && (data[cluster] != null) && !Double.isNaN (ref_data[cluster][INDX_STRENGTH])){
double w = ref_data[cluster][INDX_STRENGTH] - min_strength;
......@@ -279,7 +279,7 @@ public class ExtrinsicAdjustment {
String dfmt = "%"+format[0]+"."+format[1]+"f,";
String dfmta = "%"+format[0]+"."+(2*format[1])+"f";
String hfmt = "%"+(format[0]/2)+"d%"+(format[0]-format[0]/2)+"s,";
double [] avg = weightedLY (data, ref_data, min_strength);
double [] avg = weightedLY (data, ref_data, min_strength); //nullp
String s = "";
double avg_dd = 0.0, avg_nd = 0.0, avg_x = 0.0, avg_y = 0.0;
for (int p = 0; p < num_sensors; p++) avg_dd += avg[indx_dd0 + p]/ num_sensors;
......
......@@ -11152,19 +11152,7 @@ if (debugLevel > -100) return true; // temporarily !
boolean lma_only = true; // use clt_parameters
double dbg_disparity_offset = 0.0; // 0.1
double inf_disp_ref = 0.0;
/*
double far_inf = -0.5; //
double near_inf = 0.5; //
double far_fract = 0.05; //
double inf_range_offs = 0.05; //
double inf_range = 0.15; //
double min_inf_str = 0.2; //
double min_fg_str = 0.4; //
// non-infinity parameters
int clust_size = 4;
double scene_range = 10.0; // disparity range for non-infinity in the same cluster
int min_num_inf = 10; // Minimal number of tiles (in all scenes total) in an infinity cluster
*/
int last_scene_index = quadCLTs.length-1;
QuadCLT last_scene = quadCLTs[last_scene_index];
String composite_suffix = "-INTER-INTRA-LMA";
......@@ -11193,7 +11181,7 @@ if (debugLevel > -100) return true; // temporarily !
// int [] num_tiles = new int [clusters]; // may be null;; // null;
// boolean [] inf_cluster = new boolean [clusters]; // null;
boolean debug = debugLevel > -3;
boolean debug = debugLevel > -2;
if (proc_infinity) {
double [] inf_avg = new double[1];
......@@ -11263,14 +11251,11 @@ if (debugLevel > -100) return true; // temporarily !
}
}
int [][] num_tiles2 = new int[2][];
double [][][] target_disparities = new double [2][][];
double [][][] lazy_eye_data = MultisceneLY.getLYDataInfNoinf(
clt_parameters, // final CLTParameters clt_parameters,
clt_parameters.lyms_clust_size, // final int clust_size,
clt_parameters.lyms_inf_range, // final double inf_range, // full range centered at inf_disp_ref to be used as infinity
clt_parameters.lyms_scene_range, // final double scene_range, // disparity range for non-infinity in the same cluster
clt_parameters.lyms_min_num_inf, // final int min_num_inf, // Minimal number of tiles (in all scenes total) in an infinity cluster
quadCLTs, // final QuadCLT [] scenes, // ordered by increasing timestamps
valid_tile, // final boolean [][] valid_tile, // tile with lma and single correlation maximum
inf_disp_ref, // final double inf_disp_ref, // average disparity at infinity for ref scene // is_scene_infinity
......@@ -11278,11 +11263,33 @@ if (debugLevel > -100) return true; // temporarily !
target_disparities, // final double[][] target_disparities,
dbg_disparity_offset, // final double dbg_disparity_offset,
num_tiles2, // final int [][] in_num_tiles, // null or number of tiles per cluster to multiply strength
null, // final CorrVector corr_vector_delta, // null or extrinsic vector offset, applied to all scenes
threadsMax, // final int threadsMax,
debugLevel); // final int debug_level);
boolean use_tarz = false; // true; //false;
double delta = 0.001; // 0.01;
MultisceneLY.debugLYDerivatives(
clt_parameters, // final CLTParameters clt_parameters,
quadCLTs, // final QuadCLT [] scenes, // ordered by increasing timestamps
lazy_eye_data, // double [][][] lazy_eye_data2, // inf, no_inf
valid_tile, // final boolean [][] valid_tile, // tile with lma and single correlation maximum
inf_disp_ref, // final double inf_disp_ref, // average disparity at infinity for ref scene // is_scene_infinity
is_scene_infinity, //final boolean [][] is_scene_infinity, // may be null, if not - may be infinity from the composite depth map
false, // boolean update_disparity, // re-measure disparity before measuring LY
threadsMax, // final int threadsMax, // maximal number of threads to launch
true, // final boolean updateStatus,
delta, // double delta,
use_tarz, // boolean use_tarz, // derivatives by tarz, not symmetrical vectors
debugLevel); // final int debugLevel);
if (debugLevel > -200) {
return;
}
// debug images
if (debugLevel > -3) {
if (debugLevel > -2) {
double [][] dbg_numCorrMax = new double[numCorrMax.length][];
for (int i = 0; i < dbg_numCorrMax.length; i++) {
dbg_numCorrMax[i] = new double[numCorrMax[i].length];
......@@ -11311,11 +11318,17 @@ if (debugLevel > -100) return true; // temporarily !
"clusters_num_inf_boinf",
new String[] {"inf tiles", "noinf tiles"});
}
if (lazy_eye_data != null) {
ExtrinsicAdjustment ea_dbg = new ExtrinsicAdjustment (
multisceneLY.processLYdata(
clt_parameters, // final CLTParameters clt_parameters,
quadCLTs, // final QuadCLT [] scenes, // ordered by increasing timestamps
lazy_eye_data, // final double [][][] lazy_eye_data,
debugLevel); // final int debugLevel
/*
ExtrinsicAdjustment ea = new ExtrinsicAdjustment (
last_scene.getErsCorrection(), // GeometryCorrection gc,
clt_parameters.tileStep, // int clusterSize,
clt_parameters.lyms_clust_size, // int clusterSize,
clustersX, // int clustersX,
clustersY); // int clustersY)
double [][][] dbg_cluster = new double [lazy_eye_data.length][ExtrinsicAdjustment.get_INDX_LENGTH(last_scene.getNumSensors())][clustersY * clustersX];
......@@ -11338,11 +11351,18 @@ if (debugLevel > -100) return true; // temporarily !
clustersY,
true,
last_scene.getImageName()+"-lazy_eye_data-"+m,
ea_dbg.data_titles); // ExtrinsicAdjustment.DATA_TITLES);
}
ea.data_titles); // ExtrinsicAdjustment.DATA_TITLES);
}
*/
// Testing next step
}
if (debugLevel > -3) {
if (debugLevel > -2) {
System.out.println("adjustLYSeries() Done");
}
......
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