Loading src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java +1 −1 Original line number Diff line number Diff line Loading @@ -1598,7 +1598,7 @@ public class ErsCorrection extends GeometryCorrection { } } @Deprecated public void compareDSItoWorldDerivatives( QuadCLT scene_QuadClt, double max_inf_disparity, // absolute value Loading src/main/java/com/elphel/imagej/tileprocessor/Interscene.java +135 −6 Original line number Diff line number Diff line Loading @@ -514,6 +514,7 @@ public class Interscene { double min_ref_str = clt_parameters.imp.min_ref_str; boolean ref_need_lma = clt_parameters.imp.ref_need_lma; double min_ref_frac= clt_parameters.imp.min_ref_frac; boolean ref_smooth = clt_parameters.imp.ref_smooth; //true; // use SfM filtering if available 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 Loading Loading @@ -636,6 +637,7 @@ public class Interscene { scene_index, // int nscene1, // compares to nscene0 null, // double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles ref_smooth, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[ref_index], // double [][] scene0_xyzatr,, initial_pose, // double [][] scene1_xyzatr, Double.NaN, // double average_z, Loading Loading @@ -749,6 +751,7 @@ public class Interscene { fpn_pairs[ipair][0], // int nscene1, // compares to nscene0 null, // double [] ref_disparity, // null or alternative reference disparity reliable_ref, //boolean [] reliable_ref, // null or bitmask of reliable reference tiles ref_smooth, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[fpn_pairs[ipair][1]], // double [][] scene0_xyzatr,, scenes_xyzatr[fpn_pairs[ipair][0]], // initial_pose, // double [][] scene1_xyzatr, Double.NaN, // double average_z, Loading Loading @@ -847,6 +850,12 @@ public class Interscene { 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-e boolean ref_smooth = clt_parameters.imp.ref_smooth; //true; // use SfM filtering if available // double ref_sigma = clt_parameters.imp.ref_sigma; //10.0; // minimal value of the SfM gain maximum to consider available // double ref_smooth_diff = clt_parameters.imp.ref_smooth_diff; // 0.75; // minimal fraction of the SfM maximal gain int max_num_scenes = clt_parameters.imp.max_num_scenes; // cut longer series boolean ims_use = clt_parameters.imp.ims_use; Loading Loading @@ -906,7 +915,7 @@ public class Interscene { ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection(); int debug_scene = -15; int debug_scene = 57; // -15; last before boolean debug2 = !batch_mode; // false; // true; boolean [] reliable_ref = null; boolean use_lma_dsi = clt_parameters.imp.use_lma_dsi; Loading Loading @@ -974,6 +983,26 @@ public class Interscene { debugLevel); // final int debugLevel); } double [][][] ims_xyzatr; // TODO: Remove when done! // if ((nscene == 57) || (nscene == 58)) { // } /* double [][][] ims_xyzatr_PIMU= QuadCLT.integratePIMU( clt_parameters, // final CLTParameters clt_parameters, quadCLTs, // final QuadCLT[] quadCLTs, ref_index, // final int ref_index, null, // double [][][] dxyzatr, 0, // final int early_index, (quadCLTs.length -1) // int last_index, ); double [][][] ims_xyzatr_INT=quadCLTs[ref_index].getXyzatrIms( clt_parameters, // CLTParameters clt_parameters, quadCLTs, // QuadCLT[] quadCLTs, quat_corr, // double [] quat_corr, // only applies to rotations - verify! debugLevel) ; // int debugLevel) */ if (inertial_only) { ims_xyzatr = QuadCLT.integratePIMU( clt_parameters, // final CLTParameters clt_parameters, Loading @@ -991,7 +1020,29 @@ public class Interscene { quat_corr, // double [] quat_corr, // only applies to rotations - verify! debugLevel) ; // int debugLevel) } boolean man_corr = debugLevel<10; int other_scene = -1; // 57 if (man_corr) { other_scene = 57; // double [][] xyz_atr_le = {{-0.5183922094898724, 9.154782438090823, 1.9419561092947408},{0,0,0}}; // double [][] xyz_atr_le = {{-0.8268073979557207, 12.435651264663617, 0.43389361433133333},{0,0,0}}; // double [][] xyz_atr_le = { // {-1.5074533979557208, 5.289806264663618, 0.6908026143313334}, // {-0.015346300027727794,0.16450786973129805,-0.008030574830017914}}; double [][] xyz_atr_le = { {-1.5074533979557208, 2.401806264663618, 0.6908026143313334}, {-0.015346300027727794,0.23050786973129805,-0.008030574830017914}}; // double [][] xyz_atr_le = { // {0, 0, 0.6908026143313334}, // {0.018641752679327314, 0.2862869959075706, -0.008030574830017914}}; double [][] xyz_atr_gt = {{ 0, 0, 0}, {0,0,0}}; manualIMSCorrection ( ims_xyzatr, // double [][][] xyz_atr, other_scene, // int corr_indx, // 57 correct scenes LE this xyz_atr_le, // double [][] xyz_atr_le, xyz_atr_gt);// double [][] xyz_atr_gt); } double [][][] scenes_xyzatr = new double [quadCLTs.length][][]; // previous scene relative to the next one scenes_xyzatr[ref_index] = new double[2][3]; // all zeros // boolean after_spiral = false; Loading Loading @@ -1019,6 +1070,9 @@ public class Interscene { // min_max[1] = max_offset; final double max_rms = clt_parameters.imp.eig_use? clt_parameters.imp.eig_max_rms: clt_parameters.imp.max_rms; for (int scene_index = ref_index - 1; scene_index >= earliest_scene ; scene_index--) { if (scene_index == other_scene) { last_corr_xyzatr = new double [][] {ZERO3,ZERO3}; // start from scratch } if ((ref_index - scene_index) >= max_num_scenes){ earliest_scene = scene_index + 1; if (debugLevel > -3) { Loading Loading @@ -1113,6 +1167,7 @@ public class Interscene { scene_index, // int nscene1, // compares to nscene0 null, // double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles ref_smooth, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[ref_index], // double [][] scene0_xyzatr,, initial_pose, // double [][] scene1_xyzatr, Double.NaN, // double average_z, Loading Loading @@ -1278,6 +1333,7 @@ public class Interscene { fpn_pairs[ipair][0], // int nscene1, // compares to nscene0 null, // double [] ref_disparity, // null or alternative reference disparity reliable_ref, //boolean [] reliable_ref, // null or bitmask of reliable reference tiles ref_smooth, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[fpn_pairs[ipair][1]], // double [][] scene0_xyzatr,, scenes_xyzatr[fpn_pairs[ipair][0]], // initial_pose, // double [][] scene1_xyzatr, Double.NaN, // double average_z, Loading Loading @@ -1375,6 +1431,28 @@ public class Interscene { return earliest_scene; } public static void manualIMSCorrection ( double [][][] xyz_atr, int corr_indx, // 57 correct scenes LE this double [][] xyz_atr_le, double [][] xyz_atr_gt) { for (int i = 0; i <= corr_indx; i++) { for (int t = 0; t < xyz_atr_le.length; t++) { for (int j = 0; j < xyz_atr_le[t].length; j++) { xyz_atr[i][t][j] += xyz_atr_le[t][j]; } } } for (int i = corr_indx+1; i < xyz_atr.length; i++) { for (int t = 0; t < xyz_atr_le.length; t++) { for (int j = 0; j < xyz_atr_le[t].length; j++) { xyz_atr[i][t][j] += xyz_atr_gt[t][j]; } } } } public static void testPIMU( final CLTParameters clt_parameters, final QuadCLT[] quadCLTs, Loading Loading @@ -2167,7 +2245,7 @@ public class Interscene { scenes_xyzatr[ref_index] = new double[2][3]; // all zeros // should have at least next or previous non-null int debug_scene = 69; // -68; // -8; int debug_scene = 161; // 69; // -68; // -8; RMSEStats rmse_stats = new RMSEStats(); RMSEStats rmse_stats_metric = clt_parameters.imp.eig_use ? (new RMSEStats()):null; if (debug_ers) { Loading Loading @@ -2385,6 +2463,7 @@ public class Interscene { test_pair[1], // int nscene1, // compares to nscene0 interscene_ref_disparity,// double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles false, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[test_pair[0]],// double [][] scene0_xyzatr, scenes_xyzatr[test_pair[1]], // double [][] scene1_xyzatr, avg_z, // double average_z, Loading Loading @@ -2515,6 +2594,7 @@ public class Interscene { nscene, // int nscene1, // compares to nscene0 interscene_ref_disparity,// double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles false, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[ref_index],// double [][] scene0_xyzatr, scenes_xyzatr[nscene], // double [][] scene1_xyzatr, avg_z, // double average_z, Loading Loading @@ -2698,6 +2778,7 @@ public class Interscene { fpn_pairs[ipair][0], // int nscene1, // compares to nscene0 interscene_ref_disparity,// double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles false, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[fpn_pairs[ipair][1]],// double [][] scene0_xyzatr, scenes_xyzatr[fpn_pairs[ipair][0]], // double [][] scene1_xyzatr, avg_z, // double average_z, Loading Loading @@ -2774,6 +2855,7 @@ public class Interscene { test_pair[0], // int nscene1, // compares to nscene0 interscene_ref_disparity,// double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles false, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[test_pair[1]],// double [][] scene0_xyzatr, scenes_xyzatr[test_pair[0]], // double [][] scene1_xyzatr, avg_z, // double average_z, Loading Loading @@ -2896,12 +2978,13 @@ public class Interscene { int ref_index, TpTask[][] tp_tasks_ref, // Should be TpTask[2][*]. If tp_tasks_ref[0] == null will calculate // at set first scene to the GPU double [][] pXpYD_ref, // should be se or at least double [num_tiles][] if tp_tasks_ref[0] == null double [][] pXpYD_ref, // should be set or at least double [num_tiles][] if tp_tasks_ref[0] == null // will be recalculated when tp_tasks_ref[0] == null, but for reference frame int nscene0, // may be == ref_index int nscene1, // compares to nscene0 double [] ref_disparity, // null or alternative reference disparity boolean [] reliable_ref, // null or bitmask of reliable reference tiles boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true double [][] scene0_xyzatr, double [][] scene1_xyzatr, double average_z, Loading @@ -2915,10 +2998,53 @@ public class Interscene { double mb_max_gain, // 5.0; // motion blur maximal gain (if more - move second point more than a pixel int debugLevel) { double ref_sigma = clt_parameters.imp.ref_sigma; //10.0; // minimal value of the SfM gain maximum to consider available double ref_smooth_diff = clt_parameters.imp.ref_smooth_diff; // 0.75; // minimal fraction of the SfM maximal gain boolean apply_nan = true; // boolean use_lma_dsi = clt_parameters.imp.use_lma_dsi; if (ref_disparity == null) { ref_disparity = quadCLTs[ref_index].getDLS()[use_lma_dsi?1:0]; } if (smooth_disparity) { double [] dbg_disparity = (debugLevel > 2) ? ref_disparity.clone() : null; boolean [] dbg_reliable = ((dbg_disparity != null) && (reliable_ref != null)) ? reliable_ref.clone(): null; ref_disparity = quadCLTs[ref_index].smoothDisparity( ref_disparity, // double [] disparity_in, (will not modify) reliable_ref, // boolean [] reliable_ref, // optional ref_sigma, // double sigma, ref_smooth_diff, // double max_diff, apply_nan); // boolean apply_nan) if (dbg_disparity != null) { String [] dbg_titles = {"ref", "smooth", "reliable_in", "reliable_out"}; String dbg_title = quadCLTs[ref_index].getImageName()+"-smooth_ref"; double [][] dbg_img = new double [dbg_titles.length][ref_disparity.length]; for (int i = 0; i < dbg_img.length; i++) { Arrays.fill(dbg_img[i], Double.NaN); } dbg_img[0] = dbg_disparity; dbg_img[1] = ref_disparity; for (int i = 0; i < ref_disparity.length; i++) { if (dbg_reliable != null) { dbg_img[2][i] = dbg_reliable[i] ? 10.0: Double.NaN; } if (reliable_ref != null) { dbg_img[3][i] = reliable_ref[i] ? 10.0: Double.NaN; } } int dbg_width = quadCLTs[ref_index].getTileProcessor().getTilesX(); int dbg_height = quadCLTs[ref_index].getTileProcessor().getTilesY(); ShowDoubleFloatArrays.showArrays( dbg_img, dbg_width, dbg_height, true, dbg_title, dbg_titles); } } // TODO: set reference as new version of adjustPairsLMAInterscene() assumes it set if ((tp_tasks_ref == null) || (tp_tasks_ref[0] == null)) { // calculate and setup reference (for comparison) scene to GPU if (tp_tasks_ref == null) { Loading Loading @@ -3357,6 +3483,7 @@ public class Interscene { // boolean dbg_images = false; double [][] eigen_masked = clt_parameters.imp.eig_xy_lma? null : eigen; String dbg_prefix = dbg_images? (first_QuadClt.getImageName()+"-"+scene_QuadClt.getImageName()+"-NLMA_"+nlma) : null; final boolean same_weights = false; intersceneLma.prepareLMA( scene_xyzatr0, // final double [] scene_xyzatr0, // camera center in world coordinates (or null to use instance) scene_xyzatr_pull, // final double [] scene_xyz_pull, // if both are not null, specify target values to pull to Loading @@ -3371,6 +3498,7 @@ public class Interscene { eigen_masked, // final double [][] eigen, // [tilesX*tilesY]{lamb0_x,lamb0_y, lamb0, lamb1} eigenvector0[x,y],lam0,lam1 coord_motion[1], // final double [][] vector_XYS, // optical flow X,Y, confidence obtained from the correlate2DIterate() coord_motion[0], // final double [][] centers, // macrotile centers (in pixels and average disparities same_weights, // final boolean same_weights, (nlma == 0), // boolean first_run, dbg_prefix, // String dbg_prefix, // null or image name prefix clt_parameters.imp.debug_level); // final int debug_level) Loading Loading @@ -3838,7 +3966,8 @@ public class Interscene { boolean mov_en = clt_parameters.imp.mov_en; // true; // enable detection/removal of the moving objects during pose matching boolean mov_debug_images = clt_parameters.imp.showMovementDetection(imp_debug_level); int mov_debug_level = clt_parameters.imp.movDebugLevel(imp_debug_level); // if (dbg_prefix != null) { // } boolean fpn_remove = !fpn_disable && clt_parameters.imp.fpn_remove; double fpn_max_offset = clt_parameters.imp.fpn_max_offset; final double fpn_min_offset = clt_parameters.imp.fpn_min_offset; Loading Loading
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java +1 −1 Original line number Diff line number Diff line Loading @@ -1598,7 +1598,7 @@ public class ErsCorrection extends GeometryCorrection { } } @Deprecated public void compareDSItoWorldDerivatives( QuadCLT scene_QuadClt, double max_inf_disparity, // absolute value Loading
src/main/java/com/elphel/imagej/tileprocessor/Interscene.java +135 −6 Original line number Diff line number Diff line Loading @@ -514,6 +514,7 @@ public class Interscene { double min_ref_str = clt_parameters.imp.min_ref_str; boolean ref_need_lma = clt_parameters.imp.ref_need_lma; double min_ref_frac= clt_parameters.imp.min_ref_frac; boolean ref_smooth = clt_parameters.imp.ref_smooth; //true; // use SfM filtering if available 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 Loading Loading @@ -636,6 +637,7 @@ public class Interscene { scene_index, // int nscene1, // compares to nscene0 null, // double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles ref_smooth, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[ref_index], // double [][] scene0_xyzatr,, initial_pose, // double [][] scene1_xyzatr, Double.NaN, // double average_z, Loading Loading @@ -749,6 +751,7 @@ public class Interscene { fpn_pairs[ipair][0], // int nscene1, // compares to nscene0 null, // double [] ref_disparity, // null or alternative reference disparity reliable_ref, //boolean [] reliable_ref, // null or bitmask of reliable reference tiles ref_smooth, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[fpn_pairs[ipair][1]], // double [][] scene0_xyzatr,, scenes_xyzatr[fpn_pairs[ipair][0]], // initial_pose, // double [][] scene1_xyzatr, Double.NaN, // double average_z, Loading Loading @@ -847,6 +850,12 @@ public class Interscene { 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-e boolean ref_smooth = clt_parameters.imp.ref_smooth; //true; // use SfM filtering if available // double ref_sigma = clt_parameters.imp.ref_sigma; //10.0; // minimal value of the SfM gain maximum to consider available // double ref_smooth_diff = clt_parameters.imp.ref_smooth_diff; // 0.75; // minimal fraction of the SfM maximal gain int max_num_scenes = clt_parameters.imp.max_num_scenes; // cut longer series boolean ims_use = clt_parameters.imp.ims_use; Loading Loading @@ -906,7 +915,7 @@ public class Interscene { ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection(); int debug_scene = -15; int debug_scene = 57; // -15; last before boolean debug2 = !batch_mode; // false; // true; boolean [] reliable_ref = null; boolean use_lma_dsi = clt_parameters.imp.use_lma_dsi; Loading Loading @@ -974,6 +983,26 @@ public class Interscene { debugLevel); // final int debugLevel); } double [][][] ims_xyzatr; // TODO: Remove when done! // if ((nscene == 57) || (nscene == 58)) { // } /* double [][][] ims_xyzatr_PIMU= QuadCLT.integratePIMU( clt_parameters, // final CLTParameters clt_parameters, quadCLTs, // final QuadCLT[] quadCLTs, ref_index, // final int ref_index, null, // double [][][] dxyzatr, 0, // final int early_index, (quadCLTs.length -1) // int last_index, ); double [][][] ims_xyzatr_INT=quadCLTs[ref_index].getXyzatrIms( clt_parameters, // CLTParameters clt_parameters, quadCLTs, // QuadCLT[] quadCLTs, quat_corr, // double [] quat_corr, // only applies to rotations - verify! debugLevel) ; // int debugLevel) */ if (inertial_only) { ims_xyzatr = QuadCLT.integratePIMU( clt_parameters, // final CLTParameters clt_parameters, Loading @@ -991,7 +1020,29 @@ public class Interscene { quat_corr, // double [] quat_corr, // only applies to rotations - verify! debugLevel) ; // int debugLevel) } boolean man_corr = debugLevel<10; int other_scene = -1; // 57 if (man_corr) { other_scene = 57; // double [][] xyz_atr_le = {{-0.5183922094898724, 9.154782438090823, 1.9419561092947408},{0,0,0}}; // double [][] xyz_atr_le = {{-0.8268073979557207, 12.435651264663617, 0.43389361433133333},{0,0,0}}; // double [][] xyz_atr_le = { // {-1.5074533979557208, 5.289806264663618, 0.6908026143313334}, // {-0.015346300027727794,0.16450786973129805,-0.008030574830017914}}; double [][] xyz_atr_le = { {-1.5074533979557208, 2.401806264663618, 0.6908026143313334}, {-0.015346300027727794,0.23050786973129805,-0.008030574830017914}}; // double [][] xyz_atr_le = { // {0, 0, 0.6908026143313334}, // {0.018641752679327314, 0.2862869959075706, -0.008030574830017914}}; double [][] xyz_atr_gt = {{ 0, 0, 0}, {0,0,0}}; manualIMSCorrection ( ims_xyzatr, // double [][][] xyz_atr, other_scene, // int corr_indx, // 57 correct scenes LE this xyz_atr_le, // double [][] xyz_atr_le, xyz_atr_gt);// double [][] xyz_atr_gt); } double [][][] scenes_xyzatr = new double [quadCLTs.length][][]; // previous scene relative to the next one scenes_xyzatr[ref_index] = new double[2][3]; // all zeros // boolean after_spiral = false; Loading Loading @@ -1019,6 +1070,9 @@ public class Interscene { // min_max[1] = max_offset; final double max_rms = clt_parameters.imp.eig_use? clt_parameters.imp.eig_max_rms: clt_parameters.imp.max_rms; for (int scene_index = ref_index - 1; scene_index >= earliest_scene ; scene_index--) { if (scene_index == other_scene) { last_corr_xyzatr = new double [][] {ZERO3,ZERO3}; // start from scratch } if ((ref_index - scene_index) >= max_num_scenes){ earliest_scene = scene_index + 1; if (debugLevel > -3) { Loading Loading @@ -1113,6 +1167,7 @@ public class Interscene { scene_index, // int nscene1, // compares to nscene0 null, // double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles ref_smooth, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[ref_index], // double [][] scene0_xyzatr,, initial_pose, // double [][] scene1_xyzatr, Double.NaN, // double average_z, Loading Loading @@ -1278,6 +1333,7 @@ public class Interscene { fpn_pairs[ipair][0], // int nscene1, // compares to nscene0 null, // double [] ref_disparity, // null or alternative reference disparity reliable_ref, //boolean [] reliable_ref, // null or bitmask of reliable reference tiles ref_smooth, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[fpn_pairs[ipair][1]], // double [][] scene0_xyzatr,, scenes_xyzatr[fpn_pairs[ipair][0]], // initial_pose, // double [][] scene1_xyzatr, Double.NaN, // double average_z, Loading Loading @@ -1375,6 +1431,28 @@ public class Interscene { return earliest_scene; } public static void manualIMSCorrection ( double [][][] xyz_atr, int corr_indx, // 57 correct scenes LE this double [][] xyz_atr_le, double [][] xyz_atr_gt) { for (int i = 0; i <= corr_indx; i++) { for (int t = 0; t < xyz_atr_le.length; t++) { for (int j = 0; j < xyz_atr_le[t].length; j++) { xyz_atr[i][t][j] += xyz_atr_le[t][j]; } } } for (int i = corr_indx+1; i < xyz_atr.length; i++) { for (int t = 0; t < xyz_atr_le.length; t++) { for (int j = 0; j < xyz_atr_le[t].length; j++) { xyz_atr[i][t][j] += xyz_atr_gt[t][j]; } } } } public static void testPIMU( final CLTParameters clt_parameters, final QuadCLT[] quadCLTs, Loading Loading @@ -2167,7 +2245,7 @@ public class Interscene { scenes_xyzatr[ref_index] = new double[2][3]; // all zeros // should have at least next or previous non-null int debug_scene = 69; // -68; // -8; int debug_scene = 161; // 69; // -68; // -8; RMSEStats rmse_stats = new RMSEStats(); RMSEStats rmse_stats_metric = clt_parameters.imp.eig_use ? (new RMSEStats()):null; if (debug_ers) { Loading Loading @@ -2385,6 +2463,7 @@ public class Interscene { test_pair[1], // int nscene1, // compares to nscene0 interscene_ref_disparity,// double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles false, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[test_pair[0]],// double [][] scene0_xyzatr, scenes_xyzatr[test_pair[1]], // double [][] scene1_xyzatr, avg_z, // double average_z, Loading Loading @@ -2515,6 +2594,7 @@ public class Interscene { nscene, // int nscene1, // compares to nscene0 interscene_ref_disparity,// double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles false, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[ref_index],// double [][] scene0_xyzatr, scenes_xyzatr[nscene], // double [][] scene1_xyzatr, avg_z, // double average_z, Loading Loading @@ -2698,6 +2778,7 @@ public class Interscene { fpn_pairs[ipair][0], // int nscene1, // compares to nscene0 interscene_ref_disparity,// double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles false, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[fpn_pairs[ipair][1]],// double [][] scene0_xyzatr, scenes_xyzatr[fpn_pairs[ipair][0]], // double [][] scene1_xyzatr, avg_z, // double average_z, Loading Loading @@ -2774,6 +2855,7 @@ public class Interscene { test_pair[0], // int nscene1, // compares to nscene0 interscene_ref_disparity,// double [] ref_disparity, // null or alternative reference disparity reliable_ref, // boolean [] reliable_ref, // null or bitmask of reliable reference tiles false, // boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true scenes_xyzatr[test_pair[1]],// double [][] scene0_xyzatr, scenes_xyzatr[test_pair[0]], // double [][] scene1_xyzatr, avg_z, // double average_z, Loading Loading @@ -2896,12 +2978,13 @@ public class Interscene { int ref_index, TpTask[][] tp_tasks_ref, // Should be TpTask[2][*]. If tp_tasks_ref[0] == null will calculate // at set first scene to the GPU double [][] pXpYD_ref, // should be se or at least double [num_tiles][] if tp_tasks_ref[0] == null double [][] pXpYD_ref, // should be set or at least double [num_tiles][] if tp_tasks_ref[0] == null // will be recalculated when tp_tasks_ref[0] == null, but for reference frame int nscene0, // may be == ref_index int nscene1, // compares to nscene0 double [] ref_disparity, // null or alternative reference disparity boolean [] reliable_ref, // null or bitmask of reliable reference tiles boolean smooth_disparity, // smooth disparity (according to clt_parameters)+update reliable_ref if true double [][] scene0_xyzatr, double [][] scene1_xyzatr, double average_z, Loading @@ -2915,10 +2998,53 @@ public class Interscene { double mb_max_gain, // 5.0; // motion blur maximal gain (if more - move second point more than a pixel int debugLevel) { double ref_sigma = clt_parameters.imp.ref_sigma; //10.0; // minimal value of the SfM gain maximum to consider available double ref_smooth_diff = clt_parameters.imp.ref_smooth_diff; // 0.75; // minimal fraction of the SfM maximal gain boolean apply_nan = true; // boolean use_lma_dsi = clt_parameters.imp.use_lma_dsi; if (ref_disparity == null) { ref_disparity = quadCLTs[ref_index].getDLS()[use_lma_dsi?1:0]; } if (smooth_disparity) { double [] dbg_disparity = (debugLevel > 2) ? ref_disparity.clone() : null; boolean [] dbg_reliable = ((dbg_disparity != null) && (reliable_ref != null)) ? reliable_ref.clone(): null; ref_disparity = quadCLTs[ref_index].smoothDisparity( ref_disparity, // double [] disparity_in, (will not modify) reliable_ref, // boolean [] reliable_ref, // optional ref_sigma, // double sigma, ref_smooth_diff, // double max_diff, apply_nan); // boolean apply_nan) if (dbg_disparity != null) { String [] dbg_titles = {"ref", "smooth", "reliable_in", "reliable_out"}; String dbg_title = quadCLTs[ref_index].getImageName()+"-smooth_ref"; double [][] dbg_img = new double [dbg_titles.length][ref_disparity.length]; for (int i = 0; i < dbg_img.length; i++) { Arrays.fill(dbg_img[i], Double.NaN); } dbg_img[0] = dbg_disparity; dbg_img[1] = ref_disparity; for (int i = 0; i < ref_disparity.length; i++) { if (dbg_reliable != null) { dbg_img[2][i] = dbg_reliable[i] ? 10.0: Double.NaN; } if (reliable_ref != null) { dbg_img[3][i] = reliable_ref[i] ? 10.0: Double.NaN; } } int dbg_width = quadCLTs[ref_index].getTileProcessor().getTilesX(); int dbg_height = quadCLTs[ref_index].getTileProcessor().getTilesY(); ShowDoubleFloatArrays.showArrays( dbg_img, dbg_width, dbg_height, true, dbg_title, dbg_titles); } } // TODO: set reference as new version of adjustPairsLMAInterscene() assumes it set if ((tp_tasks_ref == null) || (tp_tasks_ref[0] == null)) { // calculate and setup reference (for comparison) scene to GPU if (tp_tasks_ref == null) { Loading Loading @@ -3357,6 +3483,7 @@ public class Interscene { // boolean dbg_images = false; double [][] eigen_masked = clt_parameters.imp.eig_xy_lma? null : eigen; String dbg_prefix = dbg_images? (first_QuadClt.getImageName()+"-"+scene_QuadClt.getImageName()+"-NLMA_"+nlma) : null; final boolean same_weights = false; intersceneLma.prepareLMA( scene_xyzatr0, // final double [] scene_xyzatr0, // camera center in world coordinates (or null to use instance) scene_xyzatr_pull, // final double [] scene_xyz_pull, // if both are not null, specify target values to pull to Loading @@ -3371,6 +3498,7 @@ public class Interscene { eigen_masked, // final double [][] eigen, // [tilesX*tilesY]{lamb0_x,lamb0_y, lamb0, lamb1} eigenvector0[x,y],lam0,lam1 coord_motion[1], // final double [][] vector_XYS, // optical flow X,Y, confidence obtained from the correlate2DIterate() coord_motion[0], // final double [][] centers, // macrotile centers (in pixels and average disparities same_weights, // final boolean same_weights, (nlma == 0), // boolean first_run, dbg_prefix, // String dbg_prefix, // null or image name prefix clt_parameters.imp.debug_level); // final int debug_level) Loading Loading @@ -3838,7 +3966,8 @@ public class Interscene { boolean mov_en = clt_parameters.imp.mov_en; // true; // enable detection/removal of the moving objects during pose matching boolean mov_debug_images = clt_parameters.imp.showMovementDetection(imp_debug_level); int mov_debug_level = clt_parameters.imp.movDebugLevel(imp_debug_level); // if (dbg_prefix != null) { // } boolean fpn_remove = !fpn_disable && clt_parameters.imp.fpn_remove; double fpn_max_offset = clt_parameters.imp.fpn_max_offset; final double fpn_min_offset = clt_parameters.imp.fpn_min_offset; Loading