Loading src/main/java/com/elphel/imagej/cameras/EyesisCorrectionParameters.java +13 −3 Original line number Original line Diff line number Diff line Loading @@ -138,8 +138,9 @@ public class EyesisCorrectionParameters { public String x3dSubdirSuffix= ""; public String x3dSubdirSuffix= ""; // CLT 3d batch parameters // CLT 3d batch parameters public boolean process_main_sources = false; public boolean process_main_sources = false; // not yet used public boolean process_aux_sources = true; public boolean process_aux_sources = true; // not yet used public int kml_sensors= 0xffffffff; // all sensors public int rig_batch_adjust_main = 0; public int rig_batch_adjust_main = 0; public int rig_batch_adjust_aux = 0; public int rig_batch_adjust_aux = 0; Loading Loading @@ -305,6 +306,7 @@ public class EyesisCorrectionParameters { cp.process_main_sources= this.process_main_sources; cp.process_main_sources= this.process_main_sources; cp.process_aux_sources= this.process_aux_sources; cp.process_aux_sources= this.process_aux_sources; cp.kml_sensors= this.kml_sensors; cp.rig_batch_adjust_main= this.rig_batch_adjust_main; cp.rig_batch_adjust_main= this.rig_batch_adjust_main; cp.rig_batch_adjust_aux= this.rig_batch_adjust_aux; cp.rig_batch_adjust_aux= this.rig_batch_adjust_aux; cp.rig_batch_adjust_rig= this.rig_batch_adjust_rig; cp.rig_batch_adjust_rig= this.rig_batch_adjust_rig; Loading Loading @@ -508,6 +510,8 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"process_main_sources", this.process_main_sources+""); properties.setProperty(prefix+"process_main_sources", this.process_main_sources+""); properties.setProperty(prefix+"process_aux_sources", this.process_aux_sources+""); properties.setProperty(prefix+"process_aux_sources", this.process_aux_sources+""); properties.setProperty(prefix+"kml_sensors", this.kml_sensors+""); properties.setProperty(prefix+"rig_batch_adjust_main", this.rig_batch_adjust_main+""); properties.setProperty(prefix+"rig_batch_adjust_main", this.rig_batch_adjust_main+""); properties.setProperty(prefix+"rig_batch_adjust_aux", this.rig_batch_adjust_aux+""); properties.setProperty(prefix+"rig_batch_adjust_aux", this.rig_batch_adjust_aux+""); properties.setProperty(prefix+"rig_batch_adjust_rig", this.rig_batch_adjust_rig+""); properties.setProperty(prefix+"rig_batch_adjust_rig", this.rig_batch_adjust_rig+""); Loading Loading @@ -693,6 +697,8 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"process_main_sources")!= null) this.process_main_sources=Boolean.parseBoolean(properties.getProperty(prefix+"process_main_sources")); if (properties.getProperty(prefix+"process_main_sources")!= null) this.process_main_sources=Boolean.parseBoolean(properties.getProperty(prefix+"process_main_sources")); if (properties.getProperty(prefix+"process_aux_sources")!= null) this.process_aux_sources=Boolean.parseBoolean(properties.getProperty(prefix+"process_aux_sources")); if (properties.getProperty(prefix+"process_aux_sources")!= null) this.process_aux_sources=Boolean.parseBoolean(properties.getProperty(prefix+"process_aux_sources")); if (properties.getProperty(prefix+"kml_sensors")!=null) this.kml_sensors=Integer.parseInt(properties.getProperty(prefix+"kml_sensors")); if (properties.getProperty(prefix+"rig_batch_adjust_main")!=null) this.rig_batch_adjust_main=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_main")); if (properties.getProperty(prefix+"rig_batch_adjust_main")!=null) this.rig_batch_adjust_main=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_main")); if (properties.getProperty(prefix+"rig_batch_adjust_aux")!=null) this.rig_batch_adjust_aux=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_aux")); if (properties.getProperty(prefix+"rig_batch_adjust_aux")!=null) this.rig_batch_adjust_aux=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_aux")); if (properties.getProperty(prefix+"rig_batch_adjust_rig")!=null) this.rig_batch_adjust_rig=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_rig")); if (properties.getProperty(prefix+"rig_batch_adjust_rig")!=null) this.rig_batch_adjust_rig=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_rig")); Loading Loading @@ -1086,6 +1092,8 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Process main camera source images (false - ignore)", this.process_main_sources); // 20c gd.addCheckbox ("Process main camera source images (false - ignore)", this.process_main_sources); // 20c gd.addCheckbox ("Process AUX camera source images (false - ignore)", this.process_aux_sources); // 20d gd.addCheckbox ("Process AUX camera source images (false - ignore)", this.process_aux_sources); // 20d gd.addNumericField("Bitmask of channels were to look for GPS data", this.kml_sensors, 0); gd.addNumericField("Repeat main camera field adjustment (early, before rig)", this.rig_batch_adjust_main, 0); gd.addNumericField("Repeat main camera field adjustment (early, before rig)", this.rig_batch_adjust_main, 0); gd.addNumericField("Repeat aux camera field adjustment (early, before rig)", this.rig_batch_adjust_aux, 0); gd.addNumericField("Repeat aux camera field adjustment (early, before rig)", this.rig_batch_adjust_aux, 0); gd.addNumericField("Repeat 2-quad camera rig field adjustment (early, before late main/aux)", this.rig_batch_adjust_rig, 0); gd.addNumericField("Repeat 2-quad camera rig field adjustment (early, before late main/aux)", this.rig_batch_adjust_rig, 0); Loading Loading @@ -1226,6 +1234,8 @@ public class EyesisCorrectionParameters { this.process_main_sources= gd.getNextBoolean(); // 20c this.process_main_sources= gd.getNextBoolean(); // 20c this.process_aux_sources= gd.getNextBoolean(); // 20d this.process_aux_sources= gd.getNextBoolean(); // 20d this.kml_sensors = (int) gd.getNextNumber(); this.rig_batch_adjust_main = (int) gd.getNextNumber(); this.rig_batch_adjust_main = (int) gd.getNextNumber(); this.rig_batch_adjust_aux = (int) gd.getNextNumber(); this.rig_batch_adjust_aux = (int) gd.getNextNumber(); this.rig_batch_adjust_rig = (int) gd.getNextNumber(); this.rig_batch_adjust_rig = (int) gd.getNextNumber(); Loading Loading @@ -1289,7 +1299,7 @@ public class EyesisCorrectionParameters { return (this.sourcePaths!=null)?this.sourcePaths:empty; return (this.sourcePaths!=null)?this.sourcePaths:empty; } } public int getChannelFromTiff(String path, String suffix){ public static int getChannelFromTiff(String path, String suffix){ int indexSuffix=path.length()-suffix.length(); int indexSuffix=path.length()-suffix.length(); int indexLastDash=indexSuffix-1; // in jp4 it will be underscore, not dash? Or should we change that? int indexLastDash=indexSuffix-1; // in jp4 it will be underscore, not dash? Or should we change that? while ((indexLastDash>0) && while ((indexLastDash>0) && Loading src/main/java/com/elphel/imagej/gpu/GpuQuad.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -838,6 +838,10 @@ public class GpuQuad{ // quad camera description } } float [] fbayer = new float [bayer_data[0][0].length]; float [] fbayer = new float [bayer_data[0][0].length]; for (int ncam = 0; ncam < bayer_data.length; ncam++) { for (int ncam = 0; ncam < bayer_data.length; ncam++) { if (bayer_data[ncam][0] == null) { System.out.println("BUG!! bayer_data["+ncam+"][0] == null"); continue; } for (int i = 0; i < bayer_data[ncam][0].length; i++) { for (int i = 0; i < bayer_data[ncam][0].length; i++) { fbayer[i] = (float) (bayer_data[ncam][0][i]); // + bayer_data[ncam][1][i] + bayer_data[ncam][2][i]); fbayer[i] = (float) (bayer_data[ncam][0][i]); // + bayer_data[ncam][1][i] + bayer_data[ncam][2][i]); for (int j = 1; j < bayer_data[ncam].length; j++) { for (int j = 1; j < bayer_data[ncam].length; j++) { Loading src/main/java/com/elphel/imagej/readers/ImagejJp4Tiff.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -649,19 +649,20 @@ public class ImagejJp4Tiff { return center; return center; } } System.out.println ("Discontinuities remain, will fix by clusters"); System.out.println ("Discontinuities remain, will fix by clusters"); fixByClusters( boolean OK = fixByClusters( width, width, height, height, FIXCH6_BIT, // int bad_bit, FIXCH6_BIT, // int bad_bit, idata, // int [] data) idata, // int [] data) (dbg_img != null)); // boolean debug) (dbg_img != null)); // boolean debug) System.out.println ("FixByClusters -> "+OK); for (int i = 0; i < idata.length; i++) { for (int i = 0; i < idata.length; i++) { pixels[i+640] = idata[i]; pixels[i+640] = idata[i]; } } return center; return center; } } public boolean fixByClusters( public static boolean fixByClusters( int width, int width, int height, int height, int bad_bit, int bad_bit, Loading Loading @@ -733,6 +734,9 @@ public class ImagejJp4Tiff { } } if (ndir == 1) { if (ndir == 1) { indx++; indx++; if (indx >= clusters.length) { // start from the beginning indx -= clusters.length; } } } } } if (ntry >= (2*clusters.length)) { if (ntry >= (2*clusters.length)) { Loading src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java +50 −13 Original line number Original line Diff line number Diff line Loading @@ -2467,6 +2467,9 @@ public class ImageDtt extends ImageDttCPU { final boolean use_partial, // find motion vectors for individual pairs, false - for sum only final boolean use_partial, // find motion vectors for individual pairs, false - for sum only final double centroid_radius, // 0 - use all tile, >0 - cosine window around local max final double centroid_radius, // 0 - use all tile, >0 - cosine window around local max final int n_recenter, // when cosine window, re-center window this many times final int n_recenter, // when cosine window, re-center window this many times final double td_weight, // mix correlations accumulated in TD with final double pd_weight, // correlations (post) accumulated in PD final boolean td_nopd_only, // only use TD accumulated data if no safe PD is available for the tile. final double min_str, // = 0.25; final double min_str, // = 0.25; final double min_str_sum, // = 0.8; // 5; final double min_str_sum, // = 0.8; // 5; final int min_neibs, // 2; // minimal number of strong neighbors (> min_str) final int min_neibs, // 2; // minimal number of strong neighbors (> min_str) Loading Loading @@ -2658,19 +2661,52 @@ public class ImageDtt extends ImageDttCPU { } } } } // now calculate only for composite // now calculate only for composite double [] mv = Correlation2d.getMaxXYCm( double [] mv_pd = new double [3]; double [] mv_td = new double [3]; if (pd_weight > 0.0) { mv_pd = Correlation2d.getMaxXYCm( corrs[corrs.length-1], // double [] data, corrs[corrs.length-1], // double [] data, corr_size, // int data_width, // = 2 * transform_size - 1; corr_size, // int data_width, // = 2 * transform_size - 1; centroid_radius, // double radius, // 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad) centroid_radius, // double radius, // 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad) n_recenter, // int refine, // re-center window around new maximum. 0 -no refines (single-pass) n_recenter, // int refine, // re-center window around new maximum. 0 -no refines (single-pass) false); // boolean debug) false); // boolean debug) if (mv != null) { if (mv_pd != null) { if (mv[2] < min_str) { if (mv_pd[2] < min_str) { mv = null; mv_pd = null; } else { mv_pd[2] -= min_str; } } } if (td_weight > 0.0) { mv_td = Correlation2d.getMaxXYCm( corrs[corrs.length-2], // double [] data, corr_size, // int data_width, // = 2 * transform_size - 1; centroid_radius, // double radius, // 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad) n_recenter, // int refine, // re-center window around new maximum. 0 -no refines (single-pass) false); // boolean debug) if (mv_td != null) { if (mv_td[2] < min_str_sum) { mv_td = null; } else { } else { mv[2] -= min_str; mv_td[2] -= min_str_sum; } } } } } if ((mv_td != null) || (mv_pd != null)) { double [] mv = new double[3]; if (mv_pd != null) { mv = mv_pd; mv[2] *= pd_weight; if ((mv_td != null) && !td_nopd_only) { // mix mv[0] = (mv[0] * pd_weight + mv_td[0] * td_weight)/ (pd_weight + td_weight); mv[1] = (mv[1] * pd_weight + mv_td[1] * td_weight)/ (pd_weight + td_weight); mv[2] += mv_td[2] * td_weight; } // mix } else { // (mv_pd == null) && (mv_td != null) below mv = mv_td; mv[2] *= td_weight; } if (mv != null) { if (mv != null) { if (pXpYD == null) { if (pXpYD == null) { coord_motion[0][nTile] = mv; coord_motion[0][nTile] = mv; Loading @@ -2683,6 +2719,7 @@ public class ImageDtt extends ImageDttCPU { } } } } } } } }; }; } } startAndJoin(threads); startAndJoin(threads); Loading src/main/java/com/elphel/imagej/tileprocessor/IntersceneLma.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -620,7 +620,7 @@ public class IntersceneLma { pure_weight = s_pure/full_weight; pure_weight = s_pure/full_weight; final double s = 1.0/asum_weight.sum(); final double s = 1.0/asum_weight.sum(); if (Double.isNaN(s)) { if (Double.isNaN(s)) { System.out.println("normalizeWeights(): s == NaN"); System.out.println("normalizeWeights(): s == NaN : 1"); } } ai.set(0); ai.set(0); for (int ithread = 0; ithread < threads.length; ithread++) { for (int ithread = 0; ithread < threads.length; ithread++) { Loading Loading @@ -673,7 +673,7 @@ public class IntersceneLma { pure_weight = sum_weight_pure/full_weight; pure_weight = sum_weight_pure/full_weight; final double s = 1.0/full_weight; final double s = 1.0/full_weight; if (Double.isNaN(s)) { if (Double.isNaN(s)) { System.out.println("normalizeWeights(): s == NaN"); System.out.println("normalizeWeights(): s == NaN : 2"); } } ai.set(0); ai.set(0); for (int ithread = 0; ithread < threads.length; ithread++) { for (int ithread = 0; ithread < threads.length; ithread++) { Loading Loading
src/main/java/com/elphel/imagej/cameras/EyesisCorrectionParameters.java +13 −3 Original line number Original line Diff line number Diff line Loading @@ -138,8 +138,9 @@ public class EyesisCorrectionParameters { public String x3dSubdirSuffix= ""; public String x3dSubdirSuffix= ""; // CLT 3d batch parameters // CLT 3d batch parameters public boolean process_main_sources = false; public boolean process_main_sources = false; // not yet used public boolean process_aux_sources = true; public boolean process_aux_sources = true; // not yet used public int kml_sensors= 0xffffffff; // all sensors public int rig_batch_adjust_main = 0; public int rig_batch_adjust_main = 0; public int rig_batch_adjust_aux = 0; public int rig_batch_adjust_aux = 0; Loading Loading @@ -305,6 +306,7 @@ public class EyesisCorrectionParameters { cp.process_main_sources= this.process_main_sources; cp.process_main_sources= this.process_main_sources; cp.process_aux_sources= this.process_aux_sources; cp.process_aux_sources= this.process_aux_sources; cp.kml_sensors= this.kml_sensors; cp.rig_batch_adjust_main= this.rig_batch_adjust_main; cp.rig_batch_adjust_main= this.rig_batch_adjust_main; cp.rig_batch_adjust_aux= this.rig_batch_adjust_aux; cp.rig_batch_adjust_aux= this.rig_batch_adjust_aux; cp.rig_batch_adjust_rig= this.rig_batch_adjust_rig; cp.rig_batch_adjust_rig= this.rig_batch_adjust_rig; Loading Loading @@ -508,6 +510,8 @@ public class EyesisCorrectionParameters { properties.setProperty(prefix+"process_main_sources", this.process_main_sources+""); properties.setProperty(prefix+"process_main_sources", this.process_main_sources+""); properties.setProperty(prefix+"process_aux_sources", this.process_aux_sources+""); properties.setProperty(prefix+"process_aux_sources", this.process_aux_sources+""); properties.setProperty(prefix+"kml_sensors", this.kml_sensors+""); properties.setProperty(prefix+"rig_batch_adjust_main", this.rig_batch_adjust_main+""); properties.setProperty(prefix+"rig_batch_adjust_main", this.rig_batch_adjust_main+""); properties.setProperty(prefix+"rig_batch_adjust_aux", this.rig_batch_adjust_aux+""); properties.setProperty(prefix+"rig_batch_adjust_aux", this.rig_batch_adjust_aux+""); properties.setProperty(prefix+"rig_batch_adjust_rig", this.rig_batch_adjust_rig+""); properties.setProperty(prefix+"rig_batch_adjust_rig", this.rig_batch_adjust_rig+""); Loading Loading @@ -693,6 +697,8 @@ public class EyesisCorrectionParameters { if (properties.getProperty(prefix+"process_main_sources")!= null) this.process_main_sources=Boolean.parseBoolean(properties.getProperty(prefix+"process_main_sources")); if (properties.getProperty(prefix+"process_main_sources")!= null) this.process_main_sources=Boolean.parseBoolean(properties.getProperty(prefix+"process_main_sources")); if (properties.getProperty(prefix+"process_aux_sources")!= null) this.process_aux_sources=Boolean.parseBoolean(properties.getProperty(prefix+"process_aux_sources")); if (properties.getProperty(prefix+"process_aux_sources")!= null) this.process_aux_sources=Boolean.parseBoolean(properties.getProperty(prefix+"process_aux_sources")); if (properties.getProperty(prefix+"kml_sensors")!=null) this.kml_sensors=Integer.parseInt(properties.getProperty(prefix+"kml_sensors")); if (properties.getProperty(prefix+"rig_batch_adjust_main")!=null) this.rig_batch_adjust_main=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_main")); if (properties.getProperty(prefix+"rig_batch_adjust_main")!=null) this.rig_batch_adjust_main=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_main")); if (properties.getProperty(prefix+"rig_batch_adjust_aux")!=null) this.rig_batch_adjust_aux=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_aux")); if (properties.getProperty(prefix+"rig_batch_adjust_aux")!=null) this.rig_batch_adjust_aux=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_aux")); if (properties.getProperty(prefix+"rig_batch_adjust_rig")!=null) this.rig_batch_adjust_rig=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_rig")); if (properties.getProperty(prefix+"rig_batch_adjust_rig")!=null) this.rig_batch_adjust_rig=Integer.parseInt(properties.getProperty(prefix+"rig_batch_adjust_rig")); Loading Loading @@ -1086,6 +1092,8 @@ public class EyesisCorrectionParameters { gd.addCheckbox ("Process main camera source images (false - ignore)", this.process_main_sources); // 20c gd.addCheckbox ("Process main camera source images (false - ignore)", this.process_main_sources); // 20c gd.addCheckbox ("Process AUX camera source images (false - ignore)", this.process_aux_sources); // 20d gd.addCheckbox ("Process AUX camera source images (false - ignore)", this.process_aux_sources); // 20d gd.addNumericField("Bitmask of channels were to look for GPS data", this.kml_sensors, 0); gd.addNumericField("Repeat main camera field adjustment (early, before rig)", this.rig_batch_adjust_main, 0); gd.addNumericField("Repeat main camera field adjustment (early, before rig)", this.rig_batch_adjust_main, 0); gd.addNumericField("Repeat aux camera field adjustment (early, before rig)", this.rig_batch_adjust_aux, 0); gd.addNumericField("Repeat aux camera field adjustment (early, before rig)", this.rig_batch_adjust_aux, 0); gd.addNumericField("Repeat 2-quad camera rig field adjustment (early, before late main/aux)", this.rig_batch_adjust_rig, 0); gd.addNumericField("Repeat 2-quad camera rig field adjustment (early, before late main/aux)", this.rig_batch_adjust_rig, 0); Loading Loading @@ -1226,6 +1234,8 @@ public class EyesisCorrectionParameters { this.process_main_sources= gd.getNextBoolean(); // 20c this.process_main_sources= gd.getNextBoolean(); // 20c this.process_aux_sources= gd.getNextBoolean(); // 20d this.process_aux_sources= gd.getNextBoolean(); // 20d this.kml_sensors = (int) gd.getNextNumber(); this.rig_batch_adjust_main = (int) gd.getNextNumber(); this.rig_batch_adjust_main = (int) gd.getNextNumber(); this.rig_batch_adjust_aux = (int) gd.getNextNumber(); this.rig_batch_adjust_aux = (int) gd.getNextNumber(); this.rig_batch_adjust_rig = (int) gd.getNextNumber(); this.rig_batch_adjust_rig = (int) gd.getNextNumber(); Loading Loading @@ -1289,7 +1299,7 @@ public class EyesisCorrectionParameters { return (this.sourcePaths!=null)?this.sourcePaths:empty; return (this.sourcePaths!=null)?this.sourcePaths:empty; } } public int getChannelFromTiff(String path, String suffix){ public static int getChannelFromTiff(String path, String suffix){ int indexSuffix=path.length()-suffix.length(); int indexSuffix=path.length()-suffix.length(); int indexLastDash=indexSuffix-1; // in jp4 it will be underscore, not dash? Or should we change that? int indexLastDash=indexSuffix-1; // in jp4 it will be underscore, not dash? Or should we change that? while ((indexLastDash>0) && while ((indexLastDash>0) && Loading
src/main/java/com/elphel/imagej/gpu/GpuQuad.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -838,6 +838,10 @@ public class GpuQuad{ // quad camera description } } float [] fbayer = new float [bayer_data[0][0].length]; float [] fbayer = new float [bayer_data[0][0].length]; for (int ncam = 0; ncam < bayer_data.length; ncam++) { for (int ncam = 0; ncam < bayer_data.length; ncam++) { if (bayer_data[ncam][0] == null) { System.out.println("BUG!! bayer_data["+ncam+"][0] == null"); continue; } for (int i = 0; i < bayer_data[ncam][0].length; i++) { for (int i = 0; i < bayer_data[ncam][0].length; i++) { fbayer[i] = (float) (bayer_data[ncam][0][i]); // + bayer_data[ncam][1][i] + bayer_data[ncam][2][i]); fbayer[i] = (float) (bayer_data[ncam][0][i]); // + bayer_data[ncam][1][i] + bayer_data[ncam][2][i]); for (int j = 1; j < bayer_data[ncam].length; j++) { for (int j = 1; j < bayer_data[ncam].length; j++) { Loading
src/main/java/com/elphel/imagej/readers/ImagejJp4Tiff.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -649,19 +649,20 @@ public class ImagejJp4Tiff { return center; return center; } } System.out.println ("Discontinuities remain, will fix by clusters"); System.out.println ("Discontinuities remain, will fix by clusters"); fixByClusters( boolean OK = fixByClusters( width, width, height, height, FIXCH6_BIT, // int bad_bit, FIXCH6_BIT, // int bad_bit, idata, // int [] data) idata, // int [] data) (dbg_img != null)); // boolean debug) (dbg_img != null)); // boolean debug) System.out.println ("FixByClusters -> "+OK); for (int i = 0; i < idata.length; i++) { for (int i = 0; i < idata.length; i++) { pixels[i+640] = idata[i]; pixels[i+640] = idata[i]; } } return center; return center; } } public boolean fixByClusters( public static boolean fixByClusters( int width, int width, int height, int height, int bad_bit, int bad_bit, Loading Loading @@ -733,6 +734,9 @@ public class ImagejJp4Tiff { } } if (ndir == 1) { if (ndir == 1) { indx++; indx++; if (indx >= clusters.length) { // start from the beginning indx -= clusters.length; } } } } } if (ntry >= (2*clusters.length)) { if (ntry >= (2*clusters.length)) { Loading
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java +50 −13 Original line number Original line Diff line number Diff line Loading @@ -2467,6 +2467,9 @@ public class ImageDtt extends ImageDttCPU { final boolean use_partial, // find motion vectors for individual pairs, false - for sum only final boolean use_partial, // find motion vectors for individual pairs, false - for sum only final double centroid_radius, // 0 - use all tile, >0 - cosine window around local max final double centroid_radius, // 0 - use all tile, >0 - cosine window around local max final int n_recenter, // when cosine window, re-center window this many times final int n_recenter, // when cosine window, re-center window this many times final double td_weight, // mix correlations accumulated in TD with final double pd_weight, // correlations (post) accumulated in PD final boolean td_nopd_only, // only use TD accumulated data if no safe PD is available for the tile. final double min_str, // = 0.25; final double min_str, // = 0.25; final double min_str_sum, // = 0.8; // 5; final double min_str_sum, // = 0.8; // 5; final int min_neibs, // 2; // minimal number of strong neighbors (> min_str) final int min_neibs, // 2; // minimal number of strong neighbors (> min_str) Loading Loading @@ -2658,19 +2661,52 @@ public class ImageDtt extends ImageDttCPU { } } } } // now calculate only for composite // now calculate only for composite double [] mv = Correlation2d.getMaxXYCm( double [] mv_pd = new double [3]; double [] mv_td = new double [3]; if (pd_weight > 0.0) { mv_pd = Correlation2d.getMaxXYCm( corrs[corrs.length-1], // double [] data, corrs[corrs.length-1], // double [] data, corr_size, // int data_width, // = 2 * transform_size - 1; corr_size, // int data_width, // = 2 * transform_size - 1; centroid_radius, // double radius, // 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad) centroid_radius, // double radius, // 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad) n_recenter, // int refine, // re-center window around new maximum. 0 -no refines (single-pass) n_recenter, // int refine, // re-center window around new maximum. 0 -no refines (single-pass) false); // boolean debug) false); // boolean debug) if (mv != null) { if (mv_pd != null) { if (mv[2] < min_str) { if (mv_pd[2] < min_str) { mv = null; mv_pd = null; } else { mv_pd[2] -= min_str; } } } if (td_weight > 0.0) { mv_td = Correlation2d.getMaxXYCm( corrs[corrs.length-2], // double [] data, corr_size, // int data_width, // = 2 * transform_size - 1; centroid_radius, // double radius, // 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad) n_recenter, // int refine, // re-center window around new maximum. 0 -no refines (single-pass) false); // boolean debug) if (mv_td != null) { if (mv_td[2] < min_str_sum) { mv_td = null; } else { } else { mv[2] -= min_str; mv_td[2] -= min_str_sum; } } } } } if ((mv_td != null) || (mv_pd != null)) { double [] mv = new double[3]; if (mv_pd != null) { mv = mv_pd; mv[2] *= pd_weight; if ((mv_td != null) && !td_nopd_only) { // mix mv[0] = (mv[0] * pd_weight + mv_td[0] * td_weight)/ (pd_weight + td_weight); mv[1] = (mv[1] * pd_weight + mv_td[1] * td_weight)/ (pd_weight + td_weight); mv[2] += mv_td[2] * td_weight; } // mix } else { // (mv_pd == null) && (mv_td != null) below mv = mv_td; mv[2] *= td_weight; } if (mv != null) { if (mv != null) { if (pXpYD == null) { if (pXpYD == null) { coord_motion[0][nTile] = mv; coord_motion[0][nTile] = mv; Loading @@ -2683,6 +2719,7 @@ public class ImageDtt extends ImageDttCPU { } } } } } } } }; }; } } startAndJoin(threads); startAndJoin(threads); Loading
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLma.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -620,7 +620,7 @@ public class IntersceneLma { pure_weight = s_pure/full_weight; pure_weight = s_pure/full_weight; final double s = 1.0/asum_weight.sum(); final double s = 1.0/asum_weight.sum(); if (Double.isNaN(s)) { if (Double.isNaN(s)) { System.out.println("normalizeWeights(): s == NaN"); System.out.println("normalizeWeights(): s == NaN : 1"); } } ai.set(0); ai.set(0); for (int ithread = 0; ithread < threads.length; ithread++) { for (int ithread = 0; ithread < threads.length; ithread++) { Loading Loading @@ -673,7 +673,7 @@ public class IntersceneLma { pure_weight = sum_weight_pure/full_weight; pure_weight = sum_weight_pure/full_weight; final double s = 1.0/full_weight; final double s = 1.0/full_weight; if (Double.isNaN(s)) { if (Double.isNaN(s)) { System.out.println("normalizeWeights(): s == NaN"); System.out.println("normalizeWeights(): s == NaN : 2"); } } ai.set(0); ai.set(0); for (int ithread = 0; ithread < threads.length; ithread++) { for (int ithread = 0; ithread < threads.length; ithread++) { Loading