@@ -1813,7 +1815,8 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -1813,7 +1815,8 @@ public class ImageDtt extends ImageDttCPU {
returnmap_corr_indices;
returnmap_corr_indices;
}
}
publicdouble[][][]clt_process_tl_interscene(// convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
// without eigenvectors (use null for double[][] eigen)
publicdouble[][][]clt_process_tl_interscene_noeigen(// convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
finalImageDttParametersimgdtt_params,// Now just extra correlation parameters, later will include, most others
finalImageDttParametersimgdtt_params,// Now just extra correlation parameters, later will include, most others
// only used here to keep extra array element for disparity difference
// only used here to keep extra array element for disparity difference
booleanuse3D,// generate disparity difference
booleanuse3D,// generate disparity difference
...
@@ -1859,12 +1862,17 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -1859,12 +1862,17 @@ public class ImageDtt extends ImageDttCPU {
finaldoublescale_neibs_pd,// scale threshold for the pixel-domain average maximums
finaldoublescale_neibs_pd,// scale threshold for the pixel-domain average maximums
finaldoublescale_neibs_td,// scale threshold for the transform-domain average maximums
finaldoublescale_neibs_td,// scale threshold for the transform-domain average maximums
finaldoublescale_avg_weight,// reduce influence of the averaged correlations compared to the single-tile ones
finaldoublescale_avg_weight,// reduce influence of the averaged correlations compared to the single-tile ones
/*
final double eigen_min_abs, // 0.05 values below this do not count for covariance
final double eigen_min_rel, // 0.2 values less than this fraction of tile's max do not count for covariance
final double [][] eigen, // null or [tilesX*tilesY]{lamb0_x,lamb0_y, lamb0, lamb1} eigenvector0[x,y],lam0,lam1
*/
finalintdebug_tileX,
finalintdebug_tileX,
finalintdebug_tileY,
finalintdebug_tileY,
finalintthreadsMax,// maximal number of threads to launch
finalintthreadsMax,// maximal number of threads to launch
finalintglobalDebugLevel)
finalintglobalDebugLevel)
{
{
// final boolean eigen_sub_min = false; // when calculating eigenvectors, subtract min from data, false - just skip
if(this.gpuQuad==null){
if(this.gpuQuad==null){
System.out.println("clt_process_tl_interscene(): this.gpuQuad is null, bailing out");
System.out.println("clt_process_tl_interscene(): this.gpuQuad is null, bailing out");
returnnull;
returnnull;
...
@@ -1982,7 +1990,7 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -1982,7 +1990,7 @@ public class ImageDtt extends ImageDttCPU {
// The tp_tasks data should be decoded from GPU to get coordinates
finalTpTask[]tp_tasks,// data from the reference frame - will be applied to LMA for the integrated correlations
// to be converted to float (may be null)
finaldouble[][][]dcorr_tiles,// [tile][pair absolute, sparse][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
finaldouble[][]pXpYD,// pXpYD for the reference scene
finaldouble[][]fpn_offsets,// null, or per-tile X,Y offset to be blanked
finaldoublefpn_radius,// radius to be blanked around FPN offset center
finalbooleanfpn_ignore_border,// NOT used! only if fpn_mask != null - ignore tile if maximum touches fpn_mask
// final double[][][] motion_vectors, // [tilesY*tilesX][][] -> [][num_sel_sensors+1 or 2][3]
finalbooleanrun_poly,// polynomial max, if false - centroid
finalbooleanuse_partial,// find motion vectors for individual pairs, false - for sum only
finaldoublecentroid_radius,// 0 - use all tile, >0 - cosine window around local max
finalintn_recenter,// when cosine window, re-center window this many times
finaldoubletd_weight,// mix correlations accumulated in TD with
finaldoubletd_neib_weight,// mix correlations accumulated in TD (neibs)
finaldoublepd_weight,// correlations (post) accumulated in PD
finalbooleantd_nopd_only,// only use TD accumulated data if no safe PD is available for the tile.
finalbooleaneig_use_neibs,// use correlation from 9 tiles with neibs, if single-tile fails
finalbooleaneig_remove_neibs,//remove weak (by-neibs) tiles if they have strong (by-single) neighbor
// final double min_str_nofpn, // = 0.25;
finaldoubleeig_str_sum_nofpn,// = 0.8; // 5;
finaldoubleeig_str_neib_nofpn,// = 0.8; // 5;
// final double min_str_fpn, // = 0.25;
finaldoubleeig_str_sum_fpn,// = 0.8; // 5;
finaldoubleeig_str_neib_fpn,// = 0.8; // 5;
finalintmin_neibs,// 2; // minimal number of strong neighbors (> min_str)
finaldoubleweight_zero_neibs,// 0.2; // Reduce weight for no-neib (1.0 for all 8)
finaldoublehalf_disparity,// 5.0; // Reduce weight twice for this disparity
finaldoublehalf_avg_diff,// 0.2; // when L2 of x,y difference from average of neibs - reduce twice
finalbooleanneibs_nofpn_only,// consolidate neighbors for non-fpn tiles only!
finalbooleanredo_both,// use average of neighbors for both pd,td if any of the center tile tests (td, pd) fails
finalintmin_num_neibs,// plus center, total number >= (min_num_neibs+1)
finaldoublescale_neibs_pd,// scale threshold for the pixel-domain average maximums
finaldoublescale_neibs_td,// scale threshold for the transform-domain average maximums
finaldoublescale_avg_weight,// reduce influence of the averaged correlations compared to the single-tile ones
finaldoubleeigen_min_abs,// 0.05 values below this do not count for covariance
finaldoubleeigen_min_rel,// 0.2 values less than this fraction of tile's max do not count for covariance
finaldoubleeig_sub_frac,// 1.0; // subtract fraction of threshold {eig_min_abs,eig_min_rel} after selecting by them (0 - select only, will have pedestal)
finaldouble[][]eigen,// null or [tilesX*tilesY]{lamb0_x,lamb0_y, lamb0, lamb1} eigenvector0[x,y],lam0,lam1
finalbooleaneigen_debug,//
finalintdebug_tileX,
finalintdebug_tileY,
finalintthreadsMax,// maximal number of threads to launch
finalintglobalDebugLevel)
{
// final boolean
// final boolean eigen_sub_min = false; // when calculating eigenvectors, subtract min from data, false - just skip
if(this.gpuQuad==null){
System.out.println("clt_process_tl_interscene(): this.gpuQuad is null, bailing out");
returnnull;
}
finalbooleanextra_sum=true;// use sum of pixel-domain correlations (TD have artifacts for low contrast
// - maybe -related to float vs. double - not tested yet . Probably - still FPN with low offset
corrs[indx_sum_td],// double [] data, // will be modified if fpn_mask != null;
corr_size,// int data_width, // = 2 * transform_size - 1;
eigen_min_abs,// double abs_min,
eigen_min_rel,// double rel_min,
eig_str_sum,// double min_peak,
eig_sub_frac,// double eig_sub_frac, // subtract fraction of threshold {eig_min_abs,eig_min_rel} after selecting by them (0 - select only, will have pedestal)
fpn_mask,// boolean [] fpn_mask,
false,// boolean ignore_border, // only if fpn_mask != null - ignore tile if maximum touches fpn_mask
debug_data,// double [][] debug_data, // null or double [1]
false);// boolean debug)
used_td[nTile]=stats_mv!=null;
if(stats_mv!=null){
stats_mv[2]-=eig_str_sum*scale_neibs_td;
if(stats_mv[2]<=0){
stats_mv=null;
}
}
// UPDATE!
if(!used_td[nTile]&&eig_use_neibs){// try neibs
stats_mv=Correlation2d.getMaxXYCmEig(
corrs[indx_sum_td_neib],// double [] data, // will be modified if fpn_mask != null;
corr_size,// int data_width, // = 2 * transform_size - 1;
eigen_min_abs,// double abs_min,
eigen_min_rel,// double rel_min,
eig_str_neib,// double min_peak,
eig_sub_frac,// double eig_sub_frac, // subtract fraction of threshold {eig_min_abs,eig_min_rel} after selecting by them (0 - select only, will have pedestal)
fpn_mask,// boolean [] fpn_mask,
false,// boolean ignore_border, // only if fpn_mask != null - ignore tile if maximum touches fpn_mask
debug_data,// double [][] debug_data, // null or double [1]
false);// boolean debug)
}
if((debug_data!=null)&&(debug_data[0]!=null)){
iCorrTile_index[nTile]=iCorrTile;
dcorr_tiles[iCorrTile][eigen_indx+0]=debug_data[0];// all
dcorr_tiles[iCorrTile][eigen_indx+1]=debug_data[0].clone();// all remain
doubleeigen_min_abs=clt_parameters.imp.eig_min_abs;//eigen_min_abs = 0.05; // 0.05 values below this do not count for covariance
doubleeigen_min_rel=clt_parameters.imp.eig_min_rel;//0.2; // 0.2 values less than this fraction of tile's max do not count for covariance
coord_motion=image_dtt.clt_process_tl_interscene(// convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
coord_motion=image_dtt.clt_process_tl_interscene(// 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
clt_parameters.img_dtt,// final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
// only used here to keep extra array element for disparity difference
// only used here to keep extra array element for disparity difference
...
@@ -4151,6 +4170,84 @@ public class Interscene {
...
@@ -4151,6 +4170,84 @@ public class Interscene {
fpn_offsets,// final double [][] fpn_offsets, // null, or per-tile X,Y offset to be blanked
fpn_offsets,// final double [][] fpn_offsets, // null, or per-tile X,Y offset to be blanked
fpn_radius,// final double fpn_radius, // radius to be blanked around FPN offset center
fpn_radius,// final double fpn_radius, // radius to be blanked around FPN offset center
fpn_ignore_border,// final boolean fpn_ignore_border, // only if fpn_mask != null - ignore tile if maximum touches fpn_mask
fpn_ignore_border,// final boolean fpn_ignore_border, // only if fpn_mask != null - ignore tile if maximum touches fpn_mask
redo_both,// final boolean redo_both, // use average of neighbors for both pd,td if any of the center tile tests (td, pd) fails
min_num_neibs,// final int min_num_neibs, // plus center, total number >= (min_num_neibs+1)
scale_neibs_pd,// final double scale_neibs_pd, // scale threshold for the pixel-domain average maximums
scale_neibs_td,// final double scale_neibs_td, // scale threshold for the transform-domain average maximums
scale_avg_weight,// final double scale_avg_weight, // reduce influence of the averaged correlations compared to the single-tile ones
eigen_min_abs,// final double eigen_min_abs, // 0.05 values below this do not count for covariance
eigen_min_rel,// final double eigen_min_rel, // 0.2 values less than this fraction of tile's max do not count for covariance
clt_parameters.imp.eig_sub_frac,//final double eig_sub_frac, // 1.0; // subtract fraction of threshold {eig_min_abs,eig_min_rel} after selecting by them (0 - select only, will have pedestal)
eigen,// null, // eigen, // final double [][] eigen, // null or [tilesX*tilesY]{lamb0_x,lamb0_y, lamb0, lamb1} eigenvector0[x,y],lam0,lam1
eigen_debug,// final double [][] eigen_debug, // null or [tilesX*tilesY][]
clt_parameters.tileX,// final int debug_tileX,
clt_parameters.tileY,// final int debug_tileY,
THREADS_MAX,// final int threadsMax, // maximal number of threads to launch
debug_level);
if(coord_motion==null){
System.out.println("clt_process_tl_interscene() returned null");
if(fail_reason!=null){
fail_reason[0]=FAIL_REASON_INTERSCENE;
}
returnnull;
}
// eigen is now filled inside clt_process_tl_interscene(), and coord_motion[] is in old format if eigen[][] was supplied.
/*
if (eigen != null) { // temporarily make as old: {dx,dy,str,0,0}
int coord_motion_slice = coord_motion.length - 1; // used for motionvector - last index
for (int tile = 0; tile < coord_motion[coord_motion_slice].length; tile++ ) if ( coord_motion[coord_motion_slice][tile] != null){
coord_motion=image_dtt.clt_process_tl_interscene_noeigen(// 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
// only used here to keep extra array element for disparity difference