Commit 8d033226 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Optional common gains for all pairs

parent c3ee5b3f
Loading
Loading
Loading
Loading
+131 −22
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public class Corr2dLMA {

	private double []         last_rms =        null; // {rms, rms_pure}, matching this.vector
	private double []         good_or_bad_rms = null; // just for diagnostics, to read last (failed) rms
	private double []         initial_rms =     null; // {rms, rms_pure}, first-calcualted rms
	private double []         initial_rms =     null; // {rms, rms_pure}, first-calculated rms
	private double []         last_ymfx =       null;
	private double [][]       last_jt =         null;

@@ -121,7 +121,8 @@ public class Corr2dLMA {

	private int []            used_cams_rmap; // variable-length list of used cameras numbers
	private int [][]          used_pairs_map; // [tile][pair] -1 for unused pairs, >=0 for used ones
	
	private boolean []        last_common_scale = null; //When switching from common to individual the
	                                                    // scale[0] is cloned, reverse - averaged to [0]
	private boolean []        used_tiles;

	private final int         transform_size;
@@ -882,6 +883,7 @@ public class Corr2dLMA {
	 * Set/modify parameters mask. May be called after preparePars () or after updateFromVector() if LMA was ran
	 * @param adjust_disparities null to adjust all (1 or 2) disparities or a boolean array of per maximum
	 *                           individual disparity adjusts
	 * @param common_scales per-maximum, if true - common scale for all pairs. Null - all individual (old mode)                         
	 * @param adjust_width adjust correlation maximum width      
	 * @param adjust_scales adjust per-pair amplitude
	 * @param adjust_ellipse adjust per-pair maximum shape as an ellipse
@@ -891,8 +893,9 @@ public class Corr2dLMA {
	 * @param cost_lazyeye_odtho cost of lazy eye orthogonal to disparity
	 * @return OK/failure
	 */
	public boolean setParMask( // USED in lwir
	public boolean setParMask(
			boolean [] adjust_disparities, // null - adjust all, otherwise - per maximum
			boolean [] common_scale,       // per-maximum, if true - common scale for all pairs
			boolean adjust_width,          // adjust width of the maximum -                                           lma_adjust_wm
			boolean adjust_scales,         // adjust 2D correlation scales -                                          lma_adjust_ag
			boolean adjust_ellipse,        // allow non-circular correlation maximums                                 lma_adjust_wy
@@ -905,17 +908,56 @@ public class Corr2dLMA {
			adjust_disparities = new boolean[numMax];
			Arrays.fill(adjust_disparities, true);
		}
		if (common_scale == null) {
			common_scale = new boolean[numMax];
			Arrays.fill(common_scale, false);
		}
		if (last_common_scale == null) { // first time - same as it was {false, ...,false}
			last_common_scale = new boolean[numMax];
			Arrays.fill(last_common_scale, false);
		}
		
		total_tiles = 0; // now
		// per-tile parameters
		for (int nTile = 0; nTile < numTiles; nTile++) if (used_tiles[nTile]) {
			for (int nmax = 0; nmax < numMax; nmax++) {
				int offs = (nTile * numMax + nmax) * tile_params;
				// Do scales need to be changed??
				if (common_scale[nmax] != last_common_scale[nmax]) {
					double cs = 0.0;
					// Do scales need to be averaged into [0]?
					if (common_scale[nmax]) {
						int num_used_pairs = 0;
						for (int np = 0; np <num_pairs; np++) if (used_pairs[nTile][np]) {
							//this.all_pars[G0_INDEX + i + offs] = Double.NaN; // will be assigned later for used - should be for all !
							cs += this.all_pars[G0_INDEX + np + offs];
							num_used_pairs++;
						}
						if (num_used_pairs > 0) {
							cs /= num_used_pairs;
						}
					} else { // need to be copied
						cs = this.all_pars[G0_INDEX + 0 + offs];
					}
					for (int np = 0; np <num_pairs; np++) { //  if (used_pairs[nTile][np]) {
						this.all_pars[G0_INDEX + np + offs] = cs;
					}						
					last_common_scale[nmax] = common_scale[nmax];
				}
				
				this.par_mask[DISP_INDEX + offs] = adjust_disparities[nmax];//  true;
				this.par_mask[A_INDEX    + offs] = adjust_width;
				this.par_mask[B_INDEX    + offs] = adjust_ellipse;
				this.par_mask[CMA_INDEX  + offs] = adjust_ellipse;
				for (int i = 0; i <num_pairs; i++) {
					this.par_mask[G0_INDEX + i + offs] = used_pairs[nTile][i] & adjust_scales;
				if (last_common_scale[nmax]) {
					this.par_mask[G0_INDEX + 0 + offs] = adjust_scales;
					for (int np = 1; np <num_pairs; np++) {
						this.par_mask[G0_INDEX + np + offs] = false;
					}
				} else  {
					for (int np = 0; np <num_pairs; np++) {
						this.par_mask[G0_INDEX + np + offs] = used_pairs[nTile][np] & adjust_scales;
					}
				}
			}
			total_tiles++;
@@ -1201,7 +1243,9 @@ public class Corr2dLMA {
				double B = BT[nmax][s.tile];
				double C = CT[nmax][s.tile];

				double Gp = av[G0_INDEX + pair + offs];
				int cpair = last_common_scale[nmax]? 0: pair;
				double Gp = av[G0_INDEX + cpair + offs]; // either common or individual;

				double Wp = corr_wnd[s.ix][s.iy];
				double WGp = Wp * Gp;
				//			double xmxp = s.ix - xp_yp[s.tile][s.fcam][s.scam][0];
@@ -1234,11 +1278,19 @@ public class Corr2dLMA {
					if (par_map[CMA_INDEX + offs] >= 0) {
						jt[par_map[CMA_INDEX + offs]][ns] = -WGp* ymyp2;
					}
					
					if (last_common_scale[nmax]) {
						if (par_map[G0_INDEX + 0 + offs] >= 0) {
							jt[par_map[G0_INDEX + 0 + offs]][ns] = d; // (par_mask[G0_INDEX + pair])? d;
						}
					} else {
						for (int p = 0; p < num_pairs; p++) { // par_mask[G0_INDEX + p] as all pairs either used, or not - then npairs == 0
							if (par_map[G0_INDEX + p + offs] >= 0) {
								jt[par_map[G0_INDEX + p + offs]][ns] = (p== pair)? d : 0.0; // (par_mask[G0_INDEX + pair])? d;
							}
						}
					}
					
					if (lazy_eye) {
						if (nmax == 0) { // only zero during first pass, then accumulate only
							for (int f = 0; f < num_cams; f++)  { // -1 for the last_cam and pre_last_cam
@@ -1382,7 +1434,9 @@ public class Corr2dLMA {
				double B = BT[nmax][s.tile];
				double C = CT[nmax][s.tile];

				double Gp = av[G0_INDEX + pair + offs];
				int cpair = last_common_scale[nmax]? 0: pair;
				double Gp = av[G0_INDEX + cpair + offs]; // either common or individual;

				double Wp = corr_wnd[s.ix][s.iy];
				double WGp = Wp * Gp;
				//			double xmxp = s.ix - xp_yp[s.tile][s.fcam][s.scam][0];
@@ -1421,12 +1475,27 @@ public class Corr2dLMA {
					if (par_map[CMA_INDEX + offs] >= 0) {
						jt[par_map[CMA_INDEX + offs]][ns] = -WGp * ymyp2 * lim_negative;
					}
					//				for (int p = 0; p < npairs[s.tile]; p++) { // par_mask[G0_INDEX + p] as all pairs either used, or not - then npairs == 0
/*
					for (int p = 0; p < num_pairs; p++) { // par_mask[G0_INDEX + p] as all pairs either used, or not - then npairs == 0
						if (par_map[G0_INDEX + p + offs] >= 0) {
							jt[par_map[G0_INDEX + p + offs]][ns] = (p== pair)? d : 0.0; // (par_mask[G0_INDEX + pair])? d;
						}
					}
*/					
					if (last_common_scale[nmax]) {
						if (par_map[G0_INDEX + 0 + offs] >= 0) {
							jt[par_map[G0_INDEX + 0 + offs]][ns] = d; // (par_mask[G0_INDEX + pair])? d;
						}
					} else {
						for (int p = 0; p < num_pairs; p++) { // par_mask[G0_INDEX + p] as all pairs either used, or not - then npairs == 0
							if (par_map[G0_INDEX + p + offs] >= 0) {
								jt[par_map[G0_INDEX + p + offs]][ns] = (p== pair)? d : 0.0; // (par_mask[G0_INDEX + pair])? d;
							}
						}
					}
					
					
					
					if (lazy_eye) {
						if (nmax == 0) { // only zero during first pass, then accumulate only //   ****
							for (int f = 0; f < num_cams; f++)  { // -1 for the last_cam and pre_last_cam
@@ -1568,7 +1637,8 @@ public class Corr2dLMA {
				double A = AT[nmax][s.tile];
				double B = BT[nmax][s.tile];
				double C = CT[nmax][s.tile];
				double Gp = av[G0_INDEX + pair + offs];
				int cpair = last_common_scale[nmax]? 0: pair;
				double Gp = av[G0_INDEX + cpair + offs]; // either common or individual;
				double Wp = corr_wnd[s.ix][s.iy];
				double WGp = Wp * Gp;
				double xmxp = s.ix - xp_yp[nmax][s.tile][fs[0]][fs[1]][0]; // TODO - change format of xp_yp
@@ -1608,11 +1678,19 @@ public class Corr2dLMA {
					if (par_map[CMA_INDEX + offs] >= 0) {
						jt[par_map[CMA_INDEX + offs]][ns] = -WGp * ymyp2 * lim_negative_2d;
					}

					if (last_common_scale[nmax]) {
						if (par_map[G0_INDEX + 0 + offs] >= 0) {
							jt[par_map[G0_INDEX + 0 + offs]][ns] = d * d; // (par_mask[G0_INDEX + pair])? d;
						}
					} else {
						for (int p = 0; p < num_pairs; p++) { // par_mask[G0_INDEX + p] as all pairs either used, or not - then npairs == 0
							if (par_map[G0_INDEX + p + offs] >= 0) {
								jt[par_map[G0_INDEX + p + offs]][ns] = (p== pair)? (d * d) : 0.0; // (par_mask[G0_INDEX + pair])? d;
							}
						}
					}
					
					if (lazy_eye) {
						if (nmax == 0) { // only zero during first pass, then accumulate only //   ****
							for (int f = 0; f < num_cams; f++)  { // -1 for the last_cam and pre_last_cam
@@ -1751,7 +1829,8 @@ public class Corr2dLMA {
				double A = AT[nmax][s.tile];
				double B = BT[nmax][s.tile];
				double C = CT[nmax][s.tile];
				double Gp = av[G0_INDEX + pair + offs];
				int cpair = last_common_scale[nmax]? 0: pair;
				double Gp = av[G0_INDEX + cpair + offs]; // either common or individual;
				double Wp = corr_wnd[s.ix][s.iy];
				double WGp = Wp * Gp;
				double xmxp = s.ix - xp_yp[nmax][s.tile][fs[0]][fs[1]][0];
@@ -1793,9 +1872,22 @@ public class Corr2dLMA {
					if (par_map[A_INDEX + offs] >= 0)          jt[par_map[A_INDEX + offs]][ns] = -WGpexp*(xmxp2 + ymyp2);
					if (par_map[B_INDEX + offs] >= 0)          jt[par_map[B_INDEX + offs]][ns] = -WGpexp* 2 * xmxp_ymyp;
					if (par_map[CMA_INDEX + offs] >= 0)        jt[par_map[CMA_INDEX + offs]][ns] = -WGpexp* ymyp2;
					/*
					for (int p = 0; p < npairs[s.tile]; p++) { // par_mask[G0_INDEX + p] as all pairs either used, or not - then npairs == 0
						if (par_map[G0_INDEX + p + offs] >= 0) jt[par_map[G0_INDEX + p + offs]][ns] = (p== pair)? comm : 0.0; // (par_mask[G0_INDEX + pair])? d;
					}
					*/
					if (last_common_scale[nmax]) {
						if (par_map[G0_INDEX + 0 + offs] >= 0) {
							jt[par_map[G0_INDEX + 0 + offs]][ns] = comm; // (par_mask[G0_INDEX + pair])? d;
						}
					} else {
						for (int p = 0; p < num_pairs; p++) { // par_mask[G0_INDEX + p] as all pairs either used, or not - then npairs == 0
							if (par_map[G0_INDEX + p + offs] >= 0) {
								jt[par_map[G0_INDEX + p + offs]][ns] = (p== pair)? comm : 0.0; // (par_mask[G0_INDEX + pair])? d;
							}
						}
					}
					
					// process ddisp (last camera not used, is equal to minus sum of others to make a sum == 0)
					if (lazy_eye) {
@@ -2498,6 +2590,7 @@ public class Corr2dLMA {
		return rslt;
	}

	// has common threshold for scale ratios for foreground and background corr. maximums
	public double [][] lmaDisparityStrength(
			double  lmas_min_amp,     // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
			double  lma_max_rel_rms,  // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
@@ -2509,7 +2602,8 @@ public class Corr2dLMA {
			double  lma_str_offset    // convert lma-generated strength to match previous ones - add to result
			){
		return lmaDisparityStrengths(
				lmas_min_amp,     // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
				lmas_min_amp,     // double  lmas_min_amp_fg,  // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
				lmas_min_amp,     // double  lmas_min_amp_bg,  // Same for bg correlation max (only used for multi-max)
				lma_max_rel_rms,  // maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
				lma_min_strength, // minimal composite strength (sqrt(average amp squared over absolute RMS)
				lma_min_max_ac,   // minimal of A and C coefficients maximum (measures sharpest point/line)
@@ -2518,11 +2612,12 @@ public class Corr2dLMA {
				lma_str_scale,    // convert lma-generated strength to match previous ones - scale
				lma_str_offset    // convert lma-generated strength to match previous ones - add to result
				)[0];

	}

	// has separate thresholds for scale ratios for foreground and background corr. maximums
	public double [][][] lmaDisparityStrengths(
			double  lmas_min_amp,     // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
			double  lmas_min_amp_fg,  // minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
			double  lmas_min_amp_bg,  // Same for bg correlation max (only used for multi-max)
			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_max_ac,   // minimal of A and C coefficients maximum (measures sharpest point/line)
@@ -2545,6 +2640,20 @@ public class Corr2dLMA {
				if (maxmin_amp[tile][1] < 0.0) {
					continue; // inverse maximum - discard tile
				}
				double lmas_min_amp = lmas_min_amp_fg;
				double disparity = -all_pars[DISP_INDEX + offs];
				if (numMax > 1) {
					for (int nmax1 = 0; nmax1 < numMax; nmax1++) if (nmax1 != nmax){
						int offs1 = (tile * numMax + nmax1) * tile_params;
						double disparity1 = -all_pars[DISP_INDEX + offs1];
						if (disparity1 > disparity) {
							lmas_min_amp = lmas_min_amp_bg;
							break;
						}
						
						
					}
				}
				if ((maxmin_amp[tile][1]/maxmin_amp[tile][0]) < lmas_min_amp) {
					continue; // inverse maximum - discard tile
				}
@@ -2570,7 +2679,7 @@ public class Corr2dLMA {

				}
				double strength = Math.sqrt(avg/rrms);
				double disparity = -all_pars[DISP_INDEX + offs];
//				double disparity = -all_pars[DISP_INDEX + offs];
				if ((strength < lma_min_strength) || Double.isNaN(disparity)) {
					continue;
				}
+29 −21
Original line number Diff line number Diff line
@@ -4410,14 +4410,7 @@ public class Correlation2d {
    	
    	boolean debug_graphic = imgdtt_params.lma_debug_graphic && (imgdtt_params.lma_debug_level1 > 3) && (debug_level > 0) ;
    	debug_graphic |= imgdtt_params.lmamask_dbg && (debug_level > 0) ;
    	// TODO: Remove me
    	debug_graphic |= true;
    	/*
		String dbg_title = null;
    	if (debug_graphic) {
			dbg_title = String.format("tX%d_tY%d",tileX,tileY);
		}
		*/

    	double [][] dbg_corr =    debug_graphic ? new double [corrs.length][] : null;
    	DoubleGaussianBlur gb = null;
    	if (imgdtt_params.lma_sigma > 0) gb = new DoubleGaussianBlur();
@@ -4449,50 +4442,69 @@ public class Correlation2d {
    	double [][]   disp_str_all;
    	double [][][] own_masks;
    	double [][][] pair_offsets;
		boolean [] common_scale; //  = {false,false}; // true}; {true,true}; // // TODO: implement
    	
    	if (lma_corr_weights0.length < 2) {
    		pair_offsets =     pair_offsets0;
    		lma_corr_weights = lma_corr_weights0;
    		disp_str_all =     disp_str_dual;
    		own_masks =        own_masks0;
    	} else {
    		int nearest_max = (Math.abs(disp_str_dual[0][0]) < Math.abs(disp_str_dual[0][0]))? 0 : 1;
    		int fg_max =  (disp_str_dual[0][0] > disp_str_dual[0][0]) ? 0 : 1;
    		common_scale = new boolean[] {imgdtt_params.bimax_common_fg};
    	} else { // only 2 max are supported
    		if (lma_corr_weights0.length > 2) {
    			System.out.println("corrLMA2DualMax(): Only 2 correlation maximums are currently supported, all but 2 strongest are discarded");
    		}
    		int nearest_max = (Math.abs(disp_str_dual[0][0]) < Math.abs(disp_str_dual[1][0]))? 0 : 1;
    		int fg_max =  (disp_str_dual[0][0] > disp_str_dual[1][0]) ? 0 : 1;
    		
    		switch (combine_mode) {
    		case 0: // keep both
        		pair_offsets =     pair_offsets0;
    			lma_corr_weights = lma_corr_weights0; 
    			disp_str_all =     disp_str_dual;
        		own_masks =        own_masks0;
        		common_scale = new boolean[disp_str_dual.length];
        		for (int i = 0; i < common_scale.length; i++) {
        			common_scale[i] = (i == fg_max) ? imgdtt_params.bimax_common_fg : imgdtt_params.bimax_common_bg; 
        		}
    			break; 
    		case 1: // keep strongest
        		pair_offsets =     new double [][][] {pair_offsets0    [0]};
    			lma_corr_weights = new double [][][] {lma_corr_weights0[0]};
    			disp_str_all =     new double [][]   {disp_str_dual    [0]};
    			own_masks =        new double [][][] {own_masks0       [0]};
        		common_scale =     new boolean[]     {(0 == fg_max) ? imgdtt_params.bimax_common_fg : imgdtt_params.bimax_common_bg}; 
    			break;
    		case 2: // keep nearest
        		pair_offsets =     new double [][][] {pair_offsets0    [nearest_max]};
    			lma_corr_weights = new double [][][] {lma_corr_weights0[nearest_max]};
    			disp_str_all =     new double [][]   {disp_str_dual    [nearest_max]};
    			own_masks =        new double [][][] {own_masks0       [nearest_max]};
        		common_scale =     new boolean[]     {(nearest_max == fg_max) ? imgdtt_params.bimax_common_fg : imgdtt_params.bimax_common_bg}; 
    			break;
    		case 3: // keep foreground
        		pair_offsets =     new double [][][] {pair_offsets0    [fg_max]};
    			lma_corr_weights = new double [][][] {lma_corr_weights0[fg_max]};
    			disp_str_all =     new double [][]   {disp_str_dual    [fg_max]};
    			own_masks =        new double [][][] {own_masks0       [fg_max]};
        		common_scale =     new boolean[]     {imgdtt_params.bimax_common_fg}; 
    			break;
    		case 4: // keep background
        		pair_offsets =     new double [][][] {pair_offsets0    [1-fg_max]};
    			lma_corr_weights = new double [][][] {lma_corr_weights0[1-fg_max]};
    			disp_str_all =     new double [][]   {disp_str_dual    [1-fg_max]};
    			own_masks =        new double [][][] {own_masks0       [1-fg_max]};
        		common_scale =     new boolean[]     {imgdtt_params.bimax_common_bg}; 
    			break;
    		default: // keep both
        		pair_offsets =     pair_offsets0;
    			lma_corr_weights = lma_corr_weights0;
    			disp_str_all =     disp_str_dual;
    			own_masks =        own_masks0;
        		common_scale = new boolean[disp_str_dual.length];
        		for (int i = 0; i < common_scale.length; i++) {
        			common_scale[i] = (i == fg_max) ? imgdtt_params.bimax_common_fg : imgdtt_params.bimax_common_bg; 
        		}
    		}
    	}
    	
@@ -4505,9 +4517,6 @@ public class Correlation2d {
    	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 (npair == 65) {
//				System.out.println("---npair == "+npair);
//			}
   			if (imgdtt_params.cnvx_en) { //  || (pair_shape_masks == null)) {
   				corr_blur = corrs[npair].clone();
   				if (corr_wnd_inv_limited != null) {
@@ -4655,16 +4664,12 @@ public class Correlation2d {
    	for (int i = 0; i <disp_str_all.length; i++) if (disp_str_all[i] != null){
    		disp_str2[i][0] = disp_str_all[i];
    	}
//   		double [][] disp_str2 = {disp_str_all[0]}; // temporary // will be calculated/set later
    	boolean lmaSuccess = false;
//    	int num_lma_retries = 0;
		
    	// When running LMA - first do not touch disparity?
//    	int lma_pass = imgdtt_params.bimax_dual_pass? 0 : 1; // pass0 - w/o disparity, pass 1 - with
    	boolean [] adjust_disparities = new boolean [disp_str_all.length]; // all false;
    	boolean needprep = true; //t npass = 0;
    	for (int npass = (imgdtt_params.bimax_dual_pass? 00 : 1); npass < 2; npass++) { // may break while (!lmaSuccess) {
 //   		num_lma_retries ++; // debug
    	for (int npass = (imgdtt_params.bimax_dual_pass? 0 : 1); npass < 2; npass++) { // may break while (!lmaSuccess) {
    		if (needprep) {
    			lma.preparePars(
    					disp_str2, // double [][][] disp_str_all,  initial value of disparity [max][tile]{disp, strength}
@@ -4679,8 +4684,10 @@ public class Correlation2d {
    		if (npass > 0) {
    			adjust_disparities = null;
    		}
//    		boolean [] common_scale = {false,false}; // true}; {true,true}; // // TODO: implement
    		lma.setParMask( // USED in lwir
    				adjust_disparities, // null, // 			boolean [] adjust_disparities, // null - adjust all, otherwise - per maximum
    				common_scale,       //boolean [] common_scale,       // per-maximum, if true - common scale for all pairs
    				imgdtt_params.lmas_adjust_wm,  // boolean adjust_width,     // adjust width of the maximum - lma_adjust_wm
    				imgdtt_params.lmas_adjust_ag,  // boolean adjust_scales,    // adjust 2D correlation scales - lma_adjust_ag
    				imgdtt_params.lmas_adjust_wy,  // boolean adjust_ellipse,   // allow non-circular correlation maximums lma_adjust_wy
@@ -4713,6 +4720,7 @@ public class Correlation2d {
			lma.updateFromVector();
			double [][][] dispStrs = lma.lmaDisparityStrengths( //TODO: add parameter to filter out negative minimums ?
					imgdtt_params.lmas_min_amp,      //  minimal ratio of minimal pair correlation amplitude to maximal pair correlation amplitude
					imgdtt_params.lmas_min_amp_bg,   //  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)
@@ -4721,7 +4729,7 @@ public class Correlation2d {
					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
					);
			for (int nmax = 0; nmax < dispStrs.length; nmax++) if (dispStrs[nmax][0][1] <= 0) {
			for (int nmax = 00; nmax < dispStrs.length; nmax++) if (dispStrs[nmax][0][1] <= 0) {
				lmaSuccess = false;
				break;
			}
@@ -4876,7 +4884,7 @@ public class Correlation2d {
    		int                 tileX, // just for debug output
    		int                 tileY){
    	boolean debug_graphic = imgdtt_params.lma_debug_graphic && (imgdtt_params.lma_debug_level1 > 3) && (debug_level > 0) ;
    	debug_graphic |= imgdtt_params.lmamask_dbg && (debug_level > 0) || true;
    	debug_graphic |= imgdtt_params.lmamask_dbg && (debug_level > 0); //  || true;
    	String dbg_title = null;
    	if (debug_graphic) {
    		dbg_title = String.format("tX%d_tY%d",tileX,tileY);
+2 −2
Original line number Diff line number Diff line
@@ -2624,14 +2624,14 @@ public class ImageDtt extends ImageDttCPU {
								}
								if (debugTile1) {
									System.out.println("clt_process_tl_correlations() maxes=");
									for (int i = 0; i < maxes.length; i++) {
									for (int i = 00; i < maxes.length; i++) {
										System.out.println(String.format("maxes[%d][0]=%f (quadcam disparity pixels, not combo pixels), maxes[%d][1]=%f", i, maxes[i][0], i, maxes[i][1]));
									}
								}
								if (debugTile1) {
									Corr2dLMA lma_dual = correlation2d.corrLMA2DualMax( // null pointer
											imgdtt_params,                // ImageDttParameters  imgdtt_params,
								        	0, // 3, // 0, // 1,                            // int     combine_mode,   // 0 - both,  1 - strongest, 2 - nearest to zero, 3 - FG, 4 - BG
								        	00, // 3, // 0, // 1,                            // int     combine_mode,   // 0 - both,  1 - strongest, 2 - nearest to zero, 3 - FG, 4 - BG
//											imgdtt_params.lmas_LY_single, // false,    // boolean             adjust_ly, // adjust Lazy Eye
											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)
+26 −1

File changed.

Preview size limit exceeded, changes collapsed.