Commit 47bf5840 authored by Andrey Filippov's avatar Andrey Filippov

Fixed bug with adjustment by non-reference scene

parent b469f1c2
...@@ -2267,8 +2267,9 @@ public class Interscene { ...@@ -2267,8 +2267,9 @@ public class Interscene {
disable_ers, // boolean disable_ers, disable_ers, // boolean disable_ers,
min_max, // double [] min_max, // null or pair of minimal and maximal offsets min_max, // double [] min_max, // null or pair of minimal and maximal offsets
fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
quadCLTs[nscene0], // QuadCLT reference_QuadClt, quadCLTs[ref_index],// QuadCLT ref_QuadClt, // reference scene for ref_disparity, zero xyz and atr
ref_disparity, // double [] ref_disparity, // null or alternative reference disparity ref_disparity, // double [] ref_disparity, // null or alternative reference disparity
quadCLTs[nscene0], // QuadCLT reference_QuadClt,
pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene
reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles
tp_tasks_ref[0], // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction tp_tasks_ref[0], // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction
...@@ -2330,8 +2331,9 @@ public class Interscene { ...@@ -2330,8 +2331,9 @@ public class Interscene {
disable_ers, // boolean disable_ers, disable_ers, // boolean disable_ers,
min_max, // double [] min_max, // null or pair of minimal and maximal offsets min_max, // double [] min_max, // null or pair of minimal and maximal offsets
fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
quadCLTs[nscene0], // QuadCLT reference_QuadClt, quadCLTs[ref_index],//QuadCLT ref_QuadClt, // reference scene for ref_disparity, zero xyz and atr
ref_disparity, // double [] ref_disparity, // null or alternative reference disparity ref_disparity, // double [] ref_disparity, // null or alternative reference disparity
quadCLTs[nscene0], // QuadCLT first_QuadClt, // First in comparison pair
pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene
reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles
tp_tasks_ref[0], // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction tp_tasks_ref[0], // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction
...@@ -2411,11 +2413,12 @@ public class Interscene { ...@@ -2411,11 +2413,12 @@ public class Interscene {
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
true, // boolean initial_adjust, true, // boolean initial_adjust,
false, // boolean fpn_disable, // disable fpn filter if images are known to be too close false, // boolean fpn_disable, // disable fpn filter if images are known to be too close
disable_ers, // boolean disable_ers, disable_ers, // boolean disable_ers,
min_max, // double [] min_max, // null or pair of minimal and maximal offsets min_max, // double [] min_max, // null or pair of minimal and maximal offsets
fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt, // QuadCLT reference_QuadClt, reference_QuadClt, // QuadCLT ref_QuadClt, // reference scene for ref_disparity, zero xyz and atr
ref_disparity, // double [] ref_disparity, // null or alternative reference disparity ref_disparity, // double [] ref_disparity, // null or alternative reference disparity
reference_QuadClt, // QuadCLT first_QuadClt, // First in comparison pair
pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene
reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles
tp_tasks_ref2[0], // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction tp_tasks_ref2[0], // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction
...@@ -2441,8 +2444,9 @@ public class Interscene { ...@@ -2441,8 +2444,9 @@ public class Interscene {
boolean disable_ers, boolean disable_ers,
double [] min_max, // null or pair of minimal and maximal offsets double [] min_max, // null or pair of minimal and maximal offsets
int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
QuadCLT reference_QuadClt, // First in comparison pair, does not need to be reference? QuadCLT ref_QuadClt, // reference scene for ref_disparity, zero xyz and atr
double [] ref_disparity, // null or alternative reference disparity double [] ref_disparity, // null or alternative reference disparity
QuadCLT first_QuadClt, // First in comparison pair, does not need to be reference?
double [][] pXpYD_ref, // pXpYD for the reference scene double [][] pXpYD_ref, // pXpYD for the reference scene
boolean [] reliable_ref, // null or bitmask of reliable reference tiles boolean [] reliable_ref, // null or bitmask of reliable reference tiles
TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction
...@@ -2495,8 +2499,9 @@ public class Interscene { ...@@ -2495,8 +2499,9 @@ public class Interscene {
mb_max_gain, // double mb_max_gain, mb_max_gain, // double mb_max_gain,
min_max, // double [] min_max, // null or pair of minimal and maximal offsets min_max, // double [] min_max, // null or pair of minimal and maximal offsets
fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt, // QuadCLT reference_QuadCLT, ref_QuadClt, // QuadCLT ref_scene, // Scene for which DSI (ref_disparity) is calculated
ref_disparity, // double [] ref_disparity, // null or alternative reference disparity ref_disparity, // double [] ref_disparity, // null or alternative reference disparity
first_QuadClt, // QuadCLT reference_QuadCLT,
pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene
tp_tasks_ref, // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction tp_tasks_ref, // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction
scene_QuadClt, // QuadCLT scene_QuadCLT, scene_QuadClt, // QuadCLT scene_QuadCLT,
...@@ -2526,7 +2531,7 @@ public class Interscene { ...@@ -2526,7 +2531,7 @@ public class Interscene {
double [][] quad_strengths = getQuadStrengths( double [][] quad_strengths = getQuadStrengths(
coord_motion, // double [][][] coord_motion, coord_motion, // double [][][] coord_motion,
gap_frac, //double gap_frac, // 0.25 gap_frac, //double gap_frac, // 0.25
reference_QuadClt.getTileProcessor().getTilesX()); // int tilesX); first_QuadClt.getTileProcessor().getTilesX()); // int tilesX);
for (int i = 0; i < quad_strengths[0].length; i++) { for (int i = 0; i < quad_strengths[0].length; i++) {
if ((quad_strengths[0][i] < min_quad_tiles) || (quad_strengths[1][i] < min_quad_weight)) { if ((quad_strengths[0][i] < min_quad_tiles) || (quad_strengths[1][i] < min_quad_weight)) {
disable_ers = true; disable_ers = true;
...@@ -2569,7 +2574,7 @@ public class Interscene { ...@@ -2569,7 +2574,7 @@ public class Interscene {
ref_xyzatr, // _inv, // ref_xyzatr, ref_xyzatr, // _inv, // ref_xyzatr,
// reference atr, xyz are considered 0.0 not anymore? // reference atr, xyz are considered 0.0 not anymore?
scene_QuadClt, // final QuadCLT scene_QuadClt, scene_QuadClt, // final QuadCLT scene_QuadClt,
reference_QuadClt, // final QuadCLT reference_QuadClt, first_QuadClt, // final QuadCLT reference_QuadClt,
param_select_mod, // param_select, // final boolean[] param_select, param_select_mod, // param_select, // final boolean[] param_select,
param_regweights, // final double [] param_regweights, param_regweights, // final double [] param_regweights,
coord_motion[1], // final double [][] vector_XYS, // optical flow X,Y, confidence obtained from the correlate2DIterate() coord_motion[1], // final double [][] vector_XYS, // optical flow X,Y, confidence obtained from the correlate2DIterate()
...@@ -2637,8 +2642,9 @@ public class Interscene { ...@@ -2637,8 +2642,9 @@ public class Interscene {
mb_max_gain, // double mb_max_gain, mb_max_gain, // double mb_max_gain,
min_max, // double [] min_max, // null or pair of minimal and maximal offsets min_max, // double [] min_max, // null or pair of minimal and maximal offsets
fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt, // QuadCLT reference_QuadCLT, first_QuadClt, // QuadCLT ref_scene, // Scene for which DSI (ref_disparity) is calculated
ref_disparity, // double [] ref_disparity, // null or alternative reference disparity ref_disparity, // double [] ref_disparity, // null or alternative reference disparity
first_QuadClt, // QuadCLT first_scene,
pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene
tp_tasks_ref, // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction tp_tasks_ref, // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction
scene_QuadClt, // QuadCLT scene_QuadCLT, scene_QuadClt, // QuadCLT scene_QuadCLT,
...@@ -2655,7 +2661,7 @@ public class Interscene { ...@@ -2655,7 +2661,7 @@ public class Interscene {
mb_vectors, // double [][] mb_vectors, // now [2][ntiles]; mb_vectors, // double [][] mb_vectors, // now [2][ntiles];
2, // int imp_debug_level, 2, // int imp_debug_level,
debug_level); // 1); // -1); // int debug_level); debug_level); // 1); // -1); // int debug_level);
TileProcessor tp = reference_QuadClt.getTileProcessor(); TileProcessor tp = first_QuadClt.getTileProcessor();
int tilesX = tp.getTilesX(); int tilesX = tp.getTilesX();
int tilesY = tp.getTilesY(); int tilesY = tp.getTilesY();
...@@ -2664,7 +2670,7 @@ public class Interscene { ...@@ -2664,7 +2670,7 @@ public class Interscene {
tilesX, tilesX,
tilesY, tilesY,
true, true,
scene_QuadClt.getImageName()+"-"+reference_QuadClt.getImageName()+"-CORR-FPN", scene_QuadClt.getImageName()+"-"+first_QuadClt.getImageName()+"-CORR-FPN",
fpn_dbg_titles); fpn_dbg_titles);
} }
if (show_corr_fpn) { // repeat after last adjustment to get images if (show_corr_fpn) { // repeat after last adjustment to get images
...@@ -2688,8 +2694,9 @@ public class Interscene { ...@@ -2688,8 +2694,9 @@ public class Interscene {
mb_max_gain, // double mb_max_gain, mb_max_gain, // double mb_max_gain,
null, // double [] min_max, // null or pair of minimal and maximal offsets null, // double [] min_max, // null or pair of minimal and maximal offsets
null, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max null, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt, // QuadCLT reference_QuadCLT, first_QuadClt, // QuadCLT ref_scene, // Scene for which DSI (ref_disparity) is calculated
ref_disparity, // double [] ref_disparity, // null or alternative reference disparity ref_disparity, // double [] ref_disparity, // null or alternative reference disparity
first_QuadClt, // QuadCLT first_scene,
pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene
tp_tasks_ref, // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction tp_tasks_ref, // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction
scene_QuadClt, // QuadCLT scene_QuadCLT, scene_QuadClt, // QuadCLT scene_QuadCLT,
...@@ -2706,7 +2713,7 @@ public class Interscene { ...@@ -2706,7 +2713,7 @@ public class Interscene {
mb_vectors, // double [][] mb_vectors, // now [2][ntiles]; mb_vectors, // double [][] mb_vectors, // now [2][ntiles];
2, // int imp_debug_level, 2, // int imp_debug_level,
debug_level); // 1); // -1); // int debug_level); debug_level); // 1); // -1); // int debug_level);
TileProcessor tp = reference_QuadClt.getTileProcessor(); TileProcessor tp = first_QuadClt.getTileProcessor();
int tilesX = tp.getTilesX(); int tilesX = tp.getTilesX();
int tilesY = tp.getTilesY(); int tilesY = tp.getTilesY();
...@@ -2715,7 +2722,7 @@ public class Interscene { ...@@ -2715,7 +2722,7 @@ public class Interscene {
tilesX, tilesX,
tilesY, tilesY,
true, true,
scene_QuadClt.getImageName()+"-"+reference_QuadClt.getImageName()+"-CORR-FPN", scene_QuadClt.getImageName()+"-"+first_QuadClt.getImageName()+"-CORR-FPN",
fpn_dbg_titles); fpn_dbg_titles);
} }
if (clt_parameters.imp.debug_level > -2) { if (clt_parameters.imp.debug_level > -2) {
...@@ -2845,8 +2852,9 @@ public class Interscene { ...@@ -2845,8 +2852,9 @@ public class Interscene {
0, // mb_max_gain, // double mb_max_gain, 0, // mb_max_gain, // double mb_max_gain,
null, // double [] min_max, // null or pair of minimal and maximal offsets null, // double [] min_max, // null or pair of minimal and maximal offsets
null, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max null, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt, // QuadCLT reference_QuadCLT, reference_QuadClt, // QuadCLT ref_scene, // Scene for which DSI (ref_disparity) is calculated
ref_disparity, // null, // double [] ref_disparity, // null or alternative reference disparity ref_disparity, // null, // double [] ref_disparity, // null or alternative reference disparity
reference_QuadClt, // QuadCLT first_scene,
pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene 11653 pXpYD_ref, // double [][] pXpYD_ref, // pXpYD for the reference scene 11653
tp_tasks_ref, // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction tp_tasks_ref, // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction
scene_QuadClt, // QuadCLT scene_QuadCLT, scene_QuadClt, // QuadCLT scene_QuadCLT,
...@@ -2944,7 +2952,7 @@ public class Interscene { ...@@ -2944,7 +2952,7 @@ public class Interscene {
* @param clt_parameters * @param clt_parameters
* @param use3D when true, generate disparity difference in addition to average {pX,pY} * @param use3D when true, generate disparity difference in addition to average {pX,pY}
* @param mb_max_gain * @param mb_max_gain
* @param ref_scene * @param first_scene
* @param ref_disparity * @param ref_disparity
* @param pXpYD_ref * @param pXpYD_ref
* @param tp_tasks_ref * @param tp_tasks_ref
...@@ -2971,8 +2979,9 @@ public class Interscene { ...@@ -2971,8 +2979,9 @@ public class Interscene {
double mb_max_gain, double mb_max_gain,
double [] min_max, // null or pair of minimal and maximal offsets double [] min_max, // null or pair of minimal and maximal offsets
int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
QuadCLT ref_scene, QuadCLT ref_scene, // Scene for which DSI (ref_disparity) is calculated
double [] ref_disparity, // null or alternative reference disparity double [] ref_disparity, // null or alternative reference disparity
QuadCLT first_scene, // first in a pair, scene to compare to
double [][] pXpYD_ref, // pXpYD for the reference scene double [][] pXpYD_ref, // pXpYD for the reference scene
TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction. TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction.
QuadCLT scene, QuadCLT scene,
...@@ -2993,10 +3002,10 @@ public class Interscene { ...@@ -2993,10 +3002,10 @@ public class Interscene {
{ {
boolean use3D_lma = clt_parameters.ilp.ilma_3d_lma; boolean use3D_lma = clt_parameters.ilp.ilma_3d_lma;
boolean use3D_lma_tilt_only = clt_parameters.ilp.ilma_3d_tilt_only; boolean use3D_lma_tilt_only = clt_parameters.ilp.ilma_3d_tilt_only;
if (!ref_scene.hasGPU()) { if (!first_scene.hasGPU()) {
throw new IllegalArgumentException ("interCorrPair(): CPU mode not supported"); throw new IllegalArgumentException ("interCorrPair(): CPU mode not supported");
} }
TileProcessor tp = ref_scene.getTileProcessor(); TileProcessor tp = first_scene.getTileProcessor();
// Temporary reusing same ref scene ****** // Temporary reusing same ref scene ******
boolean scene_is_ref_test = clt_parameters.imp.scene_is_ref_test; // false; // true; boolean scene_is_ref_test = clt_parameters.imp.scene_is_ref_test; // false; // true;
boolean show_2d_correlations = clt_parameters.imp.show2dCorrelations(imp_debug_level); // true; boolean show_2d_correlations = clt_parameters.imp.show2dCorrelations(imp_debug_level); // true;
...@@ -3032,9 +3041,9 @@ public class Interscene { ...@@ -3032,9 +3041,9 @@ public class Interscene {
double eq_level = clt_parameters.imp.eq_level; // 0.8; // equalize to (log) fraction of average/this strength double eq_level = clt_parameters.imp.eq_level; // 0.8; // equalize to (log) fraction of average/this strength
final double scene_disparity_cor = clt_parameters.imp.disparity_corr; // 04/07/2023 // 0.0; final double scene_disparity_cor = clt_parameters.imp.disparity_corr; // 04/07/2023 // 0.0;
final double gpu_sigma_corr = clt_parameters.getGpuCorrSigma(ref_scene.isMonochrome()); final double gpu_sigma_corr = clt_parameters.getGpuCorrSigma(first_scene.isMonochrome());
final double gpu_sigma_rb_corr = ref_scene.isMonochrome()? 1.0 : clt_parameters.gpu_sigma_rb_corr; final double gpu_sigma_rb_corr = first_scene.isMonochrome()? 1.0 : clt_parameters.gpu_sigma_rb_corr;
final double gpu_sigma_log_corr = clt_parameters.getGpuCorrLoGSigma(ref_scene.isMonochrome()); final double gpu_sigma_log_corr = clt_parameters.getGpuCorrLoGSigma(first_scene.isMonochrome());
boolean mb_en = clt_parameters.imp.mb_en ; boolean mb_en = clt_parameters.imp.mb_en ;
double mb_tau = clt_parameters.imp.mb_tau; // 0.008; // time constant, sec double mb_tau = clt_parameters.imp.mb_tau; // 0.008; // time constant, sec
...@@ -3052,7 +3061,7 @@ public class Interscene { ...@@ -3052,7 +3061,7 @@ public class Interscene {
} }
if (show_tptask_ref) { if (show_tptask_ref) {
if (tp_tasks_ref != null){ if (tp_tasks_ref != null){
String dbg_title = ref_scene.getImageName()+"-ref"; String dbg_title = first_scene.getImageName()+"-ref";
TpTask.showTpTask( TpTask.showTpTask(
tp_tasks_ref, // TpTask[] tp_tasks, tp_tasks_ref, // TpTask[] tp_tasks,
tilesX, // int tilesX, tilesX, // int tilesX,
...@@ -3063,17 +3072,17 @@ public class Interscene { ...@@ -3063,17 +3072,17 @@ public class Interscene {
ImageDtt image_dtt; ImageDtt image_dtt;
image_dtt = new ImageDtt( image_dtt = new ImageDtt(
ref_scene.getNumSensors(), // , first_scene.getNumSensors(), // ,
clt_parameters.transform_size, clt_parameters.transform_size,
clt_parameters.img_dtt, clt_parameters.img_dtt,
ref_scene.isAux(), first_scene.isAux(),
ref_scene.isMonochrome(), first_scene.isMonochrome(),
ref_scene.isLwir(), first_scene.isLwir(),
clt_parameters.getScaleStrength(ref_scene.isAux()), clt_parameters.getScaleStrength(first_scene.isAux()),
ref_scene.getGPU()); first_scene.getGPU());
image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null image_dtt.getCorrelation2d(); // initiate image_dtt.correlation2d, needed if disparity_map != null
if (ref_scene.getGPU() != null) { if (first_scene.getGPU() != null) {
ref_scene.getGPU().setGpu_debug_level(debug_level - 4); // monitor GPU ops >=-1 first_scene.getGPU().setGpu_debug_level(debug_level - 4); // monitor GPU ops >=-1
} }
final double disparity_corr = clt_parameters.imp.disparity_corr; // 04/07/2023 // 0.0; // (z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/z_correction); final double disparity_corr = clt_parameters.imp.disparity_corr; // 04/07/2023 // 0.0; // (z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/z_correction);
//ref_disparity //ref_disparity
...@@ -3190,7 +3199,7 @@ public class Interscene { ...@@ -3190,7 +3199,7 @@ public class Interscene {
swd += scene_disparity_strength[0][i] * scene_disparity_strength[1][i]; swd += scene_disparity_strength[0][i] * scene_disparity_strength[1][i];
} }
average_disparity = swd/sw; average_disparity = swd/sw;
double magic_scale = use3D_lma? 1.0 : ref_scene.getTileProcessor().getMagicScale(); double magic_scale = use3D_lma? 1.0 : first_scene.getTileProcessor().getMagicScale();
for (int i = 0; i < scene_disparity_strength[0].length; i++) { for (int i = 0; i < scene_disparity_strength[0].length; i++) {
// scene_disparity_strength[0][i] = (scene_disparity_strength[0][i] - average_disparity) / average_absolute_disparity; // scene_disparity_strength[0][i] = (scene_disparity_strength[0][i] - average_disparity) / average_absolute_disparity;
scene_disparity_strength[0][i] = (scene_disparity_strength[0][i] - average_disparity) /magic_scale; scene_disparity_strength[0][i] = (scene_disparity_strength[0][i] - average_disparity) /magic_scale;
...@@ -3205,15 +3214,15 @@ public class Interscene { ...@@ -3205,15 +3214,15 @@ public class Interscene {
ref_disparity, // dls[0], // final double [] disparity_ref, // invalid tiles - NaN in disparity (maybe it should not be masked by margins?) ref_disparity, // dls[0], // final double [] disparity_ref, // invalid tiles - NaN in disparity (maybe it should not be masked by margins?)
ZERO3, // scene_xyz, // final double [] scene_xyz, // camera center in world coordinates ZERO3, // scene_xyz, // final double [] scene_xyz, // camera center in world coordinates
ZERO3, // scene_atr, // final double [] scene_atr, // camera orientation relative to world frame ZERO3, // scene_atr, // final double [] scene_atr, // camera orientation relative to world frame
ref_scene, // final QuadCLT scene_QuadClt, first_scene, // final QuadCLT scene_QuadClt,
ref_scene); // final QuadCLT reference_QuadClt) first_scene); // final QuadCLT reference_QuadClt)
double [][] dbg_ref_pXpYD2 = OpticalFlow.transformToScenePxPyD( // will be null for disparity == NaN, total size - tilesX*tilesY double [][] dbg_ref_pXpYD2 = OpticalFlow.transformToScenePxPyD( // will be null for disparity == NaN, total size - tilesX*tilesY
null, // final Rectangle [] extra_woi, // show larger than sensor WOI (or null) null, // final Rectangle [] extra_woi, // show larger than sensor WOI (or null)
ref_disparity, // dls[0], // final double [] disparity_ref, // invalid tiles - NaN in disparity (maybe it should not be masked by margins?) ref_disparity, // dls[0], // final double [] disparity_ref, // invalid tiles - NaN in disparity (maybe it should not be masked by margins?)
ZERO3, // scene_xyz, // final double [] scene_xyz, // camera center in world coordinates ZERO3, // scene_xyz, // final double [] scene_xyz, // camera center in world coordinates
new double[] {0,0,0.00001}, // scene_atr, // final double [] scene_atr, // camera orientation relative to world frame new double[] {0,0,0.00001}, // scene_atr, // final double [] scene_atr, // camera orientation relative to world frame
ref_scene, // final QuadCLT scene_QuadClt, first_scene, // final QuadCLT scene_QuadClt,
ref_scene); // final QuadCLT reference_QuadClt) first_scene); // final QuadCLT reference_QuadClt)
double [][] dbg_img = new double[6][dbg_ref_pXpYD.length]; double [][] dbg_img = new double[6][dbg_ref_pXpYD.length];
for (int i = 0; i < dbg_img.length; i++) { for (int i = 0; i < dbg_img.length; i++) {
Arrays.fill(dbg_img[i], Double.NaN); Arrays.fill(dbg_img[i], Double.NaN);
...@@ -3236,10 +3245,10 @@ public class Interscene { ...@@ -3236,10 +3245,10 @@ public class Interscene {
tilesX, tilesX,
tilesY, tilesY,
true, true,
scene.getImageName()+"-"+ref_scene.getImageName()+"-transform_test", scene.getImageName()+"-"+first_scene.getImageName()+"-transform_test",
dbg_titles); dbg_titles);
System.out.println("transform_test ref_scene: "+ ref_scene.getImageName()); System.out.println("transform_test ref_scene: "+ first_scene.getImageName());
ref_scene.getErsCorrection().printVectors(scene_xyz, scene_atr); first_scene.getErsCorrection().printVectors(scene_xyz, scene_atr);
} }
...@@ -3327,11 +3336,11 @@ public class Interscene { ...@@ -3327,11 +3336,11 @@ public class Interscene {
} }
if (show_render_ref) { if (show_render_ref) {
ImagePlus imp_render_ref = ref_scene.renderFromTD ( ImagePlus imp_render_ref = first_scene.renderFromTD (
-1, // final int sensor_mask, -1, // final int sensor_mask,
false, // boolean merge_channels, false, // boolean merge_channels,
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
clt_parameters.getColorProcParameters(ref_scene.isAux()), //ColorProcParameters colorProcParameters, clt_parameters.getColorProcParameters(first_scene.isAux()), //ColorProcParameters colorProcParameters,
clt_parameters.getRGBParameters(), //EyesisCorrectionParameters.RGBParameters rgbParameters, clt_parameters.getRGBParameters(), //EyesisCorrectionParameters.RGBParameters rgbParameters,
null, // int [] wh, null, // int [] wh,
toRGB, // boolean toRGB, toRGB, // boolean toRGB,
...@@ -3344,7 +3353,7 @@ public class Interscene { ...@@ -3344,7 +3353,7 @@ public class Interscene {
-1, // final int sensor_mask, -1, // final int sensor_mask,
false, // boolean merge_channels, false, // boolean merge_channels,
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
clt_parameters.getColorProcParameters(ref_scene.isAux()), //ColorProcParameters colorProcParameters, clt_parameters.getColorProcParameters(first_scene.isAux()), //ColorProcParameters colorProcParameters,
clt_parameters.getRGBParameters(), //EyesisCorrectionParameters.RGBParameters rgbParameters, clt_parameters.getRGBParameters(), //EyesisCorrectionParameters.RGBParameters rgbParameters,
null, // int [] wh, null, // int [] wh,
toRGB, // boolean toRGB, toRGB, // boolean toRGB,
...@@ -3357,7 +3366,7 @@ public class Interscene { ...@@ -3357,7 +3366,7 @@ public class Interscene {
float [][] foffsets = getInterCorrOffsetsDebug( float [][] foffsets = getInterCorrOffsetsDebug(
tp_tasks_ref, // final TpTask[] tp_tasks_ref, tp_tasks_ref, // final TpTask[] tp_tasks_ref,
tp_tasks[0], // final TpTask[] tp_tasks, tp_tasks[0], // final TpTask[] tp_tasks,
ref_scene.getNumSensors(), first_scene.getNumSensors(),
tilesX, // final int tilesX, tilesX, // final int tilesX,
tilesY); // final int tilesY tilesY); // final int tilesY
for (int i = 0; (i < dbg_corr_fpn.length) && (i < foffsets.length); i++) { for (int i = 0; (i < dbg_corr_fpn.length) && (i < foffsets.length); i++) {
...@@ -3371,7 +3380,7 @@ public class Interscene { ...@@ -3371,7 +3380,7 @@ public class Interscene {
fpn_max_offset, // final double max_offset, fpn_max_offset, // final double max_offset,
tp_tasks_ref, // final TpTask[] tp_tasks_ref, tp_tasks_ref, // final TpTask[] tp_tasks_ref,
tp_tasks[0], // final TpTask[] tp_tasks, tp_tasks[0], // final TpTask[] tp_tasks,
ref_scene.getNumSensors(), // final int numSens, first_scene.getNumSensors(), // final int numSens,
tilesX, // final int tilesX, tilesX, // final int tilesX,
tilesY); // final int tilesY); tilesY); // final int tilesY);
} }
...@@ -3381,7 +3390,7 @@ public class Interscene { ...@@ -3381,7 +3390,7 @@ public class Interscene {
Double.NaN, // final double max_offset, Double.NaN, // final double max_offset,
tp_tasks_ref, // final TpTask[] tp_tasks_ref, tp_tasks_ref, // final TpTask[] tp_tasks_ref,
tp_tasks[0], // final TpTask[] tp_tasks, tp_tasks[0], // final TpTask[] tp_tasks,
ref_scene.getNumSensors(), // final int numSens, first_scene.getNumSensors(), // final int numSens,
tilesX, // final int tilesX, tilesX, // final int tilesX,
tilesY); // final int tilesY); tilesY); // final int tilesY);
if (offsets == null) { if (offsets == null) {
...@@ -3441,7 +3450,7 @@ public class Interscene { ...@@ -3441,7 +3450,7 @@ public class Interscene {
double min_str = all_fpn ? clt_parameters.imp.min_str_fpn : clt_parameters.imp.min_str; double min_str = all_fpn ? clt_parameters.imp.min_str_fpn : clt_parameters.imp.min_str;
double min_str_sum = all_fpn ? clt_parameters.imp.min_str_sum_fpn : clt_parameters.imp.min_str_sum; double min_str_sum = all_fpn ? clt_parameters.imp.min_str_sum_fpn : clt_parameters.imp.min_str_sum;
double min_str_neib = all_fpn ? clt_parameters.imp.min_str_neib_fpn : clt_parameters.imp.min_str_neib; double min_str_neib = all_fpn ? clt_parameters.imp.min_str_neib_fpn : clt_parameters.imp.min_str_neib;
double corr_fz_inter = clt_parameters.getGpuFatZeroInter(ref_scene.isMonochrome()); double corr_fz_inter = clt_parameters.getGpuFatZeroInter(first_scene.isMonochrome());
if (mb_en && (mb_vectors!=null)) { // increase fat zero when there is motion blur if (mb_en && (mb_vectors!=null)) { // increase fat zero when there is motion blur
corr_fz_inter *= 8; corr_fz_inter *= 8;
} }
...@@ -3586,7 +3595,7 @@ public class Interscene { ...@@ -3586,7 +3595,7 @@ public class Interscene {
tilesX, tilesX,
tilesY, tilesY,
true, true,
scene.getImageName()+"-"+ref_scene.getImageName()+"-coord_motion-eq", scene.getImageName()+"-"+first_scene.getImageName()+"-coord_motion-eq",
mvTitles); mvTitles);
} }
...@@ -3594,7 +3603,7 @@ public class Interscene { ...@@ -3594,7 +3603,7 @@ public class Interscene {
} }
if (mov_en) { if (mov_en) {
String debug_image_name = mov_debug_images ? (scene.getImageName()+"-"+ref_scene.getImageName()+"-movements"): null; String debug_image_name = mov_debug_images ? (scene.getImageName()+"-"+first_scene.getImageName()+"-movements"): null;
boolean [] move_mask = getMovementMask( boolean [] move_mask = getMovementMask(
clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters,
coord_motion[1], // double [][] motion, // only x,y,w components coord_motion[1], // double [][] motion, // only x,y,w components
...@@ -3641,7 +3650,7 @@ public class Interscene { ...@@ -3641,7 +3650,7 @@ public class Interscene {
tilesX*(2*image_dtt.transform_size), tilesX*(2*image_dtt.transform_size),
tilesY*(2*image_dtt.transform_size), tilesY*(2*image_dtt.transform_size),
true, true,
scene.getImageName()+"-"+ref_scene.getImageName()+"-interscene", scene.getImageName()+"-"+first_scene.getImageName()+"-interscene",
titles); titles);
} }
...@@ -3690,7 +3699,7 @@ public class Interscene { ...@@ -3690,7 +3699,7 @@ public class Interscene {
tilesX, tilesX,
tilesY, tilesY,
true, true,
scene.getImageName()+"-"+ref_scene.getImageName()+"-motion_vectors", scene.getImageName()+"-"+first_scene.getImageName()+"-motion_vectors",
titles); titles);
} }
if (show_coord_motion) { if (show_coord_motion) {
...@@ -3721,7 +3730,7 @@ public class Interscene { ...@@ -3721,7 +3730,7 @@ public class Interscene {
tilesX, tilesX,
tilesY, tilesY,
true, true,
scene.getImageName()+"-"+ref_scene.getImageName()+"-coord_motion", scene.getImageName()+"-"+first_scene.getImageName()+"-coord_motion",
mvTitles); mvTitles);
} }
if (debug_level > 0){ if (debug_level > 0){
......
...@@ -219,8 +219,9 @@ public class StructureFromMotion { ...@@ -219,8 +219,9 @@ public class StructureFromMotion {
mb_max_gain, // double mb_max_gain, mb_max_gain, // double mb_max_gain,
null, // min_max, // double [] min_max, // null or pair of minimal and maximal offsets null, // min_max, // double [] min_max, // null or pair of minimal and maximal offsets
fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max fail_reason, // int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
ref_scene, // QuadCLT reference_QuadCLT, ref_scene, // QuadCLT ref_scene, // Scene for which DSI (ref_disparity) is calculated
ref_disparity, // double [] ref_disparity, // null or alternative reference disparity ref_disparity, // double [] ref_disparity, // null or alternative reference disparity
ref_scene, // QuadCLT first_scene,
ref_pXpYD, // double [][] pXpYD_ref, // pXpYD for the reference scene ref_pXpYD, // double [][] pXpYD_ref, // pXpYD for the reference scene
tp_tasks_ref[0], // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction tp_tasks_ref[0], // TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction
scene, // QuadCLT scene_QuadCLT, scene, // QuadCLT scene_QuadCLT,
......
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