corr_wnd,// double [][] corr_wnd, // correlation window to save on re-calculation of the window
corr_wnd_inv_limited,// corr_wnd_limited, // correlation window, limited not to be smaller than threshold - used for finding max/convex areas (or null)
corrs,// corrs, // double [][] corrs,
disp_dist,
rXY,// double [][] rXY, // non-distorted X,Y offset per nominal pixel of disparity
// all that are not null in corr_tiles
correlation2d.selectAll(),// longToArray(imgdtt_params.dbg_pair_mask), // int pair_mask, // which pairs to process
disp_str,//corr_stat[0], // double xcenter, // preliminary center x in pixels for largest baseline
poly_disp,// double[] poly_ds, // null or pair of disparity/strength
imgdtt_params.ortho_vasw_pwr,// double vasw_pwr, // value as weight to this power,
-2,//0, // tile_lma_debug_level, // +2, // int debug_level,
tileX,// int tileX, // just for debug output
tileY);// int tileY
if(debugTile0){// should be debugTile
System.out.println("Ran LMA for tileX="+tileX+", tileY="+tileY);
}
double[][]ds=null;
if(lma2!=null){
ds=lma2.lmaDisparityStrength(
imgdtt_params.lmas_min_amp,// minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
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_ac,// minimal of A and C coefficients maximum (measures sharpest point/line)
imgdtt_params.lmas_min_min_ac,// minimal of A and C coefficients minimum (measures sharpest point)
image_data,// final double [][][] imade_data, // first index - number of image in a quad
saturation_imp,// final boolean [][] saturation_imp, // (near) saturated pixels or null
tilesX*image_dtt.transform_size,// final int width,
// tilesX * image_dtt.transform_size, // final int width,
geometryCorrection.getSensorWH()[0],// final int width,
clt_parameters.getFatZero(isMonochrome()),// final double corr_fat_zero, // add to denominator to modify phase correlation (same units as data1, data2). <0 - pure sum
clt_parameters.corr_red,// final double corr_red,
clt_parameters.corr_blue,// final double corr_blue,
...
...
@@ -8414,98 +8419,6 @@ public class QuadCLTCPU {
}
/*
combo_pass.setSelected(combo_pass.getLMA().clone()); // store original LMA
if (show_init_refine) tp.showScan(
combo_pass, // CLTPass3d scan,
"after_compositeScan-"+tp.clt_3d_passes.size());
for (int nexpand = 0; nexpand < 50; nexpand++) {
int num_added = tp.expandCertain (
combo_pass, // final CLTPass3d combo_pass, // modify
tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
bg_pass, // final int firstPass,
tp.clt_3d_passes.size(), // final int lastPassPlus1,
-1.0, // final double degrade_no_data, // if >=0 will expand without any measurements, using scaled down strength
0.5, // final int disp_avg_arange, // average neighbors with disparity not more than that from the lowest
0.1, // final int disp_avg_rrange, // same, relative to disparity
1.0, // final int disp_arange, // look for a fit within range from the neighbor
0.1, // final int disp_rrange, // same, relative to disparity
2, // final int min_defined, // minimal number of defined neighbors that fit into the range
tp.getTrustedCorrelation(), // final double trustedCorrelation,
tp.getMaxOverexposure(), // final double max_overexposure,
debugLevel); // final int debugLevel)
if (num_added==0) {
break;
}
if (show_init_refine &&(debugLevel > 10)) tp.showScan(
combo_pass, // CLTPass3d scan,
"expanded-"+nexpand+"-added-"+num_added);
}
// combo_pass.setLMA(combo_pass.getSelected()); // restore original LMA
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
disparity_map,// [12][tp.tilesY * tp.tilesX]
tilesX*image_dtt.transform_size,// imp_quad[0].getWidth(), // final int width,
// tilesX * image_dtt.transform_size, // imp_quad[0].getWidth(), // final int width,
geometryCorrection.getSensorWH()[0],// final int width,
clt_parameters.getFatZero(isMonochrome()),// add to denominator to modify phase correlation (same units as data1, data2). <0 - pure sum
clt_parameters.corr_sym,
clt_parameters.corr_offset,
...
...
@@ -12127,10 +12047,10 @@ public class QuadCLTCPU {
clt_parameters.shift_y,// final int shiftY, // shift image vertically (positive - down)
clust_radius,// final int clustRadius, // 1 - single tile, 2 - 3x3, 3 - 5x5, ...
1.0,// final double arange, // absolute disparity range to consolidate
0.1,// final double rrange, // relative disparity range to consolidate
0.5,// final double no_tilt, // no tilt if center disparity is lower
0.01,// final double damp_tilt, // 0.1?
arange,// 1.0, // final double arange, // absolute disparity range to consolidate
rrange,// 0.1, // final double rrange, // relative disparity range to consolidate
no_tilt,// 0.5, // final double no_tilt, // no tilt if center disparity is lower
damp_tilt,// 0.01, // final double damp_tilt, // 0.1?
// 2021 new next 5
mcorr_sel,// final int mcorr_sel, // Which pairs to correlate // +1 - all, +2 - dia, +4 - sq, +8 - neibs, +16 - hor + 32 - vert
...
...
@@ -12161,7 +12081,8 @@ public class QuadCLTCPU {
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
disparity_map,// [12][tp.tilesY * tp.tilesX]
tilesX*image_dtt.transform_size,// imp_quad[0].getWidth(), // final int width,
// tilesX * image_dtt.transform_size, // imp_quad[0].getWidth(), // final int width,
geometryCorrection.getSensorWH()[0],// final int width,
clt_parameters.getFatZero(isMonochrome()),// add to denominator to modify phase correlation (same units as data1, data2). <0 - pure sum
clt_parameters.corr_sym,
clt_parameters.corr_offset,
...
...
@@ -12214,7 +12135,8 @@ public class QuadCLTCPU {
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
tilesX*image_dtt.transform_size,// imp_quad[0].getWidth(), // final int width,
// tilesX * image_dtt.transform_size, // imp_quad[0].getWidth(), // final int width,
geometryCorrection.getSensorWH()[0],// final int width,
clt_parameters.getFatZero(isMonochrome()),// add to denominator to modify phase correlation (same units as data1, data2). <0 - pure sum
clt_parameters.corr_sym,
clt_parameters.corr_offset,
...
...
@@ -12277,6 +12199,7 @@ public class QuadCLTCPU {
finalbooleanupdateStatus,
finalintdebugLevel)
{
// TODO: Move to clt_parameters
finalintdbg_x=-295-debugLevel;
finalintdbg_y=-160-debugLevel;
finalinttilesX=tp.getTilesX();
...
...
@@ -12284,6 +12207,7 @@ public class QuadCLTCPU {
double[]disparity=scan.getDisparity();
double[]strength=scan.getStrength();
boolean[]selection=scan.getSelected();
if(selection==null){
selection=newboolean[tilesX*tilesY];
for(intnTile=0;nTile<selection.length;nTile++){
...
...
@@ -12369,7 +12293,9 @@ public class QuadCLTCPU {
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
tile_corr_weights=image_dtt.quadCorrTD_tilted(// returns tile weights to be used for scaling fat zeros during transform domain -> pixel domain transform
image_data,// final double [][][] image_data, // first index - number of image in a quad
geometryCorrection.getSensorWH()[0],// final int width,
tp_tasks,// final TpTask [] tp_tasks,
clt_parameters.img_dtt,// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
// dcorr_td should be either null, or double [tp_tasks.length][][];
dcorr_td,// final double [][][][] dcorr_td, // [tile][pair][4][64] sparse by pair transform domain representation of corr pairs
// no combo here - rotate, combine in pixel domain after interframe
clt_kernels,// final double [][][][][][] clt_kernels, // [sensor][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
geometryCorrection,// final GeometryCorrection geometryCorrection,
clt_parameters.kernel_step,// final int kernel_step,
clt_parameters.clt_window,// final int window_type,
clt_parameters.corr_red,// final double corr_red,
clt_parameters.corr_blue,// final double corr_blue,
// related to tilt
clust_radius,// final int clustRadius, // 1 - single tile, 2 - 3x3, 3 - 5x5, ...
arange,// 1.0, // final double arange, // absolute disparity range to consolidate
rrange,// 0.1, // final double rrange, // relative disparity range to consolidate
no_tilt,// 0.5, // final double no_tilt, // no tilt if center disparity is lower
damp_tilt,// 0.01, // final double damp_tilt, // 0.1?
mcorr_sel,// final int mcorr_sel, // Which pairs to correlate // +1 - all, +2 - dia, +4 - sq, +8 - neibs, +16 - hor + 32 - vert
clt_parameters.tileX,// final int debug_tileX,
clt_parameters.tileY,// final int debug_tileY,
threadsMax,// final int threadsMax, // maximal number of threads to launch
image_dtt.clt_process_tl_correlations(// convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
clt_parameters.img_dtt,// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
tp_tasks,// final TpTask [] tp_tasks, // data from the reference frame - will be applied to LMW for the integrated correlations
// only listed tiles will be processed
geometryCorrection.getRXY(false),// final double [][] rXY, // from geometryCorrection
tilesX,// final int tilesX, // tp_tasks may lack maximal tileX, tileY
tilesY,// final int tilesY,
dcorr_td,// final double [][][][] dcorr_td, // [tile][pair][4][64] sparse by pair transform domain representation of corr pairs
tile_corr_weights,// final double [] dcorr_weight, // [tile] weighted number of tiles averaged (divide squared fat zero by this)
clt_corr_out,// final double [][][][] clt_corr_out, // sparse (by the first index) [type][tilesY][tilesX][(2*transform_size-1)*(2*transform_size-1)] or null
// combo will be added as extra pair if mcorr_comb_width > 0 and clt_corr_out has a slot for it
// to be converted to float
dcorr_tiles,// final double [][][] dcorr_tiles, // [tile][pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
// When clt_mismatch is non-zero, no far objects extraction will be attempted
//optional, may be null
disparity_map,// final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
run_lma,// final boolean run_lma, // calculate LMA, false - CM only
clt_parameters.getGpuFatZero(isMonochrome()),//final double afat_zero2, // gpu_fat_zero ==30? clt_parameters.getGpuFatZero(is_mono); absolute fat zero, same units as components squared values
// clt_parameters.getCorrSigma(image_dtt.isMonochrome()), // final double corr_sigma,
clt_parameters.gpu_sigma_m,// final double corr_sigma, //
// define combining of all 2D correlation pairs for CM (LMA does not use them)
clt_parameters.img_dtt.mcorr_comb_width,// final int mcorr_comb_width, // combined correlation tile width
clt_parameters.img_dtt.mcorr_comb_height,// final int mcorr_comb_height, // combined correlation tile full height
clt_parameters.img_dtt.mcorr_comb_offset,// final int mcorr_comb_offset, // combined correlation tile height offset: 0 - centered (-height/2 to
clt_parameters.img_dtt.mcorr_comb_disp,// final double mcorr_comb_disp, // Combined tile per-pixel disparity for baseline == side of a square
clt_parameters.clt_window,// final int window_type, // GPU: will not be used
clt_parameters.tileX,// final int debug_tileX,
clt_parameters.tileY,// final int debug_tileY,
threadsMax,// final int threadsMax, // maximal number of threads to launch
debugLevel-1);// final int globalDebugLevel)
}
if(save_textures){// will throw if (clt_data == null)
texture_tiles=image_dtt.clt_process_texture_tiles(// final double [][][][] texture_tiles
clt_parameters.img_dtt,// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
tp_tasks,// final TpTask [] tp_tasks, // data from the reference frame - will be applied to LMW for the integrated correlations
// only listed tiles will be processed
geometryCorrection.getRXY(false),// final double [][] rXY, // from geometryCorrection
tilesX,// final int tilesX, // tp_tasks may lack maximal tileX, tileY
tilesY,// final int tilesY,
clt_data,// final double [][][][][] clt_data,
//optional, may be null
disparity_map,// final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
// TODO: Make a separate texture_sigma?
clt_parameters.getCorrSigma(image_dtt.isMonochrome()),// final double texture_sigma, // corr_sigma, //
clt_parameters.corr_red,
clt_parameters.corr_blue,
clt_parameters.min_shot,// final double min_shot, // 10.0; // Do not adjust for shot noise if lower than
clt_parameters.scale_shot,// 3.0; // scale when dividing by sqrt ( <0 - disable correction)
clt_parameters.diff_sigma,// 5.0;//RMS difference from average to reduce weights (~ 1.0 - 1/255 full scale image)
clt_parameters.diff_threshold,// 5.0; // RMS difference from average to discard channel (~ 1.0 - 1/255 full scale image)
clt_parameters.diff_gauss,// true; // when averaging images, use gaussian around average as weight (false - sharp all/nothing)
clt_parameters.min_agree,// 3.0; // minimal number of channels to agree on a point (real number to work with fuzzy averages)
clt_parameters.dust_remove,// Do not reduce average weight when only one image differes much from the average
clt_parameters.keep_weights,// Add port weights to RGBA stack (debug feature)
clt_parameters.clt_window,// final int window_type, // GPU: will not be used
clt_parameters.tileX,// final int debug_tileX,
clt_parameters.tileY,// final int debug_tileY,
threadsMax,// final int threadsMax, // maximal number of threads to launch
debugLevel-1);// final int globalDebugLevel)
}
// display correlation images (add "combo_all" to titles if needed)
dcorr_tiles,// double [][][] dcorr_tiles,// [tile][sparse, correlation pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
fclt_corr);// float [][][] fclt_corr) // new float [tilesX * tilesY][][] or null
float[][]dbg_corr_rslt_partial=ImageDtt.corr_partial_dbg(// not used in lwir
fclt_corr,// final float [][][] fcorr_data, // [tile][pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
tp_tasks,// final TpTask [] tp_tasks, //
tilesX,//final int tilesX,
tilesY,//final int tilesX,
2*image_dtt.transform_size-1,// final int corr_size,
1000,// will be limited by available layersfinal int layers0,
clt_parameters.corr_border_contrast,// final double border_contrast,
threadsMax,// final int threadsMax, // maximal number of threads to launch