Loading src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java +16 −1 Original line number Original line Diff line number Diff line Loading @@ -1545,7 +1545,22 @@ public class ImageDtt extends ImageDttCPU { } } /** * Converts pairs of images for MB correction, keeping results in transform domain. Works with selected * main or reference buffers. * @param erase_clt erase CLT data. Only needed before execImcltRbgAll() if not all the * tiles are converted. <0 - do not erase, 0 - erase to 0, 1 - erase to NaN * @param wh null (use sensor dimensions) or pair {width, height} in pixels * @param imgdtt_params now just extra correlation parameters, later will include, most others * @param use_reference_buffer true for reference buffer, false for the main one * @param tp_tasks a pair of TpTask arrays: [0] - main image, [1] shifted to subtract motion blur * @param gpu_sigma_r LPF sigma for red * @param gpu_sigma_b LPF sigma for blue * @param gpu_sigma_g LPF sigma for green * @param gpu_sigma_m LPF sigma for monochrome (LWIR) * @param threadsMax maximal number of threads to launch * @param globalDebugLevel debug level */ public void setReferenceTDMotionBlur( // updates tasks public void setReferenceTDMotionBlur( // updates tasks final int erase_clt, final int erase_clt, final int [] wh, // null (use sensor dimensions) or pair {width, height} in pixels final int [] wh, // null (use sensor dimensions) or pair {width, height} in pixels Loading src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java +6 −14 Original line number Original line Diff line number Diff line Loading @@ -2958,7 +2958,7 @@ public class OpticalFlow { final double [] scene_xyz, // camera center in world (reference) coordinates final double [] scene_xyz, // camera center in world (reference) coordinates final double [] scene_atr, // camera orientation relative to world (reference) frame final double [] scene_atr, // camera orientation relative to world (reference) frame final QuadCLT reference_QuadClt, final QuadCLT reference_QuadClt, final QuadCLT scene_QuadClt) // final QuadCLT scene_QuadClt) { { boolean debug_ers = false; // true; // false; // true; // true; //11.01.2022 boolean debug_ers = false; // true; // false; // true; // true; //11.01.2022 boolean ignore_ers = false; // false; boolean ignore_ers = false; // false; Loading Loading @@ -2995,6 +2995,7 @@ public class OpticalFlow { disparity = 1.0* disparity; // 0.0; disparity = 1.0* disparity; // 0.0; } } pXpYD[nTile] = ersReferenceCorrection.getImageCoordinatesERS( // ersCorrection - reference pXpYD[nTile] = ersReferenceCorrection.getImageCoordinatesERS( // ersCorrection - reference // important to have scene, not reference here! scene_QuadClt, // scene_QuadClt, // QuadCLT cameraQuadCLT, // camera station that got image to be to be matched scene_QuadClt, // scene_QuadClt, // QuadCLT cameraQuadCLT, // camera station that got image to be to be matched centerX, // double px, // pixel coordinate X in the reference view centerX, // double px, // pixel coordinate X in the reference view centerY, // double py, // pixel coordinate Y in the reference view centerY, // double py, // pixel coordinate Y in the reference view Loading Loading @@ -3026,7 +3027,6 @@ public class OpticalFlow { public static double [][] transformFromVirtual( public static double [][] transformFromVirtual( double [][] ref_pXpYD_0, double [] disparity_ref, double [] disparity_ref, final double [] scene_xyz, // camera center in world (reference) coordinates final double [] scene_xyz, // camera center in world (reference) coordinates final double [] scene_atr, // camera orientation relative to world (reference) frame final double [] scene_atr, // camera orientation relative to world (reference) frame Loading Loading @@ -3058,8 +3058,7 @@ public class OpticalFlow { for (int i = 0; i <= num_refines; i++) { for (int i = 0; i <= num_refines; i++) { debug_titles[i]=i+""; debug_titles[i]=i+""; } } // final double [][][] debug_data = debug ? new double [3][num_refines+1][tiles]:null; final double [][][] debug_data = debug ? new double [3][num_refines+1][tiles]:null; final double [][][] debug_data = debug ? new double [3][num_refines+2][tiles]:null; if (debug) { if (debug) { for (int f = 0; f < debug_data.length; f++) { for (int f = 0; f < debug_data.length; f++) { for (int i = 0; i < debug_data[f].length; i++) { for (int i = 0; i < debug_data[f].length; i++) { Loading Loading @@ -3239,12 +3238,6 @@ public class OpticalFlow { } } } } if (debug) { if (debug) { for (int nTile = 0; nTile < tiles; nTile++) if (reference_pXpYD[nTile] != null) { debug_data[0][num_refines+1][nTile] = ref_pXpYD_0[nTile][0]; debug_data[1][num_refines+1][nTile] = ref_pXpYD_0[nTile][1]; debug_data[2][num_refines+1][nTile] = ref_pXpYD_0[nTile][2]; } ShowDoubleFloatArrays.showArraysHyperstack( ShowDoubleFloatArrays.showArraysHyperstack( debug_data, // double[][][] pixels, debug_data, // double[][][] pixels, tilesX, // int width, tilesX, // int width, Loading Loading @@ -7866,6 +7859,7 @@ public class OpticalFlow { double [][] ref_pXpYD; double [][] ref_pXpYD; double [][] ref_pXpYD_or_null = null; // debugging cuas mode keeping old double [][] ref_pXpYD_or_null = null; // debugging cuas mode keeping old if (mode_cuas) { // && (dbg_scene > 0)) { if (mode_cuas) { // && (dbg_scene > 0)) { /* double [][] ref_pXpYD_0 = transformToScenePxPyD( // now should work with offset ref_scene double [][] ref_pXpYD_0 = transformToScenePxPyD( // now should work with offset ref_scene fov_tiles, // final Rectangle [] extra_woi, // show larger than sensor WOI (or null) fov_tiles, // final Rectangle [] extra_woi, // show larger than sensor WOI (or null) ref_disparity, // final double [] disparity_ref, // invalid tiles - NaN in disparity ref_disparity, // final double [] disparity_ref, // invalid tiles - NaN in disparity Loading @@ -7874,13 +7868,12 @@ public class OpticalFlow { quadCLTs[ref_index], // final QuadCLT scene_QuadClt, quadCLTs[ref_index], // final QuadCLT scene_QuadClt, quadCLTs[ref_index], // final QuadCLT reference_QuadClt, // now - may be null - for testing if scene is rotated ref quadCLTs[ref_index], // final QuadCLT reference_QuadClt, // now - may be null - for testing if scene is rotated ref threadsMax); // int threadsMax) threadsMax); // int threadsMax) */ int around = 2; int around = 2; double around_sigma = 4.0; double around_sigma = 4.0; int num_virtual_refines = 3; int num_virtual_refines = 2; String debugSuffix= null; // "virtual"; String debugSuffix= null; // "virtual"; ref_pXpYD= transformFromVirtual( ref_pXpYD= transformFromVirtual( ref_pXpYD_0, // double [][] ref_pXpYD_0, ref_disparity, // double [] disparity_ref, ref_disparity, // double [] disparity_ref, stereo_xyz, // final double [] scene_xyz, // camera center in world (reference) coordinates stereo_xyz, // final double [] scene_xyz, // camera center in world (reference) coordinates stereo_atr, // final double [] scene_atr, // camera orientation relative to world (reference) frame stereo_atr, // final double [] scene_atr, // camera orientation relative to world (reference) frame Loading @@ -7901,7 +7894,6 @@ public class OpticalFlow { quadCLTs[ref_index], // final QuadCLT scene_QuadClt, quadCLTs[ref_index], // final QuadCLT scene_QuadClt, quadCLTs[ref_index], // final QuadCLT reference_QuadClt, // now - may be null - for testing if scene is rotated ref quadCLTs[ref_index], // final QuadCLT reference_QuadClt, // now - may be null - for testing if scene is rotated ref threadsMax); // int threadsMax) threadsMax); // int threadsMax) // ref_pXpYD_or_null = ref_pXpYD; // remove after debug!. Yes, that spoils! } } for (int nscene = 0; nscene < quadCLTs.length ; nscene++) if (quadCLTs[nscene] != null){ for (int nscene = 0; nscene < quadCLTs.length ; nscene++) if (quadCLTs[nscene] != null){ if (nscene== dbg_scene) { if (nscene== dbg_scene) { Loading Loading
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java +16 −1 Original line number Original line Diff line number Diff line Loading @@ -1545,7 +1545,22 @@ public class ImageDtt extends ImageDttCPU { } } /** * Converts pairs of images for MB correction, keeping results in transform domain. Works with selected * main or reference buffers. * @param erase_clt erase CLT data. Only needed before execImcltRbgAll() if not all the * tiles are converted. <0 - do not erase, 0 - erase to 0, 1 - erase to NaN * @param wh null (use sensor dimensions) or pair {width, height} in pixels * @param imgdtt_params now just extra correlation parameters, later will include, most others * @param use_reference_buffer true for reference buffer, false for the main one * @param tp_tasks a pair of TpTask arrays: [0] - main image, [1] shifted to subtract motion blur * @param gpu_sigma_r LPF sigma for red * @param gpu_sigma_b LPF sigma for blue * @param gpu_sigma_g LPF sigma for green * @param gpu_sigma_m LPF sigma for monochrome (LWIR) * @param threadsMax maximal number of threads to launch * @param globalDebugLevel debug level */ public void setReferenceTDMotionBlur( // updates tasks public void setReferenceTDMotionBlur( // updates tasks final int erase_clt, final int erase_clt, final int [] wh, // null (use sensor dimensions) or pair {width, height} in pixels final int [] wh, // null (use sensor dimensions) or pair {width, height} in pixels Loading
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java +6 −14 Original line number Original line Diff line number Diff line Loading @@ -2958,7 +2958,7 @@ public class OpticalFlow { final double [] scene_xyz, // camera center in world (reference) coordinates final double [] scene_xyz, // camera center in world (reference) coordinates final double [] scene_atr, // camera orientation relative to world (reference) frame final double [] scene_atr, // camera orientation relative to world (reference) frame final QuadCLT reference_QuadClt, final QuadCLT reference_QuadClt, final QuadCLT scene_QuadClt) // final QuadCLT scene_QuadClt) { { boolean debug_ers = false; // true; // false; // true; // true; //11.01.2022 boolean debug_ers = false; // true; // false; // true; // true; //11.01.2022 boolean ignore_ers = false; // false; boolean ignore_ers = false; // false; Loading Loading @@ -2995,6 +2995,7 @@ public class OpticalFlow { disparity = 1.0* disparity; // 0.0; disparity = 1.0* disparity; // 0.0; } } pXpYD[nTile] = ersReferenceCorrection.getImageCoordinatesERS( // ersCorrection - reference pXpYD[nTile] = ersReferenceCorrection.getImageCoordinatesERS( // ersCorrection - reference // important to have scene, not reference here! scene_QuadClt, // scene_QuadClt, // QuadCLT cameraQuadCLT, // camera station that got image to be to be matched scene_QuadClt, // scene_QuadClt, // QuadCLT cameraQuadCLT, // camera station that got image to be to be matched centerX, // double px, // pixel coordinate X in the reference view centerX, // double px, // pixel coordinate X in the reference view centerY, // double py, // pixel coordinate Y in the reference view centerY, // double py, // pixel coordinate Y in the reference view Loading Loading @@ -3026,7 +3027,6 @@ public class OpticalFlow { public static double [][] transformFromVirtual( public static double [][] transformFromVirtual( double [][] ref_pXpYD_0, double [] disparity_ref, double [] disparity_ref, final double [] scene_xyz, // camera center in world (reference) coordinates final double [] scene_xyz, // camera center in world (reference) coordinates final double [] scene_atr, // camera orientation relative to world (reference) frame final double [] scene_atr, // camera orientation relative to world (reference) frame Loading Loading @@ -3058,8 +3058,7 @@ public class OpticalFlow { for (int i = 0; i <= num_refines; i++) { for (int i = 0; i <= num_refines; i++) { debug_titles[i]=i+""; debug_titles[i]=i+""; } } // final double [][][] debug_data = debug ? new double [3][num_refines+1][tiles]:null; final double [][][] debug_data = debug ? new double [3][num_refines+1][tiles]:null; final double [][][] debug_data = debug ? new double [3][num_refines+2][tiles]:null; if (debug) { if (debug) { for (int f = 0; f < debug_data.length; f++) { for (int f = 0; f < debug_data.length; f++) { for (int i = 0; i < debug_data[f].length; i++) { for (int i = 0; i < debug_data[f].length; i++) { Loading Loading @@ -3239,12 +3238,6 @@ public class OpticalFlow { } } } } if (debug) { if (debug) { for (int nTile = 0; nTile < tiles; nTile++) if (reference_pXpYD[nTile] != null) { debug_data[0][num_refines+1][nTile] = ref_pXpYD_0[nTile][0]; debug_data[1][num_refines+1][nTile] = ref_pXpYD_0[nTile][1]; debug_data[2][num_refines+1][nTile] = ref_pXpYD_0[nTile][2]; } ShowDoubleFloatArrays.showArraysHyperstack( ShowDoubleFloatArrays.showArraysHyperstack( debug_data, // double[][][] pixels, debug_data, // double[][][] pixels, tilesX, // int width, tilesX, // int width, Loading Loading @@ -7866,6 +7859,7 @@ public class OpticalFlow { double [][] ref_pXpYD; double [][] ref_pXpYD; double [][] ref_pXpYD_or_null = null; // debugging cuas mode keeping old double [][] ref_pXpYD_or_null = null; // debugging cuas mode keeping old if (mode_cuas) { // && (dbg_scene > 0)) { if (mode_cuas) { // && (dbg_scene > 0)) { /* double [][] ref_pXpYD_0 = transformToScenePxPyD( // now should work with offset ref_scene double [][] ref_pXpYD_0 = transformToScenePxPyD( // now should work with offset ref_scene fov_tiles, // final Rectangle [] extra_woi, // show larger than sensor WOI (or null) fov_tiles, // final Rectangle [] extra_woi, // show larger than sensor WOI (or null) ref_disparity, // final double [] disparity_ref, // invalid tiles - NaN in disparity ref_disparity, // final double [] disparity_ref, // invalid tiles - NaN in disparity Loading @@ -7874,13 +7868,12 @@ public class OpticalFlow { quadCLTs[ref_index], // final QuadCLT scene_QuadClt, quadCLTs[ref_index], // final QuadCLT scene_QuadClt, quadCLTs[ref_index], // final QuadCLT reference_QuadClt, // now - may be null - for testing if scene is rotated ref quadCLTs[ref_index], // final QuadCLT reference_QuadClt, // now - may be null - for testing if scene is rotated ref threadsMax); // int threadsMax) threadsMax); // int threadsMax) */ int around = 2; int around = 2; double around_sigma = 4.0; double around_sigma = 4.0; int num_virtual_refines = 3; int num_virtual_refines = 2; String debugSuffix= null; // "virtual"; String debugSuffix= null; // "virtual"; ref_pXpYD= transformFromVirtual( ref_pXpYD= transformFromVirtual( ref_pXpYD_0, // double [][] ref_pXpYD_0, ref_disparity, // double [] disparity_ref, ref_disparity, // double [] disparity_ref, stereo_xyz, // final double [] scene_xyz, // camera center in world (reference) coordinates stereo_xyz, // final double [] scene_xyz, // camera center in world (reference) coordinates stereo_atr, // final double [] scene_atr, // camera orientation relative to world (reference) frame stereo_atr, // final double [] scene_atr, // camera orientation relative to world (reference) frame Loading @@ -7901,7 +7894,6 @@ public class OpticalFlow { quadCLTs[ref_index], // final QuadCLT scene_QuadClt, quadCLTs[ref_index], // final QuadCLT scene_QuadClt, quadCLTs[ref_index], // final QuadCLT reference_QuadClt, // now - may be null - for testing if scene is rotated ref quadCLTs[ref_index], // final QuadCLT reference_QuadClt, // now - may be null - for testing if scene is rotated ref threadsMax); // int threadsMax) threadsMax); // int threadsMax) // ref_pXpYD_or_null = ref_pXpYD; // remove after debug!. Yes, that spoils! } } for (int nscene = 0; nscene < quadCLTs.length ; nscene++) if (quadCLTs[nscene] != null){ for (int nscene = 0; nscene < quadCLTs.length ; nscene++) if (quadCLTs[nscene] != null){ if (nscene== dbg_scene) { if (nscene== dbg_scene) { Loading