Commit b6394c1f authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Before changing far split format

parent 1ddf4e46
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -267,9 +267,9 @@ public class BiQuadParameters {
	public double  fsplit_neib_str =           0.4; // minimal strength of the neighbor to compare
	public double  fsplit_neib_diff =          1.5; // *** maximal disparity difference to neighbor to use 
	public double  fsplit_disp =               3.0; // maximal tile disparity to consider split.
	public double  fsplit_adiff =              0.04;// minimal tile (combo) absolute disparity difference from neighbors
	public double  fsplit_rdiff =              0.1; // minimal tile (combo) relative disparity difference from neighbors
	public double  fsplit_kfg_min =            0.1; // *** minimal fraction of kfg and (1.0-kfg)
	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)
	
	public boolean mll_generate_scene_outlines = false; // Uses 2 GB - change format, add dimensions (separate color for ref)
	
+2 −2
Original line number Diff line number Diff line
@@ -1961,9 +1961,9 @@ public class ImageDtt extends ImageDttCPU {
//							boolean dbg_val=globalDebugLevel>100;
							nTile = tileY * tilesX + tileX;
							if (tp_tasks[iTile].getTask() == 0) continue; // nothing to do for this tile
							boolean debugTile0 =(tileX == debug_tileX) && (tileY == debug_tileY) && (globalDebugLevel > 0); // 1);
							boolean debugTile0 =(tileX == debug_tileX) && (tileY >= debug_tileY) && (tileY < (debug_tileY+3)) && (globalDebugLevel > 0); // 1);
							debugTile0 |=(tileX == debug_tileX-1) && (tileY == debug_tileY) && (globalDebugLevel > 0); // 1);
							boolean debugTile1 =(tileX == debug_tileX) && (tileY == debug_tileY) && (globalDebugLevel > -10);
							boolean debugTile1 =(tileX == debug_tileX) && (tileY >= debug_tileY) && (tileY < (debug_tileY+3)) && (globalDebugLevel > -10);
							if (debugTile0) {
								System.out.println("clt_process_tl_correlations(): tileX="+tileX+", tileY="+tileY+", iTile="+iTile+", nTile="+nTile);
							}
+83 −63
Original line number Diff line number Diff line
@@ -8142,6 +8142,8 @@ public class OpticalFlow {
			dbg_corr_scale = new double[max_refines][];
		}
		boolean [] selection = new boolean [target_disparity.length];
		int nTiles = selection.length;
		for (int i = 0; i < target_disparity.length; i++) {
			selection[i] = !Double.isNaN(target_disparity[i]);
		}
@@ -8153,10 +8155,10 @@ public class OpticalFlow {
		boolean bg_refine= false;
		final double [][] far_fgbg = new double [selection.length][];
		final double [][] pre_split_ds = new double [2][];
		double [][] far_fg_ds = null;
		double [][] far_bg_ds = null;
		boolean [] sel_split = new boolean [selection.length];
		double [][] far_fg_ds = new double[2][];
		double [][] far_bg_ds = new double[2][];
		
		boolean [] far_split = null; // new boolean [nTiles];
		for (int nrefine = 0; nrefine < max_refines; nrefine++) {
			if (nrefine == clt_parameters.rig.mll_max_refines_pre) {
				min_disp_change = clt_parameters.rig.mll_min_disp_change_lma;				
@@ -8195,10 +8197,17 @@ public class OpticalFlow {
			double [][] avg_ds = new double[][] {
				combo_dsn_final[COMBO_DSN_INDX_DISP],
				combo_dsn_final[COMBO_DSN_INDX_STRENGTH]};
			int split_src = -1;
			if (split_pass >= 0) {
				int split_src = 0; // avg
				if (split_pass == 0) {
					split_src= 0 ; // AVG
				} else if (split_pass == 1) {
					split_src= 1 ; clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_FG;
					target_disparity=far_fg_ds[0];
				} else { //  if (split_pass == 2) {
					split_src= 2 ; clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_BG;
					target_disparity=far_bg_ds[0];
				}
				// 04/11/2023: always outputs both FG and BG
				clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_FG;
				sel_split = calcFarFgBg(
@@ -8214,29 +8223,21 @@ public class OpticalFlow {
						fsplit_kfg_min,  // final double        fsplit_kfg_min,  // minimal fraction of kfg and (1.0-kfg)
						far_fgbg,        // final double [][]   far_fgbg,        // should be initialized to [nTiles][?]
						avg_ds,          // final double [][]   avg_ds,          // always defined, used for selection
							null,            // final double [][]   fg_ds,
							null,            // final double [][]   bg_ds,
							null,            // final boolean []    selection,    // may be null, does not apply to neighbors
						far_fg_ds,       // final double [][]   fg_ds,
						far_bg_ds,       // final double [][]   bg_ds,
						far_split, // null,            // final boolean []    selection,    // may be null, does not apply to neighbors
						tilesX,          //	final int           tilesX,
						ref_scene.getImageName()+"-FGBG"); // final String        dbg_title);
				//far_split
				selection = sel_split; // for correlateInterscene()
				} else if (split_pass == 1) {
					// 04/11/2023: always outputs both FG and BG
					split_src = 1; clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_FG; break;
					/*
					switch (fsplit_mode) {
					case 1: split_src = 1; clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_FG; break;
					case 2: split_src = 1; clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_BG; break;
					case 3: split_src = 0; clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_BG; break;
					}
					 */
				} else if (split_pass == 2) { // only for fsplit_mode == 1
					// 04/11/2023: always outputs both FG and BG
					split_src = 2; clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_BG;
				if (split_src == 0) {
					far_fg_ds = new double[2][];
					far_bg_ds = new double[2][];
					far_fg_ds[0] = new double[nTiles];
					far_bg_ds[0] = new double[nTiles];
					Arrays.fill(far_fg_ds[0], Double.NaN);
					Arrays.fill(far_bg_ds[0], Double.NaN);
				}
				//				boolean [] sel_fgbg = 
			}
			int mcorr_sel = Correlation2d.corrSelEncode(clt_parameters.img_dtt,num_sensors);
			double [][] disparity_map = 
@@ -8274,25 +8275,21 @@ public class OpticalFlow {
			double [] map_far_fg_strength =  disparity_map[ImageDtt.DISPARITY_INDEX_POLY+1];
			double [] map_far_bg_disparity = disparity_map[ImageDtt.DISPARITY_INDEX_CM];
			double [] map_far_bg_strength =  disparity_map[ImageDtt.DISPARITY_INDEX_CM+1];
			if (split_pass >= 0) {
				int nTiles = selection.length;
				boolean [] far_split = new boolean [nTiles];
//				double [][] far_fg_ds = new double[2][];
//				double [][] far_bg_ds = new double[2][];
				if (far_split == null) {
					far_split = new boolean [nTiles];
				}
//				Arrays.fill(far_split, false);
//				boolean [] far_split = new boolean [nTiles];
				double [][] far_fg_ds_merge = new double[2][];
				double [][] far_bg_ds_merge = new double[2][];
				
				
				far_fg_ds[0] = new double[nTiles];
				far_bg_ds[0] = new double[nTiles];
				Arrays.fill(far_fg_ds[0], Double.NaN);
				Arrays.fill(far_bg_ds[0], Double.NaN);
				far_fg_ds_merge[0] = avg_ds[0].clone();
				far_bg_ds_merge[0] = avg_ds[0].clone();
				far_fg_ds_merge[1] = avg_ds[1].clone();
				far_bg_ds_merge[1] = avg_ds[1].clone();
				
				// single-threaded 
				if (split_src == 0) {
					for (int tile = 0; tile < nTiles; tile++) {
						if (!Double.isNaN(map_far_fg_disparity[tile]) && !Double.isNaN(map_far_bg_disparity[tile])) {
							far_split[tile] = true;
@@ -8304,6 +8301,26 @@ public class OpticalFlow {
							far_bg_ds_merge[1][tile] = map_far_bg_strength[tile]; 
						}
					}
				} else if (split_src == 1) {
					for (int tile = 0; tile < nTiles; tile++) {
						if (!Double.isNaN(map_far_fg_disparity[tile])) {
							far_split[tile] = true;
							far_fg_ds[0][tile] += map_far_fg_disparity[tile];  
							far_fg_ds_merge[0][tile] = far_fg_ds[0][tile]; 
							far_fg_ds_merge[1][tile] = map_far_fg_strength[tile]; 
						}
					}
				} else if (split_src == 2) {
					for (int tile = 0; tile < nTiles; tile++) {
						if (!Double.isNaN(map_far_bg_disparity[tile])) {
							far_split[tile] = true;
							far_bg_ds[0][tile] += map_far_bg_disparity[tile];
							far_bg_ds_merge[0][tile] = far_bg_ds[0][tile]; 
							far_bg_ds_merge[1][tile] = map_far_bg_strength[tile]; 
						}
					}
				}
				
				far_fg_ds[1] = map_far_fg_strength;
				far_bg_ds[1] = map_far_bg_strength;
				if (debug_level > 0) { //-3) {
@@ -8388,7 +8405,9 @@ public class OpticalFlow {
							"bg_str_predicted_only", // 15
							"fg_str_predicted_err",  // 16
							"bg_str_predicted_err",  // 17
							"sel"};                  // 16  
							"sel",                   // 18
							"target_disparity"};     // 19
					double [][] dbg_img = new double[dbg_far_spit_titles.length][];
					dbg_img[ 0] = avg_ds[0];
					dbg_img[ 1] = far_fg_ds_merge[0];
@@ -8413,13 +8432,14 @@ public class OpticalFlow {
						// update index below !
						dbg_img[18][tile] = (selection[tile] ? 0.5:0.0) + (far_split[tile] ? 0.6:0.0); 	
					}
					dbg_img[19] = target_disparity;
					
					ShowDoubleFloatArrays.showArrays(
							dbg_img,
							tilesX,
							tilesY,
							true,
							"far-split"+nrefine,
							"far-split"+split_pass,
							dbg_far_spit_titles);
				}