Commit 23dab5f8 authored by Andrey Filippov's avatar Andrey Filippov

Updated multi-scene Lazy Eye adjustment

parent 70892387
......@@ -271,6 +271,11 @@ public class BiQuadParameters {
public double fsplit_adiff = 0.02; //4;// minimal tile (combo) absolute disparity difference from neighbors
public double fsplit_rdiff = 0.02; // 1; // minimal tile (combo) relative disparity difference from neighbors
public double fsplit_kfg_min = 0.05; // *** minimal fraction of kfg and (1.0-kfg)
// split filtering
public double fsplit_min_ratio = 0.8; // minimal ratio of the weakest to strongest of fg and bg strengths
public double fsplit_min_diff = 0.08; // minimal FG to BG disparity difference
public double fsplit_rms_gain = 1.1; // minimal LMA RMS improvement of splitting to FG and BG
public boolean fsplit_dbg = false;
public boolean mll_generate_scene_outlines = false; // Uses 2 GB - change format, add dimensions (separate color for ref)
......@@ -743,6 +748,14 @@ public class BiQuadParameters {
"Maximal relative (to average) disparity difference from average of neighbors for FG/BG split.");
gd.addNumericField("Minimal kFG fraction", this.fsplit_kfg_min, 3,6,"",
"Minimal fraction of kfg and (1.0-kfg).");
gd.addNumericField("Minimal weakest to strongest FG, BG ratio", this.fsplit_min_ratio, 3,6,"",
"Minimal ratio of the weakest to strongest of fg and bg strengths.");
gd.addNumericField("Minimal FG to BG difference", this.fsplit_min_diff, 3,6,"pix",
"Minimal FG to BG disparity difference.");
gd.addNumericField("Minimal LMA RMS improvement of splitting", this.fsplit_rms_gain, 3,6,"",
"Minimal LMA RMS improvement of splitting to FG and BG.");
gd.addCheckbox ("Debug far FG/BG split ", this.fsplit_dbg,
"Generate and save scene outlines for scene series (need to change format, it is 2GB with uncompressed Tiff)");
......@@ -1063,9 +1076,12 @@ public class BiQuadParameters {
this.fsplit_adiff = gd.getNextNumber();
this.fsplit_rdiff = gd.getNextNumber();
this.fsplit_kfg_min = gd.getNextNumber();
this.fsplit_min_ratio = gd.getNextNumber();
this.fsplit_min_diff = gd.getNextNumber();
this.fsplit_rms_gain = gd.getNextNumber();
this.fsplit_dbg = gd.getNextBoolean();
this.mll_generate_scene_outlines= gd.getNextBoolean();
this.mll_generate_scene_outlines= gd.getNextBoolean();
this.mll_add_combo= gd.getNextBoolean();
this.mll_save_accum= gd.getNextBoolean();
this.mll_randomize_offsets= gd.getNextBoolean();
......@@ -1327,7 +1343,11 @@ public class BiQuadParameters {
properties.setProperty(prefix+"fsplit_adiff", this.fsplit_adiff+""); // double
properties.setProperty(prefix+"fsplit_rdiff", this.fsplit_rdiff+""); // double
properties.setProperty(prefix+"fsplit_kfg_min", this.fsplit_kfg_min+""); // double
properties.setProperty(prefix+"fsplit_dbg", this.fsplit_dbg+"");
properties.setProperty(prefix+"fsplit_min_ratio", this.fsplit_min_ratio+""); // double
properties.setProperty(prefix+"fsplit_min_diff", this.fsplit_min_diff+""); // double
properties.setProperty(prefix+"fsplit_rms_gain", this.fsplit_rms_gain+""); // double
properties.setProperty(prefix+"fsplit_dbg", this.fsplit_dbg+""); // boolean
properties.setProperty(prefix+"mll_add_combo", this.mll_add_combo+"");
properties.setProperty(prefix+"mll_save_accum", this.mll_save_accum+"");
......@@ -1587,6 +1607,9 @@ public class BiQuadParameters {
if (properties.getProperty(prefix+"fsplit_adiff")!=null) this.fsplit_adiff=Double.parseDouble(properties.getProperty(prefix+"fsplit_adiff"));
if (properties.getProperty(prefix+"fsplit_rdiff")!=null) this.fsplit_rdiff=Double.parseDouble(properties.getProperty(prefix+"fsplit_rdiff"));
if (properties.getProperty(prefix+"fsplit_kfg_min")!=null) this.fsplit_kfg_min=Double.parseDouble(properties.getProperty(prefix+"fsplit_kfg_min"));
if (properties.getProperty(prefix+"fsplit_min_ratio")!=null) this.fsplit_min_ratio=Double.parseDouble(properties.getProperty(prefix+"fsplit_min_ratio"));
if (properties.getProperty(prefix+"fsplit_min_diff")!=null) this.fsplit_min_diff=Double.parseDouble(properties.getProperty(prefix+"fsplit_min_diff"));
if (properties.getProperty(prefix+"fsplit_rms_gain")!=null) this.fsplit_rms_gain=Double.parseDouble(properties.getProperty(prefix+"fsplit_rms_gain"));
if (properties.getProperty(prefix+"fsplit_dbg")!=null) this.fsplit_dbg=Boolean.parseBoolean(properties.getProperty(prefix+"fsplit_dbg"));
if (properties.getProperty(prefix+"mll_generate_scene_outlines")!=null) this.mll_generate_scene_outlines=Boolean.parseBoolean(properties.getProperty(prefix+"mll_generate_scene_outlines"));
......@@ -1848,8 +1871,12 @@ public class BiQuadParameters {
bqp.fsplit_disp = this.fsplit_disp;
bqp.fsplit_adiff = this.fsplit_adiff;
bqp.fsplit_rdiff = this.fsplit_rdiff;
bqp.fsplit_kfg_min = this.fsplit_kfg_min;
bqp.fsplit_kfg_min = this.fsplit_kfg_min;
bqp.fsplit_min_ratio = this.fsplit_min_ratio;
bqp.fsplit_min_diff = this.fsplit_min_diff;
bqp.fsplit_rms_gain = this.fsplit_rms_gain;
bqp.fsplit_dbg = this.fsplit_dbg;
bqp.mll_generate_scene_outlines = this.mll_generate_scene_outlines;
bqp.mll_add_combo = this.mll_add_combo;
......
......@@ -4765,78 +4765,82 @@ public class Correlation2d {
int high_marg = corr_size - imgdtt_params.lma_soft_marg -1;
boolean [] used_pairs = pair_mask.clone();
int num_used_pairs = 0;
for (int npair = 0; npair < pair_mask.length; npair++) if ((corrs[npair] != null) && (pair_mask[npair])){
double [] corr_blur = null;
if (imgdtt_params.cnvx_en) { // || (pair_shape_masks == null)) {
corr_blur = corrs[npair].clone();
if (corr_wnd_inv_limited != null) {
for (int i = 0; i < corr_blur.length; i++) {
corr_blur[i] *= corr_wnd_inv_limited[i];
}
}
if (imgdtt_params.lma_sigma > 0) {
gb.blurDouble(corr_blur, corr_size, corr_size, imgdtt_params.lma_sigma, imgdtt_params.lma_sigma, 0.01);
}
if (dbg_corr != null) {
dbg_corr[npair] = corr_blur;
}
for (int nmax = 0; nmax < lma_corr_weights.length; nmax++) { // use same blurred version for all max-es
int x00 = (int) Math.round(pair_offsets[nmax][npair][0])+center;
int y00 = (int) Math.round(pair_offsets[nmax][npair][1])+center;
int x_min = Math.max (x00 - imgdtt_params.bimax_rad_convex_search,imgdtt_params.lma_soft_marg);
int x_max = Math.min(x00 + imgdtt_params.bimax_rad_convex_search , high_marg);
int y_min = Math.max (y00 - imgdtt_params.bimax_rad_convex_search,imgdtt_params.lma_soft_marg);
int y_max = Math.min(y00 + imgdtt_params.bimax_rad_convex_search, high_marg);
int imx = x_min + y_min * corr_size;
double [] own_mask = own_masks[nmax][npair];
for (int iy = y_min; iy <= y_max; iy++) {
for (int ix = x_min; ix <= x_max; ix++) {
int indx = iy * corr_size + ix;
if (corr_blur[indx] * own_mask[indx] > corr_blur[imx] * own_mask[imx]) {
imx = indx;
}
}
}
// filter convex
int ix0 = (imx % corr_size) - center; // signed, around center to match filterConvex
int iy0 = (imx / corr_size) - center; // signed, around center to match filterConvex
filtWeight[nmax][npair] = filterConvex(
corr_blur, // double [] corr_data,
imgdtt_params.cnvx_hwnd_size, // int hwin,
ix0, // int x0,
iy0, // int y0,
imgdtt_params.cnvx_add3x3, // boolean add3x3,
imgdtt_params.cnvx_weight, // double nc_cost,
(debug_level > 2)); // boolean debug);
//WRONG!!!
if (imgdtt_params.cnvx_or) {
for (int i = 0; i < filtWeight[nmax][npair].length; i++){
lma_corr_weights[nmax][npair][i] = Math.max(lma_corr_weights[nmax][npair][i],filtWeight[nmax][npair][i]);
}
} else {
for (int i = 0; i < filtWeight[nmax][npair].length; i++){
lma_corr_weights[nmax][npair][i] *= filtWeight[nmax][npair][i];
}
}
}
}
used_pairs[npair] = true;
for (int nmax = 0; nmax < lma_corr_weights.length; nmax++) { // use same blurred version for all max-es
int num_pair_samples = 0;
for (int i = 0; i < lma_corr_weights[nmax][npair].length; i++) if (lma_corr_weights[nmax][npair][i] > 0.0) {
num_pair_samples++;
}
if (num_pair_samples < imgdtt_params.bimax_min_num_samples) {
lma_corr_weights[nmax][npair] = null;
used_pairs[npair] = false;
}
}
if (used_pairs[npair]) {
num_used_pairs++;
}
for (int npair = 0; npair < pair_mask.length; npair++) if ((corrs[npair] != null) && (pair_mask[npair])){
double [] corr_blur = null;
if (imgdtt_params.cnvx_en) { // || (pair_shape_masks == null)) {
corr_blur = corrs[npair].clone();
if (corr_wnd_inv_limited != null) {
for (int i = 0; i < corr_blur.length; i++) {
corr_blur[i] *= corr_wnd_inv_limited[i];
}
}
if (imgdtt_params.lma_sigma > 0) {
gb.blurDouble(corr_blur, corr_size, corr_size, imgdtt_params.lma_sigma, imgdtt_params.lma_sigma, 0.01);
}
if (dbg_corr != null) {
dbg_corr[npair] = corr_blur;
}
for (int nmax = 0; nmax < lma_corr_weights.length; nmax++) { // use same blurred version for all max-es
int x00 = (int) Math.round(pair_offsets[nmax][npair][0])+center;
int y00 = (int) Math.round(pair_offsets[nmax][npair][1])+center;
int x_min = Math.max (x00 - imgdtt_params.bimax_rad_convex_search,imgdtt_params.lma_soft_marg);
int x_max = Math.min(x00 + imgdtt_params.bimax_rad_convex_search , high_marg);
int y_min = Math.max (y00 - imgdtt_params.bimax_rad_convex_search,imgdtt_params.lma_soft_marg);
int y_max = Math.min(y00 + imgdtt_params.bimax_rad_convex_search, high_marg);
// got illegal index x00=38
if ((x_min > x_max) || (y_min > y_max)) {
continue;
}
int imx = x_min + y_min * corr_size;
double [] own_mask = own_masks[nmax][npair];
for (int iy = y_min; iy <= y_max; iy++) {
for (int ix = x_min; ix <= x_max; ix++) {
int indx = iy * corr_size + ix;
if (corr_blur[indx] * own_mask[indx] > corr_blur[imx] * own_mask[imx]) {
imx = indx;
}
}
}
// filter convex
int ix0 = (imx % corr_size) - center; // signed, around center to match filterConvex
int iy0 = (imx / corr_size) - center; // signed, around center to match filterConvex
filtWeight[nmax][npair] = filterConvex(
corr_blur, // double [] corr_data,
imgdtt_params.cnvx_hwnd_size, // int hwin,
ix0, // int x0,
iy0, // int y0,
imgdtt_params.cnvx_add3x3, // boolean add3x3,
imgdtt_params.cnvx_weight, // double nc_cost,
(debug_level > 2)); // boolean debug);
//WRONG!!!
if (imgdtt_params.cnvx_or) {
for (int i = 0; i < filtWeight[nmax][npair].length; i++){
lma_corr_weights[nmax][npair][i] = Math.max(lma_corr_weights[nmax][npair][i],filtWeight[nmax][npair][i]);
}
} else {
for (int i = 0; i < filtWeight[nmax][npair].length; i++){
lma_corr_weights[nmax][npair][i] *= filtWeight[nmax][npair][i];
}
}
}
}
used_pairs[npair] = true;
for (int nmax = 0; nmax < lma_corr_weights.length; nmax++) { // use same blurred version for all max-es
int num_pair_samples = 0;
for (int i = 0; i < lma_corr_weights[nmax][npair].length; i++) if (lma_corr_weights[nmax][npair][i] > 0.0) {
num_pair_samples++;
}
if (num_pair_samples < imgdtt_params.bimax_min_num_samples) {
lma_corr_weights[nmax][npair] = null;
used_pairs[npair] = false;
}
}
if (used_pairs[npair]) {
num_used_pairs++;
}
}
if (num_used_pairs < imgdtt_params.bimax_min_num_pairs) {
return null;
......
......@@ -1751,6 +1751,7 @@ public class ImageDtt extends ImageDttCPU {
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
final boolean use_rms, // DISPARITY_STRENGTH_INDEX means LMA RMS (18/04/2023)
final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
final double [][][][] ddnd, // [tilesY][tilesX][num_sensors][2] data for LY. Should be either null or [tilesY][tilesX][][]. disparity_map should be non-null
final boolean run_lma, // calculate LMA, false - CM only
......@@ -1929,12 +1930,22 @@ public class ImageDtt extends ImageDttCPU {
if (disparity_map != null){ // only slices that are needed, keep others
boolean use_bimax = imgdtt_params.bimax_dual_LMA;
ArrayList<Integer> used_slices = new ArrayList<Integer>();
for (int i : new int[] {DISPARITY_INDEX_CM, DISPARITY_INDEX_CM+1,DISPARITY_STRENGTH_INDEX}) used_slices.add(i);
if (run_lma) for (int i : new int[] {DISPARITY_INDEX_POLY,DISPARITY_INDEX_POLY+1}) used_slices.add(i);
for (int i : new int[] {DISPARITY_INDEX_CM, DISPARITY_INDEX_CM+1,DISPARITY_STRENGTH_INDEX}) {
used_slices.add(i);
}
if (run_lma) for (int i : new int[] {DISPARITY_INDEX_POLY,DISPARITY_INDEX_POLY+1}) {
used_slices.add(i);
}
if (use_bimax) used_slices.add(DISPARITY_VARIATIONS_INDEX);
ArrayList<Integer> nan_slices = new ArrayList<Integer>();
nan_slices.add(DISPARITY_INDEX_CM);
if (run_lma) nan_slices.add(DISPARITY_INDEX_POLY);
if (run_lma) {
nan_slices.add(DISPARITY_INDEX_POLY);
if (use_rms) {
nan_slices.add(DISPARITY_STRENGTH_INDEX); // will be used for RMS if LMA succeeded
}
}
for (int indx:used_slices) {
disparity_map[indx] = new double[tilesY*tilesX];
}
......@@ -1958,6 +1969,7 @@ public class ImageDtt extends ImageDttCPU {
if (fcorr_td[tileY][tileX] == null) {
continue; // nothing accumulated for this tile
}
double lma_rms = Double.NaN;
// boolean dbg_val=globalDebugLevel>100;
nTile = tileY * tilesX + tileX;
if (tp_tasks[iTile].getTask() == 0) continue; // nothing to do for this tile
......@@ -2190,6 +2202,7 @@ public class ImageDtt extends ImageDttCPU {
((lma_dual== null)? "null": " not null"));
}
if (lma_dual != null) {
lma_rms = lma_dual.getRmsTile()[0];
boolean dbg_dispStrs = (debug_lma != null);
double [][][] dispStrs = lma_dual.lmaDisparityStrengths( //TODO: add parameter to filter out negative minimums ?
dbg_dispStrs, // false, // boolean bypass_tests, // keep even weak for later analysis. Normally - only in test mode
......@@ -2251,6 +2264,9 @@ public class ImageDtt extends ImageDttCPU {
// set BG to DISPARITY_INDEX_CM/DISPARITY_INDEX_CM+1
disparity_map[DISPARITY_INDEX_CM ][nTile] = disp_str_lma[1-indx][0]; // disparity LMA
disparity_map[DISPARITY_INDEX_CM + 1][nTile] = disp_str_lma[1-indx][2]; // strength LMA
if (use_rms) {
disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = lma_rms;
}
if (debugTile1) { // FIXME: remove debugTile1!
System.out.println("clt_process_tl_correlations() disp_str_lma:");
for (int nmax = 0; nmax < disp_str_lma.length; nmax++) {
......@@ -2263,7 +2279,11 @@ public class ImageDtt extends ImageDttCPU {
} else {
disparity_map[DISPARITY_INDEX_CM ][nTile] = disp_str_sel[0][0]; // disparity non-LMA
disparity_map[DISPARITY_INDEX_CM + 1 ][nTile] = disp_str_sel[0][1]; // strength non-LMA;
disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = disp_str_sel[0][1]; // strength non-LMA;
if (use_rms) {
disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = lma_rms;
} else {
disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = disp_str_sel[0][1]; // strength non-LMA;
}
if ((disp_str_lma!=null) && (disp_str_lma.length>0)) {
if (disp_str_lma.length == 1) {
if (!Double.isNaN(disp_str_lma[0][0])) {
......@@ -2301,7 +2321,9 @@ public class ImageDtt extends ImageDttCPU {
disp_str = new double [] {-corr_stat[0], corr_stat[1]};
disparity_map[DISPARITY_INDEX_CM ][nTile] = disp_str[0];
disparity_map[DISPARITY_INDEX_CM + 1 ][nTile] = disp_str[1];
disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = disp_str[1];
if (!use_rms) {
disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = disp_str[1];
}
}
}
} // if (imgdtt_params.bimax_dual_LMA) else
......@@ -2346,6 +2368,7 @@ public class ImageDtt extends ImageDttCPU {
}
double [][] ds = null;
if (lma2 != null) {
lma_rms = lma2.getRmsTile()[0];
ds = lma2.lmaDisparityStrength(
false, // boolean bypass_tests, // keep even weak for later analysis. Normally - only in test mode
imgdtt_params.lmas_min_amp, // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
......@@ -2363,7 +2386,11 @@ public class ImageDtt extends ImageDttCPU {
// if (disparity_map!=null) {
disparity_map[DISPARITY_INDEX_POLY ][nTile] = ds[0][0];
disparity_map[DISPARITY_INDEX_POLY + 1][nTile] = ds[0][2]; // LMA strength as is
disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = ds[0][1]; // overwrite with LMA strength
if (use_rms) {
disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = lma_rms;
} else {
disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = ds[0][1]; // overwrite with LMA strength
}
// }
if (ddnd != null) {
ddnd[tileY][tileX] = lma2.getDdNd();
......
......@@ -36,6 +36,7 @@ public class IntersceneMatchParameters {
// Maybe add parameters to make sure there is enough data? Enough in each zone? Enough spread?
public boolean force_ref_dsi = false; // true;
public boolean force_orientations = false;
public boolean run_ly = false; // will return just after LY adjustments, skipping all output generation
public int min_num_orient = 2; // make from parameters, should be >= 1
public int min_num_interscene = 2; // make from parameters, should be >= 1
......@@ -374,6 +375,8 @@ public class IntersceneMatchParameters {
"Calculate reference scene DSI even if the file exists.");
gd.addCheckbox ("Force egomotion calculation", this.force_orientations,
"Calculate relative poses of each scene camera relative to the reference scene even if the data exists.");
gd.addCheckbox ("Run LY adjustments", this.run_ly,
"Adjust cameras orientations (after building DSI) and exit without generatin result files.");
gd.addNumericField("Minimal number of egomotion calculations",this.min_num_orient, 0,3,"",
"Minimal number of fitting scenes cycles, should be >=1. First cycle includes spiral search for the first scene");
gd.addNumericField("Minimal number of interscene accumulations", this.min_num_interscene, 0,3,"",
......@@ -963,6 +966,7 @@ public class IntersceneMatchParameters {
public void dialogAnswers(GenericJTabbedDialog gd) {
this.force_ref_dsi = gd.getNextBoolean();
this.force_orientations = gd.getNextBoolean();
this.run_ly = gd.getNextBoolean();
this.min_num_orient = (int) gd.getNextNumber(); if (min_num_orient < 1) min_num_orient = 1;
this.min_num_interscene = (int) gd.getNextNumber(); if (min_num_interscene < 1) min_num_interscene = 1;
this.generate_mapped = gd.getNextBoolean();
......@@ -1280,6 +1284,7 @@ public class IntersceneMatchParameters {
public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"force_ref_dsi", this.force_ref_dsi + ""); // boolean
properties.setProperty(prefix+"force_orientations", this.force_orientations + ""); // boolean
properties.setProperty(prefix+"run_ly", this.run_ly + ""); // boolean
// properties.setProperty(prefix+"readjust_orient", this.readjust_orient + ""); // boolean
// properties.setProperty(prefix+"force_interscene", this.force_interscene + ""); // boolean
properties.setProperty(prefix+"min_num_orient", this.min_num_orient+""); // int
......@@ -1556,6 +1561,7 @@ public class IntersceneMatchParameters {
public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"force_ref_dsi")!=null) this.force_ref_dsi=Boolean.parseBoolean(properties.getProperty(prefix+"force_ref_dsi"));
if (properties.getProperty(prefix+"force_orientations")!=null) this.force_orientations=Boolean.parseBoolean(properties.getProperty(prefix+"force_orientations"));
if (properties.getProperty(prefix+"run_ly")!=null) this.run_ly=Boolean.parseBoolean(properties.getProperty(prefix+"run_ly"));
if (properties.getProperty(prefix+"min_num_orient")!=null) this.min_num_orient=Integer.parseInt(properties.getProperty(prefix+"min_num_orient"));
if (properties.getProperty(prefix+"min_num_interscene")!=null) this.min_num_interscene=Integer.parseInt(properties.getProperty(prefix+"min_num_interscene"));
if (properties.getProperty(prefix+"generate_mapped")!=null) this.generate_mapped=Boolean.parseBoolean(properties.getProperty(prefix+"generate_mapped"));
......@@ -1855,8 +1861,7 @@ public class IntersceneMatchParameters {
IntersceneMatchParameters imp = new IntersceneMatchParameters();
imp.force_ref_dsi = this.force_ref_dsi;
imp.force_orientations = this.force_orientations;
// imp.readjust_orient = this.readjust_orient;
// imp.force_interscene = this.force_interscene;
imp.run_ly = this.run_ly;
imp.min_num_orient = this.min_num_orient;
imp.min_num_interscene = this.min_num_interscene;
imp.generate_mapped = this.generate_mapped;
......
......@@ -105,6 +105,7 @@ public class MultisceneLY {
double [] inf_avg,
boolean debug
) {
TileNeibs tn = new TileNeibs(tp.getTilesX(), tp.getTilesY());
int num_bins = 256;
int [] hist = new int [num_bins];
double [][] dbg_img = debug? (new double[2][]): null;
......@@ -168,20 +169,22 @@ public class MultisceneLY {
}
}
// grow sure fg
tp.growTiles(
// tp.growTiles(
tn.growSelection(
2, // int grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
is_fg, // boolean [] tiles,
null); // boolean [] prohibit)
// Remove even core infinity if it is expanden FG
// Remove even core infinity if it is expanded FG
for (int nTile = 0; nTile < is_inf.length; nTile++) {
is_inf[nTile] &= !is_fg[nTile];
}
tp.growTiles(
// tp.growTiles(
tn.growSelection(
2, // int grow, // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
is_inf, // boolean [] tiles,
is_fg); // boolean [] prohibit)
// uses deprecated - update with tn.growSelection
tp.fillGaps( // grows, then shrinks
2, // int depth, // same as grow - odd - 4 directions, even - 8
true, // false, // boolean poison, // do not fill gaps that even touch prohibited
......@@ -390,7 +393,6 @@ public class MultisceneLY {
for (int nscene = 0; nscene < num_scenes; nscene++) {
target_disparities[nscene] = scenes[nscene].getDSRBG()[0];
Arrays.fill(rslt_disparities[nscene], Double.NaN);
}
final Thread[] threads = ImageDtt.newThreadArray(threadsMax);
final AtomicInteger ai = new AtomicInteger(0);
......@@ -1017,8 +1019,9 @@ public class MultisceneLY {
tp_tasks_combo); // final TpTask[] tp_tasks
double [][][] dcorr_tiles = show_corr? (new double [tp_tasks_combo.length][][]):null;
final double[][] disparity_map = new double [image_dtt.getDisparityTitles().length][];
final double[][] disparity_map = new double [image_dtt.getDisparityTitles().length][];
final double [][][][] ddnd = new double [tilesY][tilesX][][];
// Does not use disparity_map[DISPARITY_STRENGTH_INDEX]
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
fcorr_td_acc, // final float [][][][] fcorr_td, // [tilesY][tilesX][pair][4*64] transform domain representation of all selected corr pairs
......@@ -1037,6 +1040,7 @@ public class MultisceneLY {
// 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
false, // final boolean use_rms, // DISPARITY_STRENGTH_INDEX means LMA RMS (18/04/2023)
//optional, may be null
disparity_map, // final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
ddnd, // [tilesY][tilesX][num_sensors][2] data for LY. Should be either null or [tilesY][tilesX][][]. disparity_map should be non-null
......
......@@ -13963,6 +13963,7 @@ public class QuadCLTCPU {
// 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
false, // final boolean use_rms, // DISPARITY_STRENGTH_INDEX means LMA RMS (18/04/2023)
//optional, may be null
disparity_map, // final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
null, // final double [][] ddnd, // data for LY. SHould be either null or [num_sensors][]
......
......@@ -11428,12 +11428,14 @@ if (debugLevel > -100) return true; // temporarily !
updateStatus, // boolean updateStatus,
debugLevel); // int debugLevel)
}
boolean proc_infinity = (adjust_mode == MultisceneLY.MSLY_MODE.INF_ONLY) || (adjust_mode == MultisceneLY.MSLY_MODE.INF_NOINF); // true;
boolean lma_only = true; // use clt_parameters
double dbg_disparity_offset = 0.0; // 0.1
double inf_disp_ref = 0.0;
// int last_scene_index = quadCLTs.length-1;
int ref_scene_index = quadCLTs.length-1;
if (pattern_mode) {
......@@ -11441,8 +11443,6 @@ if (debugLevel > -100) return true; // temporarily !
}
// QuadCLT last_scene = quadCLTs[last_scene_index];
QuadCLT ref_scene = quadCLTs[ref_scene_index];
String composite_suffix = "-INTER-INTRA-LMA"; // is already read if available!
String num_corr_max_suffix = "-NUM-CORR-MAX";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment