Loading src/main/java/com/elphel/imagej/tileprocessor/Interscene.java +74 −24 Original line number Original line Diff line number Diff line Loading @@ -162,9 +162,52 @@ public class Interscene { // Index is easier, no need to change // Index is easier, no need to change // QuadCLT[] quadCLTs_half = new QuadCLT[(quadCLTs.length+1)/2]; // QuadCLT[] quadCLTs_half = new QuadCLT[(quadCLTs.length+1)/2]; // QuadCLT.SetChannels [] set_channels_half; // QuadCLT.SetChannels [] set_channels_half; // consider if it is using initial DSI from previous in overlap mode boolean overlap_sequences = clt_parameters.imp.overlap_sequences; int [] start_ref_pointers1 = new int[2]; int [] start_ref_pointers1 = new int[2]; // try to read previously adjusted half-range ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection(); int cent_index = earliest_scene + (ref_index - earliest_scene) / 2; int cent_index = earliest_scene + (ref_index - earliest_scene) / 2; int min_num_scenes_half = min_num_scenes / 2; int min_num_scenes_half = min_num_scenes / 2; boolean reused_overlap = false; if (overlap_sequences) { int adjusted_scene_index = ref_index - 1; for (; adjusted_scene_index >= 0 ; adjusted_scene_index--) { // to include ref scene photometric calibration quadCLTs[adjusted_scene_index] = quadCLTs[ref_index].spawnNoModelQuadCLT( set_channels[adjusted_scene_index].set_name, clt_parameters, colorProcParameters, // threadsMax, debugLevel-2); String ts = quadCLTs[adjusted_scene_index].getImageName(); if (ts == null) { break; } if (adjusted_scene_index < (min_num_scenes_half-1)) { if (debugLevel > -3) { System.out.println("Overlap mode, too few scenes left for the second half, shortening first to "+ (ref_index - adjusted_scene_index - 1)); } break; } } // split cycles to remove output clutter adjusted_scene_index++; if ((ref_index - adjusted_scene_index) >= min_num_scenes_half) { if (debugLevel > -3) { System.out.println("Overlap mode, reusing previous scenes adjustment scenes, number of scenes = "+ (ref_index - adjusted_scene_index)); } cent_index = adjusted_scene_index; reused_overlap = true; } else { if (debugLevel > -3) { System.out.println("Overlap mode, too few scenes to reuse: "+ (ref_index - adjusted_scene_index)+" < "+ min_num_scenes_half); } } } if (!reused_overlap) { // TODO: add ref scene itself to the list? // TODO: add ref scene itself to the list? cent_index = setInitialOrientationsIms( cent_index = setInitialOrientationsIms( clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters, Loading @@ -184,10 +227,12 @@ public class Interscene { start_ref_pointers[0] = start_ref_pointers1[0]; start_ref_pointers[0] = start_ref_pointers1[0]; return cent_index; return cent_index; } } } // create new dsi for quadCLTs[earliest_scene1] // create new dsi for quadCLTs[earliest_scene1] OpticalFlow.buildRefDSI( // returned is a different instance than input -FIXED OpticalFlow.buildRefDSI( // returned is a different instance than input -FIXED clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters, false, // boolean fast, false, // boolean fast, true, // boolean skip_photo, debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters, debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters, colorProcParameters, // ColorProcParameters colorProcParameters, colorProcParameters, // ColorProcParameters colorProcParameters, rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters, rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters, Loading Loading @@ -237,11 +282,12 @@ public class Interscene { } } // invert first half, reference to the cent_index, add to cent_index map, generate ref_index ponter and cent_index, // invert first half, reference to the cent_index, add to cent_index map, generate ref_index ponter and cent_index, // write config for both ref_index and cent_index scenes // write config for both ref_index and cent_index scenes ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection(); // ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection(); ErsCorrection ers_center = quadCLTs[cent_index].getErsCorrection(); ErsCorrection ers_center = quadCLTs[cent_index].getErsCorrection(); String cent_ts = quadCLTs[cent_index].getImageName(); String cent_ts = quadCLTs[cent_index].getImageName(); double [][] center_xyzatr = new double [][] {ers_reference.getSceneXYZ(cent_ts), ers_reference.getSceneATR(cent_ts)}; double [][] center_xyzatr = new double [][] {ers_reference.getSceneXYZ(cent_ts), ers_reference.getSceneATR(cent_ts)}; double [][] inv_cent_xyzatr = ErsCorrection.invertXYZATR(center_xyzatr); double [][] inv_cent_xyzatr = ErsCorrection.invertXYZATR(center_xyzatr); // Invert half-sequence to reference cent_index for (int scene_index = cent_index; scene_index <= ref_index; scene_index++) { // include cent_index itself to the map for (int scene_index = cent_index; scene_index <= ref_index; scene_index++) { // include cent_index itself to the map double [][] scene_xyzatr,dxyzatr_dt; double [][] scene_xyzatr,dxyzatr_dt; if (scene_index == ref_index) { if (scene_index == ref_index) { Loading @@ -259,13 +305,17 @@ public class Interscene { ); ); } } // set pointers // set pointers quadCLTs[ref_index].setRefPointer(cent_ts); quadCLTs[ref_index].setRefPointer(cent_ts); // write pointer to center scene to reference scene quadCLTs[cent_index].setFirstLastPointers(quadCLTs[earliest_scene2],quadCLTs[ref_index]); quadCLTs[cent_index].setFirstLastPointers(quadCLTs[earliest_scene2],quadCLTs[ref_index]);// set first/last to center scene quadCLTs[ref_index].set_orient(1); // first orientation // applicable to the center? // set quadCLTs[ref_index].set_orient(0); // ? as it has only half? quadCLTs[ref_index].set_accum(0); // reset accumulations ("build_interscene") number // quadCLTs[ref_index].set_orient(1); // first orientation // applicable to the center? // quadCLTs[ref_index].set_accum(0); // reset accumulations ("build_interscene") number quadCLTs[ref_index].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer quadCLTs[ref_index].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer null, // String path, // full name with extension or w/o path to use x3d directory null, // String path, // full name with extension or w/o path to use x3d directory debugLevel+1); debugLevel+1); quadCLTs[cent_index].set_orient(1); // first orientation quadCLTs[cent_index].set_orient(1); // first orientation quadCLTs[cent_index].set_accum(0); // reset accumulations ("build_interscene") number quadCLTs[cent_index].set_accum(0); // reset accumulations ("build_interscene") number quadCLTs[cent_index].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer quadCLTs[cent_index].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer Loading src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -78,6 +78,7 @@ public class IntersceneMatchParameters { ims_mount_atr[2] * Math.PI/180}; ims_mount_atr[2] * Math.PI/180}; } } public boolean center_reference = false; public boolean center_reference = false; public boolean overlap_sequences = false; // overlap sequences: scan down from the previous center public boolean reset_photometric = true; // reset photometric calibration - once for each new series public boolean reset_photometric = true; // reset photometric calibration - once for each new series public boolean force_ref_dsi = false; // true; public boolean force_ref_dsi = false; // true; public boolean force_orientations = false; public boolean force_orientations = false; Loading Loading @@ -527,6 +528,8 @@ public class IntersceneMatchParameters { gd.addCheckbox ("Use center scene as a reference", this.center_reference, gd.addCheckbox ("Use center scene as a reference", this.center_reference, "True for mapping with post-processing. If false, use the last scene as a reference (driving)."); "True for mapping with post-processing. If false, use the last scene as a reference (driving)."); gd.addCheckbox ("Overlap sequences", this.overlap_sequences, "Overlap sequences by half - start (down) from the previous center."); gd.addCheckbox ("Reset photometric calibration", this.reset_photometric, gd.addCheckbox ("Reset photometric calibration", this.reset_photometric, "Reset photometric calibration, will use basic one before re-calibrating."); "Reset photometric calibration, will use basic one before re-calibrating."); gd.addCheckbox ("Force reference scene DSI calculation", this.force_ref_dsi, gd.addCheckbox ("Force reference scene DSI calculation", this.force_ref_dsi, Loading Loading @@ -1228,6 +1231,7 @@ public class IntersceneMatchParameters { this.sfm_extrapolate = gd.getNextBoolean(); this.sfm_extrapolate = gd.getNextBoolean(); this.center_reference = gd.getNextBoolean(); this.center_reference = gd.getNextBoolean(); this.overlap_sequences = gd.getNextBoolean(); this.reset_photometric = gd.getNextBoolean(); this.reset_photometric = gd.getNextBoolean(); this.force_ref_dsi = gd.getNextBoolean(); this.force_ref_dsi = gd.getNextBoolean(); this.force_orientations = gd.getNextBoolean(); this.force_orientations = gd.getNextBoolean(); Loading Loading @@ -1612,6 +1616,7 @@ public class IntersceneMatchParameters { properties.setProperty(prefix+"sfm_extrapolate", this.sfm_extrapolate + ""); // boolean properties.setProperty(prefix+"sfm_extrapolate", this.sfm_extrapolate + ""); // boolean properties.setProperty(prefix+"center_reference", this.center_reference + ""); // boolean properties.setProperty(prefix+"center_reference", this.center_reference + ""); // boolean properties.setProperty(prefix+"overlap_sequences", this.overlap_sequences + ""); // boolean properties.setProperty(prefix+"reset_photometric", this.reset_photometric + ""); // boolean properties.setProperty(prefix+"reset_photometric", this.reset_photometric + ""); // boolean properties.setProperty(prefix+"force_ref_dsi", this.force_ref_dsi + ""); // boolean properties.setProperty(prefix+"force_ref_dsi", this.force_ref_dsi + ""); // boolean properties.setProperty(prefix+"force_orientations", this.force_orientations + ""); // boolean properties.setProperty(prefix+"force_orientations", this.force_orientations + ""); // boolean Loading Loading @@ -1956,6 +1961,7 @@ public class IntersceneMatchParameters { if (properties.getProperty(prefix+"sfm_extrapolate")!=null) this.sfm_extrapolate=Boolean.parseBoolean(properties.getProperty(prefix+"sfm_extrapolate")); if (properties.getProperty(prefix+"sfm_extrapolate")!=null) this.sfm_extrapolate=Boolean.parseBoolean(properties.getProperty(prefix+"sfm_extrapolate")); if (properties.getProperty(prefix+"center_reference")!=null) this.center_reference=Boolean.parseBoolean(properties.getProperty(prefix+"center_reference")); if (properties.getProperty(prefix+"center_reference")!=null) this.center_reference=Boolean.parseBoolean(properties.getProperty(prefix+"center_reference")); if (properties.getProperty(prefix+"overlap_sequences")!=null) this.overlap_sequences=Boolean.parseBoolean(properties.getProperty(prefix+"overlap_sequences")); if (properties.getProperty(prefix+"reset_photometric")!=null) this.reset_photometric=Boolean.parseBoolean(properties.getProperty(prefix+"reset_photometric")); if (properties.getProperty(prefix+"reset_photometric")!=null) this.reset_photometric=Boolean.parseBoolean(properties.getProperty(prefix+"reset_photometric")); if (properties.getProperty(prefix+"force_ref_dsi")!=null) this.force_ref_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"force_ref_dsi")); if (properties.getProperty(prefix+"force_ref_dsi")!=null) this.force_ref_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"force_ref_dsi")); if (properties.getProperty(prefix+"force_orientations")!=null) this.force_orientations=Boolean.parseBoolean(properties.getProperty(prefix+"force_orientations")); if (properties.getProperty(prefix+"force_orientations")!=null) this.force_orientations=Boolean.parseBoolean(properties.getProperty(prefix+"force_orientations")); Loading Loading @@ -2327,6 +2333,7 @@ public class IntersceneMatchParameters { imp.sfm_extrapolate = this.sfm_extrapolate; imp.sfm_extrapolate = this.sfm_extrapolate; imp.center_reference = this.center_reference; imp.center_reference = this.center_reference; imp.overlap_sequences = this.overlap_sequences; imp.reset_photometric = this.reset_photometric; imp.reset_photometric = this.reset_photometric; imp.force_ref_dsi = this.force_ref_dsi; imp.force_ref_dsi = this.force_ref_dsi; imp.force_orientations = this.force_orientations; imp.force_orientations = this.force_orientations; Loading src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java +35 −13 Original line number Original line Diff line number Diff line Loading @@ -3966,6 +3966,7 @@ public class OpticalFlow { public static void buildRefDSI( public static void buildRefDSI( CLTParameters clt_parameters, CLTParameters clt_parameters, boolean fast, boolean fast, boolean skip_photo, EyesisCorrectionParameters.DebayerParameters debayerParameters, EyesisCorrectionParameters.DebayerParameters debayerParameters, ColorProcParameters colorProcParameters, ColorProcParameters colorProcParameters, EyesisCorrectionParameters.RGBParameters rgbParameters, EyesisCorrectionParameters.RGBParameters rgbParameters, Loading Loading @@ -4109,7 +4110,7 @@ public class OpticalFlow { boolean ran_photo_each = false; boolean ran_photo_each = false; quadCLT_ref.tp.resetCLTPasses(); quadCLT_ref.tp.resetCLTPasses(); // perform photometric here, after first DSI // perform photometric here, after first DSI if (photo_each && (!quadCLT_ref.isPhotometricThis() || !batch_mode)) { if (!skip_photo && (photo_each && (!quadCLT_ref.isPhotometricThis() || !batch_mode))) { // if (debugLevel > -3) { // if (debugLevel > -3) { // System.out.println("**** Running photometric equalization for "+quadCLT_ref.getImageName()+ // System.out.println("**** Running photometric equalization for "+quadCLT_ref.getImageName()+ // ", current was from scene "+quadCLT_ref.getPhotometricScene()+" ****"); // ", current was from scene "+quadCLT_ref.getPhotometricScene()+" ****"); Loading Loading @@ -4240,13 +4241,12 @@ public class OpticalFlow { quadCLT_ref.saveDSIAll ( quadCLT_ref.saveDSIAll ( "-DSI_MAIN", // String suffix, // "-DSI_MAIN" "-DSI_MAIN", // String suffix, // "-DSI_MAIN" dsi); dsi); quadCLT_ref.set_orient(0); // reset orientations quadCLT_ref.set_accum(0); // reset accumulations ("build_interscene") number quadCLT_ref.saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) quadCLT_ref.saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) null, // String path, // full name with extension or w/o path to use x3d directory null, // String path, // full name with extension or w/o path to use x3d directory // null, // Properties properties, // if null - will only save extrinsics) // null, // Properties properties, // if null - will only save extrinsics) debugLevel); debugLevel); quadCLT_ref.set_orient(0); // reset orientations quadCLT_ref.set_accum(0); // reset accumulations ("build_interscene") number } } public static void reuseRefDSI( public static void reuseRefDSI( Loading Loading @@ -4760,6 +4760,7 @@ public class OpticalFlow { scenes_xyzatr[last_index] = new double[2][3]; // all zeros scenes_xyzatr[last_index] = new double[2][3]; // all zeros // See if build_ref_dsi is needed // See if build_ref_dsi is needed if (!build_ref_dsi) { if (!build_ref_dsi) { // try reading full quadCLTs[last_index] = (QuadCLT) quadCLT_main.spawnNoModelQuadCLT( // will conditionImageSet quadCLTs[last_index] = (QuadCLT) quadCLT_main.spawnNoModelQuadCLT( // will conditionImageSet set_channels[last_index].set_name, set_channels[last_index].set_name, clt_parameters, clt_parameters, Loading @@ -4771,10 +4772,24 @@ public class OpticalFlow { null, // String path, // full name with extension or null to use x3d directory null, // String path, // full name with extension or null to use x3d directory false, // boolean all_properties,// null, // Properties properties, // if null - will only save extrinsics) false, // boolean all_properties,// null, // Properties properties, // if null - will only save extrinsics) debugLevel); debugLevel); int center_index =quadCLTs[last_index].getReferenceIndex(null); int center_index =quadCLTs[last_index].getReferenceIndex(new QuadCLT[] {quadCLTs[last_index]}); // null); self, may return 0 if (center_index == -1) { int [] first_last_index = quadCLTs[last_index].getFirstLastIndex(new QuadCLT[] {quadCLTs[last_index]}); if ((center_index == -1) || (center_index == 0)) { // 0 - was self-referencing, TODO: debug, should not be // -2 - reference somewhere, not to itself // -1 - no reference to a center // 0 - reference // with overlap it may already have *-DSI_MAIN or even *-INTER-INTRA-LMA.tiff // int [] first_last_index = quadCLTs[last_index].getFirstLastIndex(quadCLTs); if (first_last_index == null) { build_ref_dsi = true; build_ref_dsi = true; } else { } else { // should have DSI if (debugLevel >-2) { System.out.println("no link to center, but this seems to be other's center "+quadCLTs[last_index].getReferenceTimestamp()+ ", forcing initial orientation."); } force_initial_orientations = true; } } else { // -2 - reference somewhere, not to itself QuadCLT try_ref_scene = (QuadCLT) quadCLT_main.spawnQuadCLT( // will conditionImageSet QuadCLT try_ref_scene = (QuadCLT) quadCLT_main.spawnQuadCLT( // will conditionImageSet quadCLTs[last_index].getReferenceTimestamp(), // set_channels[last_index].set_name, quadCLTs[last_index].getReferenceTimestamp(), // set_channels[last_index].set_name, clt_parameters, clt_parameters, Loading @@ -4785,6 +4800,7 @@ public class OpticalFlow { if (debugLevel >-2) { if (debugLevel >-2) { System.out.println("DSI data for scene "+quadCLTs[last_index].getReferenceTimestamp()+ System.out.println("DSI data for scene "+quadCLTs[last_index].getReferenceTimestamp()+ " does not exist, forcing initial orientation."); " does not exist, forcing initial orientation."); // consider copyJP4src for the lower half (now it is not needed) } } force_initial_orientations = true; force_initial_orientations = true; } } Loading Loading @@ -4848,6 +4864,7 @@ public class OpticalFlow { buildRefDSI( // returned is a different instance than input -FIXED buildRefDSI( // returned is a different instance than input -FIXED clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters, fast, // boolean fast, fast, // boolean fast, false, // boolean skip_photo, debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters, debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters, colorProcParameters, // ColorProcParameters colorProcParameters, colorProcParameters, // ColorProcParameters colorProcParameters, rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters, rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters, Loading Loading @@ -4884,7 +4901,7 @@ public class OpticalFlow { updateStatus, // final boolean updateStatus, updateStatus, // final boolean updateStatus, debugLevel); // int debugLevel) debugLevel); // int debugLevel) if (center_reference) { if (center_reference) { // center_ts = getReferenceTimestamp(); // center_ts = getReferenceTimestamp(); //?? } } } } } // while (blue_sky == null) } // while (blue_sky == null) Loading Loading @@ -5054,7 +5071,11 @@ public class OpticalFlow { int [] first_last_index = quadCLTs[ref_index].getFirstLastIndex(quadCLTs); int [] first_last_index = quadCLTs[ref_index].getFirstLastIndex(quadCLTs); if (first_last_index == null) { if (first_last_index == null) { System.out.println("BUG: saved reference scene "+quadCLTs[ref_index].getImageName()+ System.out.println("BUG: saved reference scene "+quadCLTs[ref_index].getImageName()+ " does not have first/last scenes defined"); " is not really a reference"); System.out.println(); } else if ((first_last_index [0] < 0) || (first_last_index [1] < 0)) { System.out.println("BUG: saved reference scene "+quadCLTs[ref_index].getImageName()+ " does not have both first/last scenes defined: ["+first_last_index [0]+", "+first_last_index [1]+"]"); System.out.println(); System.out.println(); } else { } else { earliest_scene = first_last_index[0]; earliest_scene = first_last_index[0]; Loading Loading @@ -5100,17 +5121,18 @@ public class OpticalFlow { // num_avg_pairs = last_index - ref_index; // num_avg_pairs = last_index - ref_index; // } // } QuadCLT[][][] scenes_seq_pairs = new QuadCLT[3][num_avg_pairs][2]; QuadCLT[][][] scenes_seq_pairs = new QuadCLT[3][num_avg_pairs][2]; int ref_index_mod1 = Math.max(ref_index, earliest_scene + num_avg_pairs - 1); int ref_index_mod2 = Math.min(ref_index, last_index); // TODO: calculate horizontal offset and compare with sfm_min_base // TODO: calculate horizontal offset and compare with sfm_min_base for (int i = 0; i < num_avg_pairs; i++) { for (int i = 0; i < num_avg_pairs; i++) { // scenes_seq_pairs[0][i][0] = quadCLTs[ref_index + num_avg_pairs - 1 - i]; scenes_seq_pairs[0][i][0] = quadCLTs[last_index - i]; scenes_seq_pairs[0][i][0] = quadCLTs[last_index - i]; scenes_seq_pairs[0][i][1] = quadCLTs[earliest_scene + num_avg_pairs - 1 - i]; scenes_seq_pairs[0][i][1] = quadCLTs[earliest_scene + num_avg_pairs - 1 - i]; scenes_seq_pairs[1][i][0] = quadCLTs[last_index - i]; scenes_seq_pairs[1][i][0] = quadCLTs[last_index - i]; scenes_seq_pairs[1][i][1] = quadCLTs[ref_index - i]; scenes_seq_pairs[1][i][1] = quadCLTs[ref_index_mod1 - i]; scenes_seq_pairs[2][i][0] = quadCLTs[last_index - i]; scenes_seq_pairs[2][i][0] = quadCLTs[ref_index_mod2 + num_avg_pairs - 1 - i]; scenes_seq_pairs[2][i][1] = quadCLTs[earliest_scene + num_avg_pairs - 1 - i]; scenes_seq_pairs[2][i][1] = quadCLTs[earliest_scene + num_avg_pairs - 1 - i]; } } double [][] sfm_dsn = StructureFromMotion.sfmPairsSet( double [][] sfm_dsn = StructureFromMotion.sfmPairsSet( Loading src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java +27 −24 Original line number Original line Diff line number Diff line Loading @@ -273,7 +273,7 @@ public class QuadCLTCPU { public int getReferenceIndex(QuadCLTCPU [] scenes) { public int getReferenceIndex(QuadCLTCPU [] scenes) { if (timestamp_reference != null) { if (timestamp_reference != null) { if (scenes != null) { if (scenes != null) { for (int i = 0; i < scenes.length; i++) { for (int i = 0; i < scenes.length; i++) if (scenes[i] != null){ if (timestamp_reference.equals(scenes[i].getImageName())) { if (timestamp_reference.equals(scenes[i].getImageName())) { return i; return i; } } Loading @@ -286,33 +286,36 @@ public class QuadCLTCPU { /** /** * If this scene is a reference scene, then return array of {first_index, last_index}. * If this scene is a reference scene, then return array of {first_index, last_index}. * If this scene is not a reference or the array does not contain both the first and * If this scene is not a reference - return null. * the last scene - return null. * @param scenes array of scenes (QuadCLTCPU instances) * @param scenes array of scenes (QuadCLTCPU instances) * @return a pair of {first_index, last_index} * @return a pair of {first_index, last_index} */ */ public int [] getFirstLastIndex(QuadCLTCPU [] scenes) { // should be ordered accending ts public int [] getFirstLastIndex(QuadCLTCPU [] scenes) { // should be ordered accending ts int [] fl = new int [] {-1,-1}; int [] fl = null; if ((timestamp_first != null) && (timestamp_last != null)) { if ((timestamp_first != null) && (timestamp_last != null)) { fl = new int [] {-1,-1}; if (scenes != null) { int i = 0; int i = 0; for (; i < scenes.length; i++) { for (; i < scenes.length; i++) if (scenes[i] != null) { if (timestamp_first.equals(scenes[i].getImageName())) { if (timestamp_first.equals(scenes[i].getImageName())) { fl[0] = i; fl[0] = i; break; break; } } } } for (; i < scenes.length; i++) { for (; i < scenes.length; i++) if (scenes[i] != null) { if (timestamp_last.equals(scenes[i].getImageName())) { if (timestamp_last.equals(scenes[i].getImageName())) { fl[1] = i; fl[1] = i; break; break; } } } } } } if ((fl[0] >= 0) && (fl[1] >= 0)) { return fl; } else { return null; } } return fl; // if ((fl[0] >= 0) && (fl[1] >= 0)) { // return fl; // } else { // return null; // } } } /** /** Loading src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java +3 −6 Original line number Original line Diff line number Diff line Loading @@ -8531,6 +8531,7 @@ if (debugLevel > -100) return true; // temporarily ! final boolean updateStatus, final boolean updateStatus, final int debugLevel) throws Exception final int debugLevel) throws Exception { { boolean overlap_sequences = clt_parameters.imp.overlap_sequences; int stereo_gap = clt_parameters.imp.stereo_gap; int stereo_gap = clt_parameters.imp.stereo_gap; double stereo_intereye = clt_parameters.imp.stereo_intereye; double stereo_intereye = clt_parameters.imp.stereo_intereye; double stereo_phone_width = clt_parameters.imp.stereo_phone_width; // 0 - no padding double stereo_phone_width = clt_parameters.imp.stereo_phone_width; // 0 - no padding Loading Loading @@ -8672,14 +8673,10 @@ if (debugLevel > -100) return true; // temporarily ! if (start_ref_pointers[0] < (min_num_scenes-1)) { if (start_ref_pointers[0] < (min_num_scenes-1)) { break; break; } } ref_index = start_ref_pointers[0]; // continue from the same attached to the previous reference ref_index = start_ref_pointers[overlap_sequences? 1 : 0]; // continue from the same attached to the previous reference } } } } // combine videos if generated // combine videos if generated if ((video_sets_list.size() > 1) && if ((video_sets_list.size() > 1) && (video_sets_list.get(0).getVideoPaths() != null) && (video_sets_list.get(0).getVideoPaths() != null) && Loading Loading
src/main/java/com/elphel/imagej/tileprocessor/Interscene.java +74 −24 Original line number Original line Diff line number Diff line Loading @@ -162,9 +162,52 @@ public class Interscene { // Index is easier, no need to change // Index is easier, no need to change // QuadCLT[] quadCLTs_half = new QuadCLT[(quadCLTs.length+1)/2]; // QuadCLT[] quadCLTs_half = new QuadCLT[(quadCLTs.length+1)/2]; // QuadCLT.SetChannels [] set_channels_half; // QuadCLT.SetChannels [] set_channels_half; // consider if it is using initial DSI from previous in overlap mode boolean overlap_sequences = clt_parameters.imp.overlap_sequences; int [] start_ref_pointers1 = new int[2]; int [] start_ref_pointers1 = new int[2]; // try to read previously adjusted half-range ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection(); int cent_index = earliest_scene + (ref_index - earliest_scene) / 2; int cent_index = earliest_scene + (ref_index - earliest_scene) / 2; int min_num_scenes_half = min_num_scenes / 2; int min_num_scenes_half = min_num_scenes / 2; boolean reused_overlap = false; if (overlap_sequences) { int adjusted_scene_index = ref_index - 1; for (; adjusted_scene_index >= 0 ; adjusted_scene_index--) { // to include ref scene photometric calibration quadCLTs[adjusted_scene_index] = quadCLTs[ref_index].spawnNoModelQuadCLT( set_channels[adjusted_scene_index].set_name, clt_parameters, colorProcParameters, // threadsMax, debugLevel-2); String ts = quadCLTs[adjusted_scene_index].getImageName(); if (ts == null) { break; } if (adjusted_scene_index < (min_num_scenes_half-1)) { if (debugLevel > -3) { System.out.println("Overlap mode, too few scenes left for the second half, shortening first to "+ (ref_index - adjusted_scene_index - 1)); } break; } } // split cycles to remove output clutter adjusted_scene_index++; if ((ref_index - adjusted_scene_index) >= min_num_scenes_half) { if (debugLevel > -3) { System.out.println("Overlap mode, reusing previous scenes adjustment scenes, number of scenes = "+ (ref_index - adjusted_scene_index)); } cent_index = adjusted_scene_index; reused_overlap = true; } else { if (debugLevel > -3) { System.out.println("Overlap mode, too few scenes to reuse: "+ (ref_index - adjusted_scene_index)+" < "+ min_num_scenes_half); } } } if (!reused_overlap) { // TODO: add ref scene itself to the list? // TODO: add ref scene itself to the list? cent_index = setInitialOrientationsIms( cent_index = setInitialOrientationsIms( clt_parameters, // final CLTParameters clt_parameters, clt_parameters, // final CLTParameters clt_parameters, Loading @@ -184,10 +227,12 @@ public class Interscene { start_ref_pointers[0] = start_ref_pointers1[0]; start_ref_pointers[0] = start_ref_pointers1[0]; return cent_index; return cent_index; } } } // create new dsi for quadCLTs[earliest_scene1] // create new dsi for quadCLTs[earliest_scene1] OpticalFlow.buildRefDSI( // returned is a different instance than input -FIXED OpticalFlow.buildRefDSI( // returned is a different instance than input -FIXED clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters, false, // boolean fast, false, // boolean fast, true, // boolean skip_photo, debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters, debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters, colorProcParameters, // ColorProcParameters colorProcParameters, colorProcParameters, // ColorProcParameters colorProcParameters, rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters, rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters, Loading Loading @@ -237,11 +282,12 @@ public class Interscene { } } // invert first half, reference to the cent_index, add to cent_index map, generate ref_index ponter and cent_index, // invert first half, reference to the cent_index, add to cent_index map, generate ref_index ponter and cent_index, // write config for both ref_index and cent_index scenes // write config for both ref_index and cent_index scenes ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection(); // ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection(); ErsCorrection ers_center = quadCLTs[cent_index].getErsCorrection(); ErsCorrection ers_center = quadCLTs[cent_index].getErsCorrection(); String cent_ts = quadCLTs[cent_index].getImageName(); String cent_ts = quadCLTs[cent_index].getImageName(); double [][] center_xyzatr = new double [][] {ers_reference.getSceneXYZ(cent_ts), ers_reference.getSceneATR(cent_ts)}; double [][] center_xyzatr = new double [][] {ers_reference.getSceneXYZ(cent_ts), ers_reference.getSceneATR(cent_ts)}; double [][] inv_cent_xyzatr = ErsCorrection.invertXYZATR(center_xyzatr); double [][] inv_cent_xyzatr = ErsCorrection.invertXYZATR(center_xyzatr); // Invert half-sequence to reference cent_index for (int scene_index = cent_index; scene_index <= ref_index; scene_index++) { // include cent_index itself to the map for (int scene_index = cent_index; scene_index <= ref_index; scene_index++) { // include cent_index itself to the map double [][] scene_xyzatr,dxyzatr_dt; double [][] scene_xyzatr,dxyzatr_dt; if (scene_index == ref_index) { if (scene_index == ref_index) { Loading @@ -259,13 +305,17 @@ public class Interscene { ); ); } } // set pointers // set pointers quadCLTs[ref_index].setRefPointer(cent_ts); quadCLTs[ref_index].setRefPointer(cent_ts); // write pointer to center scene to reference scene quadCLTs[cent_index].setFirstLastPointers(quadCLTs[earliest_scene2],quadCLTs[ref_index]); quadCLTs[cent_index].setFirstLastPointers(quadCLTs[earliest_scene2],quadCLTs[ref_index]);// set first/last to center scene quadCLTs[ref_index].set_orient(1); // first orientation // applicable to the center? // set quadCLTs[ref_index].set_orient(0); // ? as it has only half? quadCLTs[ref_index].set_accum(0); // reset accumulations ("build_interscene") number // quadCLTs[ref_index].set_orient(1); // first orientation // applicable to the center? // quadCLTs[ref_index].set_accum(0); // reset accumulations ("build_interscene") number quadCLTs[ref_index].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer quadCLTs[ref_index].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer null, // String path, // full name with extension or w/o path to use x3d directory null, // String path, // full name with extension or w/o path to use x3d directory debugLevel+1); debugLevel+1); quadCLTs[cent_index].set_orient(1); // first orientation quadCLTs[cent_index].set_orient(1); // first orientation quadCLTs[cent_index].set_accum(0); // reset accumulations ("build_interscene") number quadCLTs[cent_index].set_accum(0); // reset accumulations ("build_interscene") number quadCLTs[cent_index].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer quadCLTs[cent_index].saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) // null pointer Loading
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -78,6 +78,7 @@ public class IntersceneMatchParameters { ims_mount_atr[2] * Math.PI/180}; ims_mount_atr[2] * Math.PI/180}; } } public boolean center_reference = false; public boolean center_reference = false; public boolean overlap_sequences = false; // overlap sequences: scan down from the previous center public boolean reset_photometric = true; // reset photometric calibration - once for each new series public boolean reset_photometric = true; // reset photometric calibration - once for each new series public boolean force_ref_dsi = false; // true; public boolean force_ref_dsi = false; // true; public boolean force_orientations = false; public boolean force_orientations = false; Loading Loading @@ -527,6 +528,8 @@ public class IntersceneMatchParameters { gd.addCheckbox ("Use center scene as a reference", this.center_reference, gd.addCheckbox ("Use center scene as a reference", this.center_reference, "True for mapping with post-processing. If false, use the last scene as a reference (driving)."); "True for mapping with post-processing. If false, use the last scene as a reference (driving)."); gd.addCheckbox ("Overlap sequences", this.overlap_sequences, "Overlap sequences by half - start (down) from the previous center."); gd.addCheckbox ("Reset photometric calibration", this.reset_photometric, gd.addCheckbox ("Reset photometric calibration", this.reset_photometric, "Reset photometric calibration, will use basic one before re-calibrating."); "Reset photometric calibration, will use basic one before re-calibrating."); gd.addCheckbox ("Force reference scene DSI calculation", this.force_ref_dsi, gd.addCheckbox ("Force reference scene DSI calculation", this.force_ref_dsi, Loading Loading @@ -1228,6 +1231,7 @@ public class IntersceneMatchParameters { this.sfm_extrapolate = gd.getNextBoolean(); this.sfm_extrapolate = gd.getNextBoolean(); this.center_reference = gd.getNextBoolean(); this.center_reference = gd.getNextBoolean(); this.overlap_sequences = gd.getNextBoolean(); this.reset_photometric = gd.getNextBoolean(); this.reset_photometric = gd.getNextBoolean(); this.force_ref_dsi = gd.getNextBoolean(); this.force_ref_dsi = gd.getNextBoolean(); this.force_orientations = gd.getNextBoolean(); this.force_orientations = gd.getNextBoolean(); Loading Loading @@ -1612,6 +1616,7 @@ public class IntersceneMatchParameters { properties.setProperty(prefix+"sfm_extrapolate", this.sfm_extrapolate + ""); // boolean properties.setProperty(prefix+"sfm_extrapolate", this.sfm_extrapolate + ""); // boolean properties.setProperty(prefix+"center_reference", this.center_reference + ""); // boolean properties.setProperty(prefix+"center_reference", this.center_reference + ""); // boolean properties.setProperty(prefix+"overlap_sequences", this.overlap_sequences + ""); // boolean properties.setProperty(prefix+"reset_photometric", this.reset_photometric + ""); // boolean properties.setProperty(prefix+"reset_photometric", this.reset_photometric + ""); // boolean properties.setProperty(prefix+"force_ref_dsi", this.force_ref_dsi + ""); // boolean properties.setProperty(prefix+"force_ref_dsi", this.force_ref_dsi + ""); // boolean properties.setProperty(prefix+"force_orientations", this.force_orientations + ""); // boolean properties.setProperty(prefix+"force_orientations", this.force_orientations + ""); // boolean Loading Loading @@ -1956,6 +1961,7 @@ public class IntersceneMatchParameters { if (properties.getProperty(prefix+"sfm_extrapolate")!=null) this.sfm_extrapolate=Boolean.parseBoolean(properties.getProperty(prefix+"sfm_extrapolate")); if (properties.getProperty(prefix+"sfm_extrapolate")!=null) this.sfm_extrapolate=Boolean.parseBoolean(properties.getProperty(prefix+"sfm_extrapolate")); if (properties.getProperty(prefix+"center_reference")!=null) this.center_reference=Boolean.parseBoolean(properties.getProperty(prefix+"center_reference")); if (properties.getProperty(prefix+"center_reference")!=null) this.center_reference=Boolean.parseBoolean(properties.getProperty(prefix+"center_reference")); if (properties.getProperty(prefix+"overlap_sequences")!=null) this.overlap_sequences=Boolean.parseBoolean(properties.getProperty(prefix+"overlap_sequences")); if (properties.getProperty(prefix+"reset_photometric")!=null) this.reset_photometric=Boolean.parseBoolean(properties.getProperty(prefix+"reset_photometric")); if (properties.getProperty(prefix+"reset_photometric")!=null) this.reset_photometric=Boolean.parseBoolean(properties.getProperty(prefix+"reset_photometric")); if (properties.getProperty(prefix+"force_ref_dsi")!=null) this.force_ref_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"force_ref_dsi")); if (properties.getProperty(prefix+"force_ref_dsi")!=null) this.force_ref_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"force_ref_dsi")); if (properties.getProperty(prefix+"force_orientations")!=null) this.force_orientations=Boolean.parseBoolean(properties.getProperty(prefix+"force_orientations")); if (properties.getProperty(prefix+"force_orientations")!=null) this.force_orientations=Boolean.parseBoolean(properties.getProperty(prefix+"force_orientations")); Loading Loading @@ -2327,6 +2333,7 @@ public class IntersceneMatchParameters { imp.sfm_extrapolate = this.sfm_extrapolate; imp.sfm_extrapolate = this.sfm_extrapolate; imp.center_reference = this.center_reference; imp.center_reference = this.center_reference; imp.overlap_sequences = this.overlap_sequences; imp.reset_photometric = this.reset_photometric; imp.reset_photometric = this.reset_photometric; imp.force_ref_dsi = this.force_ref_dsi; imp.force_ref_dsi = this.force_ref_dsi; imp.force_orientations = this.force_orientations; imp.force_orientations = this.force_orientations; Loading
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java +35 −13 Original line number Original line Diff line number Diff line Loading @@ -3966,6 +3966,7 @@ public class OpticalFlow { public static void buildRefDSI( public static void buildRefDSI( CLTParameters clt_parameters, CLTParameters clt_parameters, boolean fast, boolean fast, boolean skip_photo, EyesisCorrectionParameters.DebayerParameters debayerParameters, EyesisCorrectionParameters.DebayerParameters debayerParameters, ColorProcParameters colorProcParameters, ColorProcParameters colorProcParameters, EyesisCorrectionParameters.RGBParameters rgbParameters, EyesisCorrectionParameters.RGBParameters rgbParameters, Loading Loading @@ -4109,7 +4110,7 @@ public class OpticalFlow { boolean ran_photo_each = false; boolean ran_photo_each = false; quadCLT_ref.tp.resetCLTPasses(); quadCLT_ref.tp.resetCLTPasses(); // perform photometric here, after first DSI // perform photometric here, after first DSI if (photo_each && (!quadCLT_ref.isPhotometricThis() || !batch_mode)) { if (!skip_photo && (photo_each && (!quadCLT_ref.isPhotometricThis() || !batch_mode))) { // if (debugLevel > -3) { // if (debugLevel > -3) { // System.out.println("**** Running photometric equalization for "+quadCLT_ref.getImageName()+ // System.out.println("**** Running photometric equalization for "+quadCLT_ref.getImageName()+ // ", current was from scene "+quadCLT_ref.getPhotometricScene()+" ****"); // ", current was from scene "+quadCLT_ref.getPhotometricScene()+" ****"); Loading Loading @@ -4240,13 +4241,12 @@ public class OpticalFlow { quadCLT_ref.saveDSIAll ( quadCLT_ref.saveDSIAll ( "-DSI_MAIN", // String suffix, // "-DSI_MAIN" "-DSI_MAIN", // String suffix, // "-DSI_MAIN" dsi); dsi); quadCLT_ref.set_orient(0); // reset orientations quadCLT_ref.set_accum(0); // reset accumulations ("build_interscene") number quadCLT_ref.saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) quadCLT_ref.saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...) null, // String path, // full name with extension or w/o path to use x3d directory null, // String path, // full name with extension or w/o path to use x3d directory // null, // Properties properties, // if null - will only save extrinsics) // null, // Properties properties, // if null - will only save extrinsics) debugLevel); debugLevel); quadCLT_ref.set_orient(0); // reset orientations quadCLT_ref.set_accum(0); // reset accumulations ("build_interscene") number } } public static void reuseRefDSI( public static void reuseRefDSI( Loading Loading @@ -4760,6 +4760,7 @@ public class OpticalFlow { scenes_xyzatr[last_index] = new double[2][3]; // all zeros scenes_xyzatr[last_index] = new double[2][3]; // all zeros // See if build_ref_dsi is needed // See if build_ref_dsi is needed if (!build_ref_dsi) { if (!build_ref_dsi) { // try reading full quadCLTs[last_index] = (QuadCLT) quadCLT_main.spawnNoModelQuadCLT( // will conditionImageSet quadCLTs[last_index] = (QuadCLT) quadCLT_main.spawnNoModelQuadCLT( // will conditionImageSet set_channels[last_index].set_name, set_channels[last_index].set_name, clt_parameters, clt_parameters, Loading @@ -4771,10 +4772,24 @@ public class OpticalFlow { null, // String path, // full name with extension or null to use x3d directory null, // String path, // full name with extension or null to use x3d directory false, // boolean all_properties,// null, // Properties properties, // if null - will only save extrinsics) false, // boolean all_properties,// null, // Properties properties, // if null - will only save extrinsics) debugLevel); debugLevel); int center_index =quadCLTs[last_index].getReferenceIndex(null); int center_index =quadCLTs[last_index].getReferenceIndex(new QuadCLT[] {quadCLTs[last_index]}); // null); self, may return 0 if (center_index == -1) { int [] first_last_index = quadCLTs[last_index].getFirstLastIndex(new QuadCLT[] {quadCLTs[last_index]}); if ((center_index == -1) || (center_index == 0)) { // 0 - was self-referencing, TODO: debug, should not be // -2 - reference somewhere, not to itself // -1 - no reference to a center // 0 - reference // with overlap it may already have *-DSI_MAIN or even *-INTER-INTRA-LMA.tiff // int [] first_last_index = quadCLTs[last_index].getFirstLastIndex(quadCLTs); if (first_last_index == null) { build_ref_dsi = true; build_ref_dsi = true; } else { } else { // should have DSI if (debugLevel >-2) { System.out.println("no link to center, but this seems to be other's center "+quadCLTs[last_index].getReferenceTimestamp()+ ", forcing initial orientation."); } force_initial_orientations = true; } } else { // -2 - reference somewhere, not to itself QuadCLT try_ref_scene = (QuadCLT) quadCLT_main.spawnQuadCLT( // will conditionImageSet QuadCLT try_ref_scene = (QuadCLT) quadCLT_main.spawnQuadCLT( // will conditionImageSet quadCLTs[last_index].getReferenceTimestamp(), // set_channels[last_index].set_name, quadCLTs[last_index].getReferenceTimestamp(), // set_channels[last_index].set_name, clt_parameters, clt_parameters, Loading @@ -4785,6 +4800,7 @@ public class OpticalFlow { if (debugLevel >-2) { if (debugLevel >-2) { System.out.println("DSI data for scene "+quadCLTs[last_index].getReferenceTimestamp()+ System.out.println("DSI data for scene "+quadCLTs[last_index].getReferenceTimestamp()+ " does not exist, forcing initial orientation."); " does not exist, forcing initial orientation."); // consider copyJP4src for the lower half (now it is not needed) } } force_initial_orientations = true; force_initial_orientations = true; } } Loading Loading @@ -4848,6 +4864,7 @@ public class OpticalFlow { buildRefDSI( // returned is a different instance than input -FIXED buildRefDSI( // returned is a different instance than input -FIXED clt_parameters, // CLTParameters clt_parameters, clt_parameters, // CLTParameters clt_parameters, fast, // boolean fast, fast, // boolean fast, false, // boolean skip_photo, debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters, debayerParameters, // EyesisCorrectionParameters.DebayerParameters debayerParameters, colorProcParameters, // ColorProcParameters colorProcParameters, colorProcParameters, // ColorProcParameters colorProcParameters, rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters, rgbParameters, // EyesisCorrectionParameters.RGBParameters rgbParameters, Loading Loading @@ -4884,7 +4901,7 @@ public class OpticalFlow { updateStatus, // final boolean updateStatus, updateStatus, // final boolean updateStatus, debugLevel); // int debugLevel) debugLevel); // int debugLevel) if (center_reference) { if (center_reference) { // center_ts = getReferenceTimestamp(); // center_ts = getReferenceTimestamp(); //?? } } } } } // while (blue_sky == null) } // while (blue_sky == null) Loading Loading @@ -5054,7 +5071,11 @@ public class OpticalFlow { int [] first_last_index = quadCLTs[ref_index].getFirstLastIndex(quadCLTs); int [] first_last_index = quadCLTs[ref_index].getFirstLastIndex(quadCLTs); if (first_last_index == null) { if (first_last_index == null) { System.out.println("BUG: saved reference scene "+quadCLTs[ref_index].getImageName()+ System.out.println("BUG: saved reference scene "+quadCLTs[ref_index].getImageName()+ " does not have first/last scenes defined"); " is not really a reference"); System.out.println(); } else if ((first_last_index [0] < 0) || (first_last_index [1] < 0)) { System.out.println("BUG: saved reference scene "+quadCLTs[ref_index].getImageName()+ " does not have both first/last scenes defined: ["+first_last_index [0]+", "+first_last_index [1]+"]"); System.out.println(); System.out.println(); } else { } else { earliest_scene = first_last_index[0]; earliest_scene = first_last_index[0]; Loading Loading @@ -5100,17 +5121,18 @@ public class OpticalFlow { // num_avg_pairs = last_index - ref_index; // num_avg_pairs = last_index - ref_index; // } // } QuadCLT[][][] scenes_seq_pairs = new QuadCLT[3][num_avg_pairs][2]; QuadCLT[][][] scenes_seq_pairs = new QuadCLT[3][num_avg_pairs][2]; int ref_index_mod1 = Math.max(ref_index, earliest_scene + num_avg_pairs - 1); int ref_index_mod2 = Math.min(ref_index, last_index); // TODO: calculate horizontal offset and compare with sfm_min_base // TODO: calculate horizontal offset and compare with sfm_min_base for (int i = 0; i < num_avg_pairs; i++) { for (int i = 0; i < num_avg_pairs; i++) { // scenes_seq_pairs[0][i][0] = quadCLTs[ref_index + num_avg_pairs - 1 - i]; scenes_seq_pairs[0][i][0] = quadCLTs[last_index - i]; scenes_seq_pairs[0][i][0] = quadCLTs[last_index - i]; scenes_seq_pairs[0][i][1] = quadCLTs[earliest_scene + num_avg_pairs - 1 - i]; scenes_seq_pairs[0][i][1] = quadCLTs[earliest_scene + num_avg_pairs - 1 - i]; scenes_seq_pairs[1][i][0] = quadCLTs[last_index - i]; scenes_seq_pairs[1][i][0] = quadCLTs[last_index - i]; scenes_seq_pairs[1][i][1] = quadCLTs[ref_index - i]; scenes_seq_pairs[1][i][1] = quadCLTs[ref_index_mod1 - i]; scenes_seq_pairs[2][i][0] = quadCLTs[last_index - i]; scenes_seq_pairs[2][i][0] = quadCLTs[ref_index_mod2 + num_avg_pairs - 1 - i]; scenes_seq_pairs[2][i][1] = quadCLTs[earliest_scene + num_avg_pairs - 1 - i]; scenes_seq_pairs[2][i][1] = quadCLTs[earliest_scene + num_avg_pairs - 1 - i]; } } double [][] sfm_dsn = StructureFromMotion.sfmPairsSet( double [][] sfm_dsn = StructureFromMotion.sfmPairsSet( Loading
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java +27 −24 Original line number Original line Diff line number Diff line Loading @@ -273,7 +273,7 @@ public class QuadCLTCPU { public int getReferenceIndex(QuadCLTCPU [] scenes) { public int getReferenceIndex(QuadCLTCPU [] scenes) { if (timestamp_reference != null) { if (timestamp_reference != null) { if (scenes != null) { if (scenes != null) { for (int i = 0; i < scenes.length; i++) { for (int i = 0; i < scenes.length; i++) if (scenes[i] != null){ if (timestamp_reference.equals(scenes[i].getImageName())) { if (timestamp_reference.equals(scenes[i].getImageName())) { return i; return i; } } Loading @@ -286,33 +286,36 @@ public class QuadCLTCPU { /** /** * If this scene is a reference scene, then return array of {first_index, last_index}. * If this scene is a reference scene, then return array of {first_index, last_index}. * If this scene is not a reference or the array does not contain both the first and * If this scene is not a reference - return null. * the last scene - return null. * @param scenes array of scenes (QuadCLTCPU instances) * @param scenes array of scenes (QuadCLTCPU instances) * @return a pair of {first_index, last_index} * @return a pair of {first_index, last_index} */ */ public int [] getFirstLastIndex(QuadCLTCPU [] scenes) { // should be ordered accending ts public int [] getFirstLastIndex(QuadCLTCPU [] scenes) { // should be ordered accending ts int [] fl = new int [] {-1,-1}; int [] fl = null; if ((timestamp_first != null) && (timestamp_last != null)) { if ((timestamp_first != null) && (timestamp_last != null)) { fl = new int [] {-1,-1}; if (scenes != null) { int i = 0; int i = 0; for (; i < scenes.length; i++) { for (; i < scenes.length; i++) if (scenes[i] != null) { if (timestamp_first.equals(scenes[i].getImageName())) { if (timestamp_first.equals(scenes[i].getImageName())) { fl[0] = i; fl[0] = i; break; break; } } } } for (; i < scenes.length; i++) { for (; i < scenes.length; i++) if (scenes[i] != null) { if (timestamp_last.equals(scenes[i].getImageName())) { if (timestamp_last.equals(scenes[i].getImageName())) { fl[1] = i; fl[1] = i; break; break; } } } } } } if ((fl[0] >= 0) && (fl[1] >= 0)) { return fl; } else { return null; } } return fl; // if ((fl[0] >= 0) && (fl[1] >= 0)) { // return fl; // } else { // return null; // } } } /** /** Loading
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java +3 −6 Original line number Original line Diff line number Diff line Loading @@ -8531,6 +8531,7 @@ if (debugLevel > -100) return true; // temporarily ! final boolean updateStatus, final boolean updateStatus, final int debugLevel) throws Exception final int debugLevel) throws Exception { { boolean overlap_sequences = clt_parameters.imp.overlap_sequences; int stereo_gap = clt_parameters.imp.stereo_gap; int stereo_gap = clt_parameters.imp.stereo_gap; double stereo_intereye = clt_parameters.imp.stereo_intereye; double stereo_intereye = clt_parameters.imp.stereo_intereye; double stereo_phone_width = clt_parameters.imp.stereo_phone_width; // 0 - no padding double stereo_phone_width = clt_parameters.imp.stereo_phone_width; // 0 - no padding Loading Loading @@ -8672,14 +8673,10 @@ if (debugLevel > -100) return true; // temporarily ! if (start_ref_pointers[0] < (min_num_scenes-1)) { if (start_ref_pointers[0] < (min_num_scenes-1)) { break; break; } } ref_index = start_ref_pointers[0]; // continue from the same attached to the previous reference ref_index = start_ref_pointers[overlap_sequences? 1 : 0]; // continue from the same attached to the previous reference } } } } // combine videos if generated // combine videos if generated if ((video_sets_list.size() > 1) && if ((video_sets_list.size() > 1) && (video_sets_list.get(0).getVideoPaths() != null) && (video_sets_list.get(0).getVideoPaths() != null) && Loading