Loading src/main/java/com/elphel/imagej/tileprocessor/Corr2dLMA.java +39 −13 Original line number Original line Diff line number Diff line Loading @@ -1167,6 +1167,30 @@ public class Corr2dLMA { } } public double [][] getTileStats(){ double [] rms = getRmsTile(); double [][] maxmin_amp = getMaxMinAmpTile(); // double [][] maxmin_val = getMaxMinValTile(); double [][] abc = getABCTile(); double [][] tileStats = new double [numTiles][]; for (int tile = 0; tile < numTiles; tile++) if (!Double.isNaN(rms[tile]) && !Double.isNaN(maxmin_amp[tile][0])){ tileStats[tile] = new double[4]; double avg = 0.5*(maxmin_amp[tile][0]+maxmin_amp[tile][1]); double rrms = rms[tile]/avg; double strength = Math.sqrt(avg/rrms); double area = Double.NaN; if ((abc[tile][0] > 0.0) && (abc[tile][2] > 0.0)) { area = 1.0/abc[tile][0] + 1.0/abc[tile][2]; // area of a maximum } tileStats[tile][0] = rrms; tileStats[tile][1] = strength; tileStats[tile][2] = Math.max(abc[tile][0], abc[tile][2]); tileStats[tile][3] = area; } return tileStats; } public void printInputDataFx(boolean show_fx){ // not used in lwir public void printInputDataFx(boolean show_fx){ // not used in lwir if (show_fx) { if (show_fx) { Loading Loading @@ -1435,10 +1459,11 @@ public class Corr2dLMA { return rslt; return rslt; } } public double [][] disparityStrength( public double [][] lmaDisparityStrength( double lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) double lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) double lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) double lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) double lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) double lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) double lma_max_area, // maximal half-area (if > 0.0) double lma_str_scale, // convert lma-generated strength to match previous ones - scale double lma_str_scale, // convert lma-generated strength to match previous ones - scale double lma_str_offset // convert lma-generated strength to match previous ones - add to result double lma_str_offset // convert lma-generated strength to match previous ones - add to result ){ ){ Loading @@ -1447,21 +1472,31 @@ public class Corr2dLMA { double [][] maxmin_amp = getMaxMinAmpTile(); double [][] maxmin_amp = getMaxMinAmpTile(); double [][] abc = getABCTile(); double [][] abc = getABCTile(); for (int tile = 0; tile < numTiles; tile++) { for (int tile = 0; tile < numTiles; tile++) { if (Double.isNaN(maxmin_amp[tile][0])) { ds[tile][0] = Double.NaN; ds[tile][0] = Double.NaN; if (Double.isNaN(maxmin_amp[tile][0])) { continue; continue; } } double avg = 0.5*(maxmin_amp[tile][0]+maxmin_amp[tile][1]); double avg = 0.5*(maxmin_amp[tile][0]+maxmin_amp[tile][1]); double rrms = rms[tile]/avg; double rrms = rms[tile]/avg; if (((lma_max_rel_rms > 0.0) && (rrms > lma_max_rel_rms)) || if (((lma_max_rel_rms > 0.0) && (rrms > lma_max_rel_rms)) || (Math.max(abc[tile][0], abc[tile][2]) < lma_min_ac)) { (Math.max(abc[tile][0], abc[tile][2]) < lma_min_ac)) { ds[tile][0] = Double.NaN; continue; continue; } if (lma_max_area > 0) { if ((abc[tile][0] > 0.0) && (abc[tile][2] > 0.0)) { double area = 1.0/abc[tile][0] + 1.0/abc[tile][2]; // area of a maximum if (area > lma_max_area) { continue; // too wide maximum } } else { continue; // not a maximum } } } double strength = Math.sqrt(avg/rrms); double strength = Math.sqrt(avg/rrms); double disparity = -all_pars[DISP_INDEX + tile*TILE_PARAMS]; double disparity = -all_pars[DISP_INDEX + tile*TILE_PARAMS]; if ((strength < lma_min_strength) || Double.isNaN(disparity)) { if ((strength < lma_min_strength) || Double.isNaN(disparity)) { ds[tile][0] = Double.NaN; continue; continue; } } ds[tile][0] = disparity; ds[tile][0] = disparity; Loading Loading @@ -1716,15 +1751,6 @@ public class Corr2dLMA { return rslt; return rslt; } } /* try { this.SYNC_COMMAND.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } */ if (debug_level>2) { if (debug_level>2) { System.out.println("(JtJ + lambda*diag(JtJ).inv()"); System.out.println("(JtJ + lambda*diag(JtJ).inv()"); jtjl_inv.print(18, 6); jtjl_inv.print(18, 6); Loading src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java +14 −8 Original line number Original line Diff line number Diff line Loading @@ -1821,7 +1821,7 @@ public class Correlation2d { { { // corrs are organized as PAIRS, some are null if not used // corrs are organized as PAIRS, some are null if not used // for each enabled and available pair find a maximum, filter convex and create sample list // for each enabled and available pair find a maximum, filter convex and create sample list boolean debug_graphic = imgdtt_params.lma_debug_graphic; // (debug_level > -1) ; boolean debug_graphic = imgdtt_params.lma_debug_graphic && (debug_level > -1) ; // boolean debug_graphic = true; // boolean debug_graphic = true; // boolean debug_second_all = false; // true; // alse; // true; // boolean debug_second_all = false; // true; // alse; // true; int clust_height = corrs.length/clust_width; int clust_height = corrs.length/clust_width; Loading @@ -1831,6 +1831,9 @@ public class Correlation2d { int center = transform_size - 1; int center = transform_size - 1; int corr_size = 2 * transform_size - 1; int corr_size = 2 * transform_size - 1; // double [][] blur_max = new double [corrs.length][]; // double [][] blur_max = new double [corrs.length][]; if (debug_level > -2) { System.out.println("Debugging corrLMA2()// multi-tile"); } Corr2dLMA lma = new Corr2dLMA( Corr2dLMA lma = new Corr2dLMA( corrs.length, corrs.length, transform_size, transform_size, Loading Loading @@ -2024,10 +2027,11 @@ public class Correlation2d { } } // double [][] ds = lma.getDisparityStrength(); // double [][] ds = lma.getDisparityStrength(); ds = lma.disparityStrength( ds = lma.lmaDisparityStrength( imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result ); ); Loading Loading @@ -2121,10 +2125,11 @@ public class Correlation2d { lma.printInputDataFx(true); lma.printInputDataFx(true); } } // double [][] ds = lma.getDisparityStrength(); // double [][] ds = lma.getDisparityStrength(); ds = lma.disparityStrength( ds = lma.lmaDisparityStrength( imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result ); ); Loading Loading @@ -2217,8 +2222,8 @@ public class Correlation2d { boolean need_poly = (disp_str == null); // true; // find initial disparity by polynomial approximation boolean need_poly = (disp_str == null); // true; // find initial disparity by polynomial approximation boolean debug_graphic = imgdtt_params.lma_debug_graphic && (imgdtt_params.lma_debug_level1 > 3) && (debug_level > 0) ; boolean debug_graphic = imgdtt_params.lma_debug_graphic && (imgdtt_params.lma_debug_level1 > 3) && (debug_level > 0) ; String dbg_title = null; String dbg_title = null; // if (debug_graphic) { if (debug_graphic) { if (imgdtt_params.lma_debug_graphic) { // if (imgdtt_params.lma_debug_graphic) { dbg_title = String.format("tX%d_tY%d",tileX,tileY); dbg_title = String.format("tX%d_tY%d",tileX,tileY); } } DoubleGaussianBlur gb = null; DoubleGaussianBlur gb = null; Loading Loading @@ -2350,7 +2355,7 @@ public class Correlation2d { disp = lma.polyDisparity( disp = lma.polyDisparity( corr_wnd_inv_limited, corr_wnd_inv_limited, transform_size-1-imgdtt_params.lma_soft_marg,//double max_offset, // 5? transform_size-1-imgdtt_params.lma_soft_marg,//double max_offset, // 5? dbg_title); // double [] rslt = {-approx2d[0], approx2d[2], hwx, hwy}; debug_graphic?dbg_title:null); // double [] rslt = {-approx2d[0], approx2d[2], hwx, hwy}; if (disp == null) { if (disp == null) { if (debug_level > 0) { if (debug_level > 0) { Loading Loading @@ -2414,10 +2419,11 @@ public class Correlation2d { lma.updateFromVector(); lma.updateFromVector(); double [][] dispStr = lma.disparityStrength( double [][] dispStr = lma.lmaDisparityStrength( imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result ); ); Loading src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java +42 −14 Original line number Original line Diff line number Diff line Loading @@ -1867,7 +1867,7 @@ public class ImageDtt { disparity_array[tileY][tileX] + disparity_corr); disparity_array[tileY][tileX] + disparity_corr); } } if (((globalDebugLevel > 0) || debug_distort) && debugTile) { if (((globalDebugLevel > 0) || debug_distort) || debugTile) { for (int i = 0; i < quad; i++) { for (int i = 0; i < quad; i++) { System.out.println("clt_aberrations_quad_corr(): tileX="+tileX+", tileY="+tileY+ System.out.println("clt_aberrations_quad_corr(): tileX="+tileX+", tileY="+tileY+ " centerX="+centerX+" centerY="+centerY+" disparity="+disparity_array[tileY][tileX]+ " centerX="+centerX+" centerY="+centerY+" disparity="+disparity_array[tileY][tileX]+ Loading @@ -1884,7 +1884,7 @@ public class ImageDtt { centersXY[cTile][i][0] += debug_offsets_xy[i][0]; centersXY[cTile][i][0] += debug_offsets_xy[i][0]; centersXY[cTile][i][1] += debug_offsets_xy[i][1]; centersXY[cTile][i][1] += debug_offsets_xy[i][1]; } } if (debug_distort && debugCluster) { if ((debug_distort && debugCluster) || debugTile) { for (int i = 0; i < quad; i++) { for (int i = 0; i < quad; i++) { System.out.println(String.format("%d: {%8.3f, %8.3f}",i,debug_offsets_xy[i][0],debug_offsets_xy[i][1])); System.out.println(String.format("%d: {%8.3f, %8.3f}",i,debug_offsets_xy[i][0],debug_offsets_xy[i][1])); } } Loading Loading @@ -2114,10 +2114,11 @@ public class ImageDtt { disparity_map[DISPARITY_INDEX_HOR][tIndex] = poly_disp[0]; disparity_map[DISPARITY_INDEX_HOR][tIndex] = poly_disp[0]; disparity_map[DISPARITY_INDEX_HOR_STRENGTH][tIndex] = poly_disp[1]; disparity_map[DISPARITY_INDEX_HOR_STRENGTH][tIndex] = poly_disp[1]; if (lma2 != null) { if (lma2 != null) { disp_str[cTile] = lma2.disparityStrength( disp_str[cTile] = lma2.lmaDisparityStrength( imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result )[0]; )[0]; Loading Loading @@ -2165,12 +2166,14 @@ public class ImageDtt { if (lma2 != null) { if (lma2 != null) { double [][] ddnd = lma2.getDdNd(); double [][] ddnd = lma2.getDdNd(); double [] stats = lma2.getStats(); double [] stats = lma2.getStats(); double [][] lma2_ds = lma2.disparityStrength( double [][] lma2_ds = lma2.lmaDisparityStrength( imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset); // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset); // convert lma-generated strength to match previous ones - add to result double [][] extra_stats = lma2.getTileStats(); for (int cTileY = 0; cTileY < tileStep; cTileY++) { for (int cTileY = 0; cTileY < tileStep; cTileY++) { tileY = clustY * tileStep + cTileY ; tileY = clustY * tileStep + cTileY ; if (tileY < tilesY) { if (tileY < tilesY) { Loading @@ -2182,9 +2185,16 @@ public class ImageDtt { // int nTile = tileY * tilesX + tileX; // how is it different from tIndex? // int nTile = tileY * tilesX + tileX; // how is it different from tIndex? for (int cam = 0; cam < ddnd.length; cam++) { for (int cam = 0; cam < ddnd.length; cam++) { if (ddnd[cam] != null) { if (ddnd[cam] != null) { if (imgdtt_params.lma_diff_xy) { clt_mismatch[3*cam + 0][tIndex] = ddnd[cam][0] * rXY[cam][0] - ddnd[cam][1] * rXY[cam][1]; clt_mismatch[3*cam + 1][tIndex] = ddnd[cam][0] * rXY[cam][1] + ddnd[cam][1] * rXY[cam][0]; } else { clt_mismatch[3*cam + 0][tIndex] = ddnd[cam][0]; clt_mismatch[3*cam + 0][tIndex] = ddnd[cam][0]; clt_mismatch[3*cam + 1][tIndex] = ddnd[cam][1]; clt_mismatch[3*cam + 1][tIndex] = ddnd[cam][1]; } } } if (stats != null) { if (stats != null) { disparity_map[IMG_DIFF0_INDEX+0][tIndex] = stats[0]; disparity_map[IMG_DIFF0_INDEX+0][tIndex] = stats[0]; disparity_map[IMG_DIFF0_INDEX+1][tIndex] = stats[1]; disparity_map[IMG_DIFF0_INDEX+1][tIndex] = stats[1]; Loading @@ -2194,6 +2204,25 @@ public class ImageDtt { if ((lma2_ds != null) && ((lma2_ds[cTile] != null))) { if ((lma2_ds != null) && ((lma2_ds[cTile] != null))) { disparity_map[DISPARITY_INDEX_VERT][tIndex] = lma2_ds[cTile][0]; disparity_map[DISPARITY_INDEX_VERT][tIndex] = lma2_ds[cTile][0]; disparity_map[DISPARITY_INDEX_VERT_STRENGTH][tIndex] = lma2_ds[cTile][1]; disparity_map[DISPARITY_INDEX_VERT_STRENGTH][tIndex] = lma2_ds[cTile][1]; clt_mismatch[3*0 + 2][tIndex] = lma2_ds[cTile][1]; } } if (extra_stats != null) { if (extra_stats[cTile] != null) { disparity_map[DISPARITY_INDEX_CM+1][tIndex] = extra_stats[cTile][0]; disparity_map[DISPARITY_VARIATIONS_INDEX][tIndex] = extra_stats[cTile][2]; disparity_map[OVEREXPOSED][tIndex] = extra_stats[cTile][3]; clt_mismatch[3*1 + 2][tIndex] = extra_stats[cTile][0]; clt_mismatch[3*2 + 2][tIndex] = extra_stats[cTile][2]; clt_mismatch[3*3 + 2][tIndex] = extra_stats[cTile][3]; } else { disparity_map[DISPARITY_INDEX_CM+1][tIndex] = Double.NaN; disparity_map[DISPARITY_VARIATIONS_INDEX][tIndex] = Double.NaN; disparity_map[OVEREXPOSED][tIndex] = Double.NaN; clt_mismatch[3*1 + 2][tIndex] = Double.NaN; clt_mismatch[3*2 + 2][tIndex] = Double.NaN; clt_mismatch[3*3 + 2][tIndex] = Double.NaN; } } } } } } Loading @@ -2202,9 +2231,7 @@ public class ImageDtt { } } } } } } } } } } }; }; } } Loading Loading @@ -3073,10 +3100,11 @@ public class ImageDtt { tileY ); // int tileY tileY ); // int tileY double [][] ds = null; double [][] ds = null; if (lma2 != null) { if (lma2 != null) { ds = lma2.disparityStrength( ds = lma2.lmaDisparityStrength( imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result ); ); Loading src/main/java/com/elphel/imagej/tileprocessor/ImageDttParameters.java +24 −9 Original line number Original line Diff line number Diff line Loading @@ -115,6 +115,7 @@ public class ImageDttParameters { public double lmas_max_rel_rms = 0.2; // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) public double lmas_max_rel_rms = 0.2; // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) public double lmas_min_strength = 1.0; // minimal composite strength (sqrt(average amp squared over absolute RMS) public double lmas_min_strength = 1.0; // minimal composite strength (sqrt(average amp squared over absolute RMS) public double lmas_min_ac = 0.03; // minimal of a and C coefficients maximum (measures sharpest point/line) public double lmas_min_ac = 0.03; // minimal of a and C coefficients maximum (measures sharpest point/line) public double lmas_max_area = 0.0; // maximal half-area (if > 0.0) public boolean lma_gaussian = false; // model correlation maximum as a Gaussian (false - as a parabola) public boolean lma_gaussian = false; // model correlation maximum as a Gaussian (false - as a parabola) public boolean lma_second = false; // re-run LMA after removing weak/failed tiles public boolean lma_second = false; // re-run LMA after removing weak/failed tiles Loading Loading @@ -149,9 +150,10 @@ public class ImageDttParameters { public double lma_rms_diff = 0.001; // public double lma_rms_diff = 0.001; // public int lma_num_iter = 20; // public int lma_num_iter = 20; // // Filtering and strength calculation // Filtering and strength calculation public double lma_max_rel_rms = 0.2; // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) public double lma_max_rel_rms = 0.12; // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) public double lma_min_strength = 1.0; // minimal composite strength (sqrt(average amp squared over absolute RMS) public double lma_min_strength = 1.25; // minimal composite strength (sqrt(average amp squared over absolute RMS) public double lma_min_ac = 0.03; // minimal of a and C coefficients maximum (measures sharpest point/line) public double lma_min_ac = 0.15; // minimal of a and C coefficients maximum (measures sharpest point/line) public double lma_max_area = 30.0; // maximal half-area (if > 0.0) public double lma_str_scale = 0.2; // convert lma-generated strength to match previous ones - scale public double lma_str_scale = 0.2; // convert lma-generated strength to match previous ones - scale public double lma_str_offset = 0.05; // convert lma-generated strength to match previous ones - add to result public double lma_str_offset = 0.05; // convert lma-generated strength to match previous ones - add to result Loading Loading @@ -340,6 +342,8 @@ public class ImageDttParameters { "Discard tile if composite strength (average amplitude over SQRT of RMS) is below"); "Discard tile if composite strength (average amplitude over SQRT of RMS) is below"); gd.addNumericField("Minimal max (A,C)", this.lmas_min_ac, 6, 8, "", gd.addNumericField("Minimal max (A,C)", this.lmas_min_ac, 6, 8, "", "Minimal value of max (A,C) coefficients to keep the tile (measures sharpest point/line correlation maximum)"); "Minimal value of max (A,C) coefficients to keep the tile (measures sharpest point/line correlation maximum)"); gd.addNumericField("Maximal area", this.lmas_max_area, 6, 8, "sq.pix", "Maximal product of maximum half-width by half-height, ignore check if <=0"); gd.addMessage("Multi-tile (for lazy eye) LMA (some are used for with single-tile mode too)"); gd.addMessage("Multi-tile (for lazy eye) LMA (some are used for with single-tile mode too)"); gd.addCheckbox ("Correlation maximum as gaussian", this.lma_gaussian, gd.addCheckbox ("Correlation maximum as gaussian", this.lma_gaussian, Loading Loading @@ -403,6 +407,8 @@ public class ImageDttParameters { "Discard tile if composite strength (average amplitude over SQRT of RMS) is below"); "Discard tile if composite strength (average amplitude over SQRT of RMS) is below"); gd.addNumericField("Minimal max (A,C)", this.lma_min_ac, 6, 8, "", gd.addNumericField("Minimal max (A,C)", this.lma_min_ac, 6, 8, "", "Minimal value of max (A,C) coefficients to keep the tile (measures sharpest point/line correlation maximum)"); "Minimal value of max (A,C) coefficients to keep the tile (measures sharpest point/line correlation maximum)"); gd.addNumericField("Maximal area", this.lma_max_area, 6, 8, "sq.pix", "Maximal product of maximum half-width by half-height, ignore check if <=0"); gd.addMessage("Correlation strength calculation (match legacy)"); gd.addMessage("Correlation strength calculation (match legacy)"); gd.addNumericField("Composite correlation strength scale", this.lma_str_scale, 6, 8, "", gd.addNumericField("Composite correlation strength scale", this.lma_str_scale, 6, 8, "", Loading Loading @@ -541,6 +547,7 @@ public class ImageDttParameters { this.lmas_max_rel_rms = gd.getNextNumber(); this.lmas_max_rel_rms = gd.getNextNumber(); this.lmas_min_strength = gd.getNextNumber(); this.lmas_min_strength = gd.getNextNumber(); this.lmas_min_ac = gd.getNextNumber(); this.lmas_min_ac = gd.getNextNumber(); this.lmas_max_area = gd.getNextNumber(); this.lma_gaussian= gd.getNextBoolean(); this.lma_gaussian= gd.getNextBoolean(); this.lma_second= gd.getNextBoolean(); this.lma_second= gd.getNextBoolean(); Loading Loading @@ -573,6 +580,8 @@ public class ImageDttParameters { this.lma_max_rel_rms = gd.getNextNumber(); this.lma_max_rel_rms = gd.getNextNumber(); this.lma_min_strength = gd.getNextNumber(); this.lma_min_strength = gd.getNextNumber(); this.lma_min_ac = gd.getNextNumber(); this.lma_min_ac = gd.getNextNumber(); this.lma_max_area = gd.getNextNumber(); this.lma_str_scale = gd.getNextNumber(); this.lma_str_scale = gd.getNextNumber(); this.lma_str_offset = gd.getNextNumber(); this.lma_str_offset = gd.getNextNumber(); Loading Loading @@ -674,6 +683,7 @@ public class ImageDttParameters { properties.setProperty(prefix+"lmas_max_rel_rms", this.lmas_max_rel_rms +""); properties.setProperty(prefix+"lmas_max_rel_rms", this.lmas_max_rel_rms +""); properties.setProperty(prefix+"lmas_min_strength", this.lmas_min_strength +""); properties.setProperty(prefix+"lmas_min_strength", this.lmas_min_strength +""); properties.setProperty(prefix+"lmas_min_ac", this.lmas_min_ac +""); properties.setProperty(prefix+"lmas_min_ac", this.lmas_min_ac +""); properties.setProperty(prefix+"lmas_max_area", this.lmas_max_area +""); properties.setProperty(prefix+"lma_gaussian", this.lma_gaussian +""); properties.setProperty(prefix+"lma_gaussian", this.lma_gaussian +""); properties.setProperty(prefix+"lma_second", this.lma_second +""); properties.setProperty(prefix+"lma_second", this.lma_second +""); Loading Loading @@ -707,6 +717,7 @@ public class ImageDttParameters { properties.setProperty(prefix+"lma_max_rel_rms", this.lma_max_rel_rms +""); properties.setProperty(prefix+"lma_max_rel_rms", this.lma_max_rel_rms +""); properties.setProperty(prefix+"lma_min_strength", this.lma_min_strength +""); properties.setProperty(prefix+"lma_min_strength", this.lma_min_strength +""); properties.setProperty(prefix+"lma_min_ac", this.lma_min_ac +""); properties.setProperty(prefix+"lma_min_ac", this.lma_min_ac +""); properties.setProperty(prefix+"lma_max_area", this.lma_max_area +""); properties.setProperty(prefix+"lma_str_scale", this.lma_str_scale +""); properties.setProperty(prefix+"lma_str_scale", this.lma_str_scale +""); properties.setProperty(prefix+"lma_str_offset", this.lma_str_offset +""); properties.setProperty(prefix+"lma_str_offset", this.lma_str_offset +""); Loading Loading @@ -814,6 +825,7 @@ public class ImageDttParameters { if (properties.getProperty(prefix+"lmas_max_rel_rms")!=null) this.lmas_max_rel_rms=Double.parseDouble(properties.getProperty(prefix+"lmas_max_rel_rms")); if (properties.getProperty(prefix+"lmas_max_rel_rms")!=null) this.lmas_max_rel_rms=Double.parseDouble(properties.getProperty(prefix+"lmas_max_rel_rms")); if (properties.getProperty(prefix+"lmas_min_strength")!=null) this.lmas_min_strength=Double.parseDouble(properties.getProperty(prefix+"lmas_min_strength")); if (properties.getProperty(prefix+"lmas_min_strength")!=null) this.lmas_min_strength=Double.parseDouble(properties.getProperty(prefix+"lmas_min_strength")); if (properties.getProperty(prefix+"lmas_min_ac")!=null) this.lmas_min_ac=Double.parseDouble(properties.getProperty(prefix+"lmas_min_ac")); if (properties.getProperty(prefix+"lmas_min_ac")!=null) this.lmas_min_ac=Double.parseDouble(properties.getProperty(prefix+"lmas_min_ac")); if (properties.getProperty(prefix+"lmas_max_area")!=null) this.lmas_max_area=Double.parseDouble(properties.getProperty(prefix+"lmas_max_area")); if (properties.getProperty(prefix+"lma_gaussian")!=null) this.lma_gaussian=Boolean.parseBoolean(properties.getProperty(prefix+"lma_gaussian")); if (properties.getProperty(prefix+"lma_gaussian")!=null) this.lma_gaussian=Boolean.parseBoolean(properties.getProperty(prefix+"lma_gaussian")); if (properties.getProperty(prefix+"lma_second")!=null) this.lma_second=Boolean.parseBoolean(properties.getProperty(prefix+"lma_second")); if (properties.getProperty(prefix+"lma_second")!=null) this.lma_second=Boolean.parseBoolean(properties.getProperty(prefix+"lma_second")); Loading Loading @@ -845,6 +857,7 @@ public class ImageDttParameters { if (properties.getProperty(prefix+"lma_max_rel_rms")!=null) this.lma_max_rel_rms=Double.parseDouble(properties.getProperty(prefix+"lma_max_rel_rms")); if (properties.getProperty(prefix+"lma_max_rel_rms")!=null) this.lma_max_rel_rms=Double.parseDouble(properties.getProperty(prefix+"lma_max_rel_rms")); if (properties.getProperty(prefix+"lma_min_strength")!=null) this.lma_min_strength=Double.parseDouble(properties.getProperty(prefix+"lma_min_strength")); if (properties.getProperty(prefix+"lma_min_strength")!=null) this.lma_min_strength=Double.parseDouble(properties.getProperty(prefix+"lma_min_strength")); if (properties.getProperty(prefix+"lma_min_ac")!=null) this.lma_min_ac=Double.parseDouble(properties.getProperty(prefix+"lma_min_ac")); if (properties.getProperty(prefix+"lma_min_ac")!=null) this.lma_min_ac=Double.parseDouble(properties.getProperty(prefix+"lma_min_ac")); if (properties.getProperty(prefix+"lma_max_area")!=null) this.lma_max_area=Double.parseDouble(properties.getProperty(prefix+"lma_max_area")); if (properties.getProperty(prefix+"lma_str_scale")!=null) this.lma_str_scale=Double.parseDouble(properties.getProperty(prefix+"lma_str_scale")); if (properties.getProperty(prefix+"lma_str_scale")!=null) this.lma_str_scale=Double.parseDouble(properties.getProperty(prefix+"lma_str_scale")); if (properties.getProperty(prefix+"lma_str_offset")!=null) this.lma_str_offset=Double.parseDouble(properties.getProperty(prefix+"lma_str_offset")); if (properties.getProperty(prefix+"lma_str_offset")!=null) this.lma_str_offset=Double.parseDouble(properties.getProperty(prefix+"lma_str_offset")); Loading Loading @@ -943,12 +956,13 @@ public class ImageDttParameters { idp.lmas_poly_str_scale = this.lmas_poly_str_scale; idp.lmas_poly_str_scale = this.lmas_poly_str_scale; idp.lmas_poly_str_min = this.lmas_poly_str_min; idp.lmas_poly_str_min = this.lmas_poly_str_min; idp.lmas_lambda_initial = this.lma_lambda_initial; idp.lmas_lambda_initial = this.lmas_lambda_initial; idp.lmas_rms_diff = this.lma_rms_diff; idp.lmas_rms_diff = this.lmas_rms_diff; idp.lmas_num_iter = this.lma_num_iter; idp.lmas_num_iter = this.lmas_num_iter; idp.lmas_max_rel_rms= this.lma_max_rel_rms; idp.lmas_max_rel_rms= this.lmas_max_rel_rms; idp.lmas_min_strength= this.lma_min_strength; idp.lmas_min_strength= this.lmas_min_strength; idp.lmas_min_ac= this.lma_min_ac; idp.lmas_min_ac= this.lmas_min_ac; idp.lmas_max_area= this.lmas_max_area; idp.lma_gaussian = this.lma_gaussian; idp.lma_gaussian = this.lma_gaussian; idp.lma_second = this.lma_second; idp.lma_second = this.lma_second; Loading Loading @@ -980,6 +994,7 @@ public class ImageDttParameters { idp.lma_max_rel_rms= this.lma_max_rel_rms; idp.lma_max_rel_rms= this.lma_max_rel_rms; idp.lma_min_strength= this.lma_min_strength; idp.lma_min_strength= this.lma_min_strength; idp.lma_min_ac= this.lma_min_ac; idp.lma_min_ac= this.lma_min_ac; idp.lma_max_area= this.lma_max_area; idp.lma_str_scale= this.lma_str_scale; idp.lma_str_scale= this.lma_str_scale; idp.lma_str_offset= this.lma_str_offset; idp.lma_str_offset= this.lma_str_offset; Loading src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java +36 −6 File changed.Preview size limit exceeded, changes collapsed. Show changes src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java +1 −1 File changed.Contains only whitespace changes. Show changes Loading
src/main/java/com/elphel/imagej/tileprocessor/Corr2dLMA.java +39 −13 Original line number Original line Diff line number Diff line Loading @@ -1167,6 +1167,30 @@ public class Corr2dLMA { } } public double [][] getTileStats(){ double [] rms = getRmsTile(); double [][] maxmin_amp = getMaxMinAmpTile(); // double [][] maxmin_val = getMaxMinValTile(); double [][] abc = getABCTile(); double [][] tileStats = new double [numTiles][]; for (int tile = 0; tile < numTiles; tile++) if (!Double.isNaN(rms[tile]) && !Double.isNaN(maxmin_amp[tile][0])){ tileStats[tile] = new double[4]; double avg = 0.5*(maxmin_amp[tile][0]+maxmin_amp[tile][1]); double rrms = rms[tile]/avg; double strength = Math.sqrt(avg/rrms); double area = Double.NaN; if ((abc[tile][0] > 0.0) && (abc[tile][2] > 0.0)) { area = 1.0/abc[tile][0] + 1.0/abc[tile][2]; // area of a maximum } tileStats[tile][0] = rrms; tileStats[tile][1] = strength; tileStats[tile][2] = Math.max(abc[tile][0], abc[tile][2]); tileStats[tile][3] = area; } return tileStats; } public void printInputDataFx(boolean show_fx){ // not used in lwir public void printInputDataFx(boolean show_fx){ // not used in lwir if (show_fx) { if (show_fx) { Loading Loading @@ -1435,10 +1459,11 @@ public class Corr2dLMA { return rslt; return rslt; } } public double [][] disparityStrength( public double [][] lmaDisparityStrength( double lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) double lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) double lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) double lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) double lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) double lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) double lma_max_area, // maximal half-area (if > 0.0) double lma_str_scale, // convert lma-generated strength to match previous ones - scale double lma_str_scale, // convert lma-generated strength to match previous ones - scale double lma_str_offset // convert lma-generated strength to match previous ones - add to result double lma_str_offset // convert lma-generated strength to match previous ones - add to result ){ ){ Loading @@ -1447,21 +1472,31 @@ public class Corr2dLMA { double [][] maxmin_amp = getMaxMinAmpTile(); double [][] maxmin_amp = getMaxMinAmpTile(); double [][] abc = getABCTile(); double [][] abc = getABCTile(); for (int tile = 0; tile < numTiles; tile++) { for (int tile = 0; tile < numTiles; tile++) { if (Double.isNaN(maxmin_amp[tile][0])) { ds[tile][0] = Double.NaN; ds[tile][0] = Double.NaN; if (Double.isNaN(maxmin_amp[tile][0])) { continue; continue; } } double avg = 0.5*(maxmin_amp[tile][0]+maxmin_amp[tile][1]); double avg = 0.5*(maxmin_amp[tile][0]+maxmin_amp[tile][1]); double rrms = rms[tile]/avg; double rrms = rms[tile]/avg; if (((lma_max_rel_rms > 0.0) && (rrms > lma_max_rel_rms)) || if (((lma_max_rel_rms > 0.0) && (rrms > lma_max_rel_rms)) || (Math.max(abc[tile][0], abc[tile][2]) < lma_min_ac)) { (Math.max(abc[tile][0], abc[tile][2]) < lma_min_ac)) { ds[tile][0] = Double.NaN; continue; continue; } if (lma_max_area > 0) { if ((abc[tile][0] > 0.0) && (abc[tile][2] > 0.0)) { double area = 1.0/abc[tile][0] + 1.0/abc[tile][2]; // area of a maximum if (area > lma_max_area) { continue; // too wide maximum } } else { continue; // not a maximum } } } double strength = Math.sqrt(avg/rrms); double strength = Math.sqrt(avg/rrms); double disparity = -all_pars[DISP_INDEX + tile*TILE_PARAMS]; double disparity = -all_pars[DISP_INDEX + tile*TILE_PARAMS]; if ((strength < lma_min_strength) || Double.isNaN(disparity)) { if ((strength < lma_min_strength) || Double.isNaN(disparity)) { ds[tile][0] = Double.NaN; continue; continue; } } ds[tile][0] = disparity; ds[tile][0] = disparity; Loading Loading @@ -1716,15 +1751,6 @@ public class Corr2dLMA { return rslt; return rslt; } } /* try { this.SYNC_COMMAND.wait(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } */ if (debug_level>2) { if (debug_level>2) { System.out.println("(JtJ + lambda*diag(JtJ).inv()"); System.out.println("(JtJ + lambda*diag(JtJ).inv()"); jtjl_inv.print(18, 6); jtjl_inv.print(18, 6); Loading
src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java +14 −8 Original line number Original line Diff line number Diff line Loading @@ -1821,7 +1821,7 @@ public class Correlation2d { { { // corrs are organized as PAIRS, some are null if not used // corrs are organized as PAIRS, some are null if not used // for each enabled and available pair find a maximum, filter convex and create sample list // for each enabled and available pair find a maximum, filter convex and create sample list boolean debug_graphic = imgdtt_params.lma_debug_graphic; // (debug_level > -1) ; boolean debug_graphic = imgdtt_params.lma_debug_graphic && (debug_level > -1) ; // boolean debug_graphic = true; // boolean debug_graphic = true; // boolean debug_second_all = false; // true; // alse; // true; // boolean debug_second_all = false; // true; // alse; // true; int clust_height = corrs.length/clust_width; int clust_height = corrs.length/clust_width; Loading @@ -1831,6 +1831,9 @@ public class Correlation2d { int center = transform_size - 1; int center = transform_size - 1; int corr_size = 2 * transform_size - 1; int corr_size = 2 * transform_size - 1; // double [][] blur_max = new double [corrs.length][]; // double [][] blur_max = new double [corrs.length][]; if (debug_level > -2) { System.out.println("Debugging corrLMA2()// multi-tile"); } Corr2dLMA lma = new Corr2dLMA( Corr2dLMA lma = new Corr2dLMA( corrs.length, corrs.length, transform_size, transform_size, Loading Loading @@ -2024,10 +2027,11 @@ public class Correlation2d { } } // double [][] ds = lma.getDisparityStrength(); // double [][] ds = lma.getDisparityStrength(); ds = lma.disparityStrength( ds = lma.lmaDisparityStrength( imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result ); ); Loading Loading @@ -2121,10 +2125,11 @@ public class Correlation2d { lma.printInputDataFx(true); lma.printInputDataFx(true); } } // double [][] ds = lma.getDisparityStrength(); // double [][] ds = lma.getDisparityStrength(); ds = lma.disparityStrength( ds = lma.lmaDisparityStrength( imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result ); ); Loading Loading @@ -2217,8 +2222,8 @@ public class Correlation2d { boolean need_poly = (disp_str == null); // true; // find initial disparity by polynomial approximation boolean need_poly = (disp_str == null); // true; // find initial disparity by polynomial approximation boolean debug_graphic = imgdtt_params.lma_debug_graphic && (imgdtt_params.lma_debug_level1 > 3) && (debug_level > 0) ; boolean debug_graphic = imgdtt_params.lma_debug_graphic && (imgdtt_params.lma_debug_level1 > 3) && (debug_level > 0) ; String dbg_title = null; String dbg_title = null; // if (debug_graphic) { if (debug_graphic) { if (imgdtt_params.lma_debug_graphic) { // if (imgdtt_params.lma_debug_graphic) { dbg_title = String.format("tX%d_tY%d",tileX,tileY); dbg_title = String.format("tX%d_tY%d",tileX,tileY); } } DoubleGaussianBlur gb = null; DoubleGaussianBlur gb = null; Loading Loading @@ -2350,7 +2355,7 @@ public class Correlation2d { disp = lma.polyDisparity( disp = lma.polyDisparity( corr_wnd_inv_limited, corr_wnd_inv_limited, transform_size-1-imgdtt_params.lma_soft_marg,//double max_offset, // 5? transform_size-1-imgdtt_params.lma_soft_marg,//double max_offset, // 5? dbg_title); // double [] rslt = {-approx2d[0], approx2d[2], hwx, hwy}; debug_graphic?dbg_title:null); // double [] rslt = {-approx2d[0], approx2d[2], hwx, hwy}; if (disp == null) { if (disp == null) { if (debug_level > 0) { if (debug_level > 0) { Loading Loading @@ -2414,10 +2419,11 @@ public class Correlation2d { lma.updateFromVector(); lma.updateFromVector(); double [][] dispStr = lma.disparityStrength( double [][] dispStr = lma.lmaDisparityStrength( imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result ); ); Loading
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java +42 −14 Original line number Original line Diff line number Diff line Loading @@ -1867,7 +1867,7 @@ public class ImageDtt { disparity_array[tileY][tileX] + disparity_corr); disparity_array[tileY][tileX] + disparity_corr); } } if (((globalDebugLevel > 0) || debug_distort) && debugTile) { if (((globalDebugLevel > 0) || debug_distort) || debugTile) { for (int i = 0; i < quad; i++) { for (int i = 0; i < quad; i++) { System.out.println("clt_aberrations_quad_corr(): tileX="+tileX+", tileY="+tileY+ System.out.println("clt_aberrations_quad_corr(): tileX="+tileX+", tileY="+tileY+ " centerX="+centerX+" centerY="+centerY+" disparity="+disparity_array[tileY][tileX]+ " centerX="+centerX+" centerY="+centerY+" disparity="+disparity_array[tileY][tileX]+ Loading @@ -1884,7 +1884,7 @@ public class ImageDtt { centersXY[cTile][i][0] += debug_offsets_xy[i][0]; centersXY[cTile][i][0] += debug_offsets_xy[i][0]; centersXY[cTile][i][1] += debug_offsets_xy[i][1]; centersXY[cTile][i][1] += debug_offsets_xy[i][1]; } } if (debug_distort && debugCluster) { if ((debug_distort && debugCluster) || debugTile) { for (int i = 0; i < quad; i++) { for (int i = 0; i < quad; i++) { System.out.println(String.format("%d: {%8.3f, %8.3f}",i,debug_offsets_xy[i][0],debug_offsets_xy[i][1])); System.out.println(String.format("%d: {%8.3f, %8.3f}",i,debug_offsets_xy[i][0],debug_offsets_xy[i][1])); } } Loading Loading @@ -2114,10 +2114,11 @@ public class ImageDtt { disparity_map[DISPARITY_INDEX_HOR][tIndex] = poly_disp[0]; disparity_map[DISPARITY_INDEX_HOR][tIndex] = poly_disp[0]; disparity_map[DISPARITY_INDEX_HOR_STRENGTH][tIndex] = poly_disp[1]; disparity_map[DISPARITY_INDEX_HOR_STRENGTH][tIndex] = poly_disp[1]; if (lma2 != null) { if (lma2 != null) { disp_str[cTile] = lma2.disparityStrength( disp_str[cTile] = lma2.lmaDisparityStrength( imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result )[0]; )[0]; Loading Loading @@ -2165,12 +2166,14 @@ public class ImageDtt { if (lma2 != null) { if (lma2 != null) { double [][] ddnd = lma2.getDdNd(); double [][] ddnd = lma2.getDdNd(); double [] stats = lma2.getStats(); double [] stats = lma2.getStats(); double [][] lma2_ds = lma2.disparityStrength( double [][] lma2_ds = lma2.lmaDisparityStrength( imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lma_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset); // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset); // convert lma-generated strength to match previous ones - add to result double [][] extra_stats = lma2.getTileStats(); for (int cTileY = 0; cTileY < tileStep; cTileY++) { for (int cTileY = 0; cTileY < tileStep; cTileY++) { tileY = clustY * tileStep + cTileY ; tileY = clustY * tileStep + cTileY ; if (tileY < tilesY) { if (tileY < tilesY) { Loading @@ -2182,9 +2185,16 @@ public class ImageDtt { // int nTile = tileY * tilesX + tileX; // how is it different from tIndex? // int nTile = tileY * tilesX + tileX; // how is it different from tIndex? for (int cam = 0; cam < ddnd.length; cam++) { for (int cam = 0; cam < ddnd.length; cam++) { if (ddnd[cam] != null) { if (ddnd[cam] != null) { if (imgdtt_params.lma_diff_xy) { clt_mismatch[3*cam + 0][tIndex] = ddnd[cam][0] * rXY[cam][0] - ddnd[cam][1] * rXY[cam][1]; clt_mismatch[3*cam + 1][tIndex] = ddnd[cam][0] * rXY[cam][1] + ddnd[cam][1] * rXY[cam][0]; } else { clt_mismatch[3*cam + 0][tIndex] = ddnd[cam][0]; clt_mismatch[3*cam + 0][tIndex] = ddnd[cam][0]; clt_mismatch[3*cam + 1][tIndex] = ddnd[cam][1]; clt_mismatch[3*cam + 1][tIndex] = ddnd[cam][1]; } } } if (stats != null) { if (stats != null) { disparity_map[IMG_DIFF0_INDEX+0][tIndex] = stats[0]; disparity_map[IMG_DIFF0_INDEX+0][tIndex] = stats[0]; disparity_map[IMG_DIFF0_INDEX+1][tIndex] = stats[1]; disparity_map[IMG_DIFF0_INDEX+1][tIndex] = stats[1]; Loading @@ -2194,6 +2204,25 @@ public class ImageDtt { if ((lma2_ds != null) && ((lma2_ds[cTile] != null))) { if ((lma2_ds != null) && ((lma2_ds[cTile] != null))) { disparity_map[DISPARITY_INDEX_VERT][tIndex] = lma2_ds[cTile][0]; disparity_map[DISPARITY_INDEX_VERT][tIndex] = lma2_ds[cTile][0]; disparity_map[DISPARITY_INDEX_VERT_STRENGTH][tIndex] = lma2_ds[cTile][1]; disparity_map[DISPARITY_INDEX_VERT_STRENGTH][tIndex] = lma2_ds[cTile][1]; clt_mismatch[3*0 + 2][tIndex] = lma2_ds[cTile][1]; } } if (extra_stats != null) { if (extra_stats[cTile] != null) { disparity_map[DISPARITY_INDEX_CM+1][tIndex] = extra_stats[cTile][0]; disparity_map[DISPARITY_VARIATIONS_INDEX][tIndex] = extra_stats[cTile][2]; disparity_map[OVEREXPOSED][tIndex] = extra_stats[cTile][3]; clt_mismatch[3*1 + 2][tIndex] = extra_stats[cTile][0]; clt_mismatch[3*2 + 2][tIndex] = extra_stats[cTile][2]; clt_mismatch[3*3 + 2][tIndex] = extra_stats[cTile][3]; } else { disparity_map[DISPARITY_INDEX_CM+1][tIndex] = Double.NaN; disparity_map[DISPARITY_VARIATIONS_INDEX][tIndex] = Double.NaN; disparity_map[OVEREXPOSED][tIndex] = Double.NaN; clt_mismatch[3*1 + 2][tIndex] = Double.NaN; clt_mismatch[3*2 + 2][tIndex] = Double.NaN; clt_mismatch[3*3 + 2][tIndex] = Double.NaN; } } } } } } Loading @@ -2202,9 +2231,7 @@ public class ImageDtt { } } } } } } } } } } }; }; } } Loading Loading @@ -3073,10 +3100,11 @@ public class ImageDtt { tileY ); // int tileY tileY ); // int tileY double [][] ds = null; double [][] ds = null; if (lma2 != null) { if (lma2 != null) { ds = lma2.disparityStrength( ds = lma2.lmaDisparityStrength( imgdtt_params.lma_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lmas_max_rel_rms, // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) imgdtt_params.lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lmas_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS) imgdtt_params.lma_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_min_ac, // minimal of A and C coefficients maximum (measures sharpest point/line) imgdtt_params.lmas_max_area, //double lma_max_area, // maximal half-area (if > 0.0) imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result imgdtt_params.lma_str_offset // convert lma-generated strength to match previous ones - add to result ); ); Loading
src/main/java/com/elphel/imagej/tileprocessor/ImageDttParameters.java +24 −9 Original line number Original line Diff line number Diff line Loading @@ -115,6 +115,7 @@ public class ImageDttParameters { public double lmas_max_rel_rms = 0.2; // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) public double lmas_max_rel_rms = 0.2; // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) public double lmas_min_strength = 1.0; // minimal composite strength (sqrt(average amp squared over absolute RMS) public double lmas_min_strength = 1.0; // minimal composite strength (sqrt(average amp squared over absolute RMS) public double lmas_min_ac = 0.03; // minimal of a and C coefficients maximum (measures sharpest point/line) public double lmas_min_ac = 0.03; // minimal of a and C coefficients maximum (measures sharpest point/line) public double lmas_max_area = 0.0; // maximal half-area (if > 0.0) public boolean lma_gaussian = false; // model correlation maximum as a Gaussian (false - as a parabola) public boolean lma_gaussian = false; // model correlation maximum as a Gaussian (false - as a parabola) public boolean lma_second = false; // re-run LMA after removing weak/failed tiles public boolean lma_second = false; // re-run LMA after removing weak/failed tiles Loading Loading @@ -149,9 +150,10 @@ public class ImageDttParameters { public double lma_rms_diff = 0.001; // public double lma_rms_diff = 0.001; // public int lma_num_iter = 20; // public int lma_num_iter = 20; // // Filtering and strength calculation // Filtering and strength calculation public double lma_max_rel_rms = 0.2; // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) public double lma_max_rel_rms = 0.12; // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3) public double lma_min_strength = 1.0; // minimal composite strength (sqrt(average amp squared over absolute RMS) public double lma_min_strength = 1.25; // minimal composite strength (sqrt(average amp squared over absolute RMS) public double lma_min_ac = 0.03; // minimal of a and C coefficients maximum (measures sharpest point/line) public double lma_min_ac = 0.15; // minimal of a and C coefficients maximum (measures sharpest point/line) public double lma_max_area = 30.0; // maximal half-area (if > 0.0) public double lma_str_scale = 0.2; // convert lma-generated strength to match previous ones - scale public double lma_str_scale = 0.2; // convert lma-generated strength to match previous ones - scale public double lma_str_offset = 0.05; // convert lma-generated strength to match previous ones - add to result public double lma_str_offset = 0.05; // convert lma-generated strength to match previous ones - add to result Loading Loading @@ -340,6 +342,8 @@ public class ImageDttParameters { "Discard tile if composite strength (average amplitude over SQRT of RMS) is below"); "Discard tile if composite strength (average amplitude over SQRT of RMS) is below"); gd.addNumericField("Minimal max (A,C)", this.lmas_min_ac, 6, 8, "", gd.addNumericField("Minimal max (A,C)", this.lmas_min_ac, 6, 8, "", "Minimal value of max (A,C) coefficients to keep the tile (measures sharpest point/line correlation maximum)"); "Minimal value of max (A,C) coefficients to keep the tile (measures sharpest point/line correlation maximum)"); gd.addNumericField("Maximal area", this.lmas_max_area, 6, 8, "sq.pix", "Maximal product of maximum half-width by half-height, ignore check if <=0"); gd.addMessage("Multi-tile (for lazy eye) LMA (some are used for with single-tile mode too)"); gd.addMessage("Multi-tile (for lazy eye) LMA (some are used for with single-tile mode too)"); gd.addCheckbox ("Correlation maximum as gaussian", this.lma_gaussian, gd.addCheckbox ("Correlation maximum as gaussian", this.lma_gaussian, Loading Loading @@ -403,6 +407,8 @@ public class ImageDttParameters { "Discard tile if composite strength (average amplitude over SQRT of RMS) is below"); "Discard tile if composite strength (average amplitude over SQRT of RMS) is below"); gd.addNumericField("Minimal max (A,C)", this.lma_min_ac, 6, 8, "", gd.addNumericField("Minimal max (A,C)", this.lma_min_ac, 6, 8, "", "Minimal value of max (A,C) coefficients to keep the tile (measures sharpest point/line correlation maximum)"); "Minimal value of max (A,C) coefficients to keep the tile (measures sharpest point/line correlation maximum)"); gd.addNumericField("Maximal area", this.lma_max_area, 6, 8, "sq.pix", "Maximal product of maximum half-width by half-height, ignore check if <=0"); gd.addMessage("Correlation strength calculation (match legacy)"); gd.addMessage("Correlation strength calculation (match legacy)"); gd.addNumericField("Composite correlation strength scale", this.lma_str_scale, 6, 8, "", gd.addNumericField("Composite correlation strength scale", this.lma_str_scale, 6, 8, "", Loading Loading @@ -541,6 +547,7 @@ public class ImageDttParameters { this.lmas_max_rel_rms = gd.getNextNumber(); this.lmas_max_rel_rms = gd.getNextNumber(); this.lmas_min_strength = gd.getNextNumber(); this.lmas_min_strength = gd.getNextNumber(); this.lmas_min_ac = gd.getNextNumber(); this.lmas_min_ac = gd.getNextNumber(); this.lmas_max_area = gd.getNextNumber(); this.lma_gaussian= gd.getNextBoolean(); this.lma_gaussian= gd.getNextBoolean(); this.lma_second= gd.getNextBoolean(); this.lma_second= gd.getNextBoolean(); Loading Loading @@ -573,6 +580,8 @@ public class ImageDttParameters { this.lma_max_rel_rms = gd.getNextNumber(); this.lma_max_rel_rms = gd.getNextNumber(); this.lma_min_strength = gd.getNextNumber(); this.lma_min_strength = gd.getNextNumber(); this.lma_min_ac = gd.getNextNumber(); this.lma_min_ac = gd.getNextNumber(); this.lma_max_area = gd.getNextNumber(); this.lma_str_scale = gd.getNextNumber(); this.lma_str_scale = gd.getNextNumber(); this.lma_str_offset = gd.getNextNumber(); this.lma_str_offset = gd.getNextNumber(); Loading Loading @@ -674,6 +683,7 @@ public class ImageDttParameters { properties.setProperty(prefix+"lmas_max_rel_rms", this.lmas_max_rel_rms +""); properties.setProperty(prefix+"lmas_max_rel_rms", this.lmas_max_rel_rms +""); properties.setProperty(prefix+"lmas_min_strength", this.lmas_min_strength +""); properties.setProperty(prefix+"lmas_min_strength", this.lmas_min_strength +""); properties.setProperty(prefix+"lmas_min_ac", this.lmas_min_ac +""); properties.setProperty(prefix+"lmas_min_ac", this.lmas_min_ac +""); properties.setProperty(prefix+"lmas_max_area", this.lmas_max_area +""); properties.setProperty(prefix+"lma_gaussian", this.lma_gaussian +""); properties.setProperty(prefix+"lma_gaussian", this.lma_gaussian +""); properties.setProperty(prefix+"lma_second", this.lma_second +""); properties.setProperty(prefix+"lma_second", this.lma_second +""); Loading Loading @@ -707,6 +717,7 @@ public class ImageDttParameters { properties.setProperty(prefix+"lma_max_rel_rms", this.lma_max_rel_rms +""); properties.setProperty(prefix+"lma_max_rel_rms", this.lma_max_rel_rms +""); properties.setProperty(prefix+"lma_min_strength", this.lma_min_strength +""); properties.setProperty(prefix+"lma_min_strength", this.lma_min_strength +""); properties.setProperty(prefix+"lma_min_ac", this.lma_min_ac +""); properties.setProperty(prefix+"lma_min_ac", this.lma_min_ac +""); properties.setProperty(prefix+"lma_max_area", this.lma_max_area +""); properties.setProperty(prefix+"lma_str_scale", this.lma_str_scale +""); properties.setProperty(prefix+"lma_str_scale", this.lma_str_scale +""); properties.setProperty(prefix+"lma_str_offset", this.lma_str_offset +""); properties.setProperty(prefix+"lma_str_offset", this.lma_str_offset +""); Loading Loading @@ -814,6 +825,7 @@ public class ImageDttParameters { if (properties.getProperty(prefix+"lmas_max_rel_rms")!=null) this.lmas_max_rel_rms=Double.parseDouble(properties.getProperty(prefix+"lmas_max_rel_rms")); if (properties.getProperty(prefix+"lmas_max_rel_rms")!=null) this.lmas_max_rel_rms=Double.parseDouble(properties.getProperty(prefix+"lmas_max_rel_rms")); if (properties.getProperty(prefix+"lmas_min_strength")!=null) this.lmas_min_strength=Double.parseDouble(properties.getProperty(prefix+"lmas_min_strength")); if (properties.getProperty(prefix+"lmas_min_strength")!=null) this.lmas_min_strength=Double.parseDouble(properties.getProperty(prefix+"lmas_min_strength")); if (properties.getProperty(prefix+"lmas_min_ac")!=null) this.lmas_min_ac=Double.parseDouble(properties.getProperty(prefix+"lmas_min_ac")); if (properties.getProperty(prefix+"lmas_min_ac")!=null) this.lmas_min_ac=Double.parseDouble(properties.getProperty(prefix+"lmas_min_ac")); if (properties.getProperty(prefix+"lmas_max_area")!=null) this.lmas_max_area=Double.parseDouble(properties.getProperty(prefix+"lmas_max_area")); if (properties.getProperty(prefix+"lma_gaussian")!=null) this.lma_gaussian=Boolean.parseBoolean(properties.getProperty(prefix+"lma_gaussian")); if (properties.getProperty(prefix+"lma_gaussian")!=null) this.lma_gaussian=Boolean.parseBoolean(properties.getProperty(prefix+"lma_gaussian")); if (properties.getProperty(prefix+"lma_second")!=null) this.lma_second=Boolean.parseBoolean(properties.getProperty(prefix+"lma_second")); if (properties.getProperty(prefix+"lma_second")!=null) this.lma_second=Boolean.parseBoolean(properties.getProperty(prefix+"lma_second")); Loading Loading @@ -845,6 +857,7 @@ public class ImageDttParameters { if (properties.getProperty(prefix+"lma_max_rel_rms")!=null) this.lma_max_rel_rms=Double.parseDouble(properties.getProperty(prefix+"lma_max_rel_rms")); if (properties.getProperty(prefix+"lma_max_rel_rms")!=null) this.lma_max_rel_rms=Double.parseDouble(properties.getProperty(prefix+"lma_max_rel_rms")); if (properties.getProperty(prefix+"lma_min_strength")!=null) this.lma_min_strength=Double.parseDouble(properties.getProperty(prefix+"lma_min_strength")); if (properties.getProperty(prefix+"lma_min_strength")!=null) this.lma_min_strength=Double.parseDouble(properties.getProperty(prefix+"lma_min_strength")); if (properties.getProperty(prefix+"lma_min_ac")!=null) this.lma_min_ac=Double.parseDouble(properties.getProperty(prefix+"lma_min_ac")); if (properties.getProperty(prefix+"lma_min_ac")!=null) this.lma_min_ac=Double.parseDouble(properties.getProperty(prefix+"lma_min_ac")); if (properties.getProperty(prefix+"lma_max_area")!=null) this.lma_max_area=Double.parseDouble(properties.getProperty(prefix+"lma_max_area")); if (properties.getProperty(prefix+"lma_str_scale")!=null) this.lma_str_scale=Double.parseDouble(properties.getProperty(prefix+"lma_str_scale")); if (properties.getProperty(prefix+"lma_str_scale")!=null) this.lma_str_scale=Double.parseDouble(properties.getProperty(prefix+"lma_str_scale")); if (properties.getProperty(prefix+"lma_str_offset")!=null) this.lma_str_offset=Double.parseDouble(properties.getProperty(prefix+"lma_str_offset")); if (properties.getProperty(prefix+"lma_str_offset")!=null) this.lma_str_offset=Double.parseDouble(properties.getProperty(prefix+"lma_str_offset")); Loading Loading @@ -943,12 +956,13 @@ public class ImageDttParameters { idp.lmas_poly_str_scale = this.lmas_poly_str_scale; idp.lmas_poly_str_scale = this.lmas_poly_str_scale; idp.lmas_poly_str_min = this.lmas_poly_str_min; idp.lmas_poly_str_min = this.lmas_poly_str_min; idp.lmas_lambda_initial = this.lma_lambda_initial; idp.lmas_lambda_initial = this.lmas_lambda_initial; idp.lmas_rms_diff = this.lma_rms_diff; idp.lmas_rms_diff = this.lmas_rms_diff; idp.lmas_num_iter = this.lma_num_iter; idp.lmas_num_iter = this.lmas_num_iter; idp.lmas_max_rel_rms= this.lma_max_rel_rms; idp.lmas_max_rel_rms= this.lmas_max_rel_rms; idp.lmas_min_strength= this.lma_min_strength; idp.lmas_min_strength= this.lmas_min_strength; idp.lmas_min_ac= this.lma_min_ac; idp.lmas_min_ac= this.lmas_min_ac; idp.lmas_max_area= this.lmas_max_area; idp.lma_gaussian = this.lma_gaussian; idp.lma_gaussian = this.lma_gaussian; idp.lma_second = this.lma_second; idp.lma_second = this.lma_second; Loading Loading @@ -980,6 +994,7 @@ public class ImageDttParameters { idp.lma_max_rel_rms= this.lma_max_rel_rms; idp.lma_max_rel_rms= this.lma_max_rel_rms; idp.lma_min_strength= this.lma_min_strength; idp.lma_min_strength= this.lma_min_strength; idp.lma_min_ac= this.lma_min_ac; idp.lma_min_ac= this.lma_min_ac; idp.lma_max_area= this.lma_max_area; idp.lma_str_scale= this.lma_str_scale; idp.lma_str_scale= this.lma_str_scale; idp.lma_str_offset= this.lma_str_offset; idp.lma_str_offset= this.lma_str_offset; Loading
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java +36 −6 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java +1 −1 File changed.Contains only whitespace changes. Show changes