Commit 41b267b4 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

redid composite passes

parent 369f2898
Loading
Loading
Loading
Loading
+15 −0
Original line number Original line Diff line number Diff line
@@ -2114,6 +2114,7 @@ public class EyesisCorrectionParameters {
  		public double     stMinBgDisparity  = 0.0;   // Minimal backgroubnd disparity to extract as a maximum from the supertiles 
  		public double     stMinBgDisparity  = 0.0;   // Minimal backgroubnd disparity to extract as a maximum from the supertiles 
  		public double     stMinBgFract      = 0.1;   // Minimal fraction of the disparity histogram to use as background 
  		public double     stMinBgFract      = 0.1;   // Minimal fraction of the disparity histogram to use as background 
  		public double     stUseDisp         = 0.15;  // Use background disparity from supertiles if tile strength is less 
  		public double     stUseDisp         = 0.15;  // Use background disparity from supertiles if tile strength is less 
  		public double     stStrengthScale   = 50.0;  // Multiply st strength if used instead of regular strength 
  		
  		
  		public double     outlayerStrength  = 0.3;   // Outlayer tiles weaker than this may be replaced from neighbors
  		public double     outlayerStrength  = 0.3;   // Outlayer tiles weaker than this may be replaced from neighbors
  		public double     outlayerDiff      = 0.4;   // Replace weak outlayer tiles that do not have neighbors within this disparity difference
  		public double     outlayerDiff      = 0.4;   // Replace weak outlayer tiles that do not have neighbors within this disparity difference
@@ -2123,6 +2124,8 @@ public class EyesisCorrectionParameters {
  		// TODO: Make refine skip if already good?
  		// TODO: Make refine skip if already good?
  		public boolean    combine_refine    = true; // combine with all previous after refine pass
  		public boolean    combine_refine    = true; // combine with all previous after refine pass
  		public double     combine_min_strength = 0.12; // Disregard weaker tiles when combining scans
  		public double     combine_min_strength = 0.12; // Disregard weaker tiles when combining scans
  		public double     combine_min_hor =      0.12; // Disregard weaker tiles when combining scans for horizontal correlation
  		public double     combine_min_vert =     0.12; // Disregard weaker tiles when combining scans for vertical correlation
  		public double     unique_tolerance = 0.1; // Do not re-measure correlation if target disparity differs from some previous by this
  		public double     unique_tolerance = 0.1; // Do not re-measure correlation if target disparity differs from some previous by this
  		
  		
  		// Multi-pass growing disparity
  		// Multi-pass growing disparity
@@ -2337,6 +2340,7 @@ public class EyesisCorrectionParameters {
			properties.setProperty(prefix+"stMinBgDisparity", this.stMinBgDisparity +"");
			properties.setProperty(prefix+"stMinBgDisparity", this.stMinBgDisparity +"");
			properties.setProperty(prefix+"stMinBgFract",     this.stMinBgFract +"");
			properties.setProperty(prefix+"stMinBgFract",     this.stMinBgFract +"");
			properties.setProperty(prefix+"stUseDisp",        this.stUseDisp +"");
			properties.setProperty(prefix+"stUseDisp",        this.stUseDisp +"");
			properties.setProperty(prefix+"stStrengthScale",  this.stStrengthScale +"");
			properties.setProperty(prefix+"outlayerStrength", this.outlayerStrength +"");
			properties.setProperty(prefix+"outlayerStrength", this.outlayerStrength +"");
			properties.setProperty(prefix+"outlayerDiff",     this.outlayerDiff +"");
			properties.setProperty(prefix+"outlayerDiff",     this.outlayerDiff +"");
			properties.setProperty(prefix+"outlayerDiffPos",  this.outlayerDiffPos +"");
			properties.setProperty(prefix+"outlayerDiffPos",  this.outlayerDiffPos +"");
@@ -2345,6 +2349,8 @@ public class EyesisCorrectionParameters {
			properties.setProperty(prefix+"combine_refine",   this.combine_refine+"");
			properties.setProperty(prefix+"combine_refine",   this.combine_refine+"");


			properties.setProperty(prefix+"combine_min_strength", this.combine_min_strength +"");
			properties.setProperty(prefix+"combine_min_strength", this.combine_min_strength +"");
			properties.setProperty(prefix+"combine_min_hor",  this.combine_min_hor +"");
			properties.setProperty(prefix+"combine_min_vert", this.combine_min_vert +"");
			properties.setProperty(prefix+"unique_tolerance", this.unique_tolerance +"");
			properties.setProperty(prefix+"unique_tolerance", this.unique_tolerance +"");
  			properties.setProperty(prefix+"grow_sweep",       this.grow_sweep+"");
  			properties.setProperty(prefix+"grow_sweep",       this.grow_sweep+"");
			properties.setProperty(prefix+"grow_disp_max",    this.grow_disp_max +"");
			properties.setProperty(prefix+"grow_disp_max",    this.grow_disp_max +"");
@@ -2547,6 +2553,7 @@ public class EyesisCorrectionParameters {
  			if (properties.getProperty(prefix+"stMinBgDisparity")!=null)  this.stMinBgDisparity=Double.parseDouble(properties.getProperty(prefix+"stMinBgDisparity"));
  			if (properties.getProperty(prefix+"stMinBgDisparity")!=null)  this.stMinBgDisparity=Double.parseDouble(properties.getProperty(prefix+"stMinBgDisparity"));
  			if (properties.getProperty(prefix+"stMinBgFract")!=null)      this.stMinBgFract=Double.parseDouble(properties.getProperty(prefix+"stMinBgFract"));
  			if (properties.getProperty(prefix+"stMinBgFract")!=null)      this.stMinBgFract=Double.parseDouble(properties.getProperty(prefix+"stMinBgFract"));
  			if (properties.getProperty(prefix+"stUseDisp")!=null)         this.stUseDisp=Double.parseDouble(properties.getProperty(prefix+"stUseDisp"));
  			if (properties.getProperty(prefix+"stUseDisp")!=null)         this.stUseDisp=Double.parseDouble(properties.getProperty(prefix+"stUseDisp"));
  			if (properties.getProperty(prefix+"stStrengthScale")!=null)   this.stStrengthScale=Double.parseDouble(properties.getProperty(prefix+"stStrengthScale"));
  			if (properties.getProperty(prefix+"outlayerStrength")!=null)  this.outlayerStrength=Double.parseDouble(properties.getProperty(prefix+"outlayerStrength"));
  			if (properties.getProperty(prefix+"outlayerStrength")!=null)  this.outlayerStrength=Double.parseDouble(properties.getProperty(prefix+"outlayerStrength"));
  			if (properties.getProperty(prefix+"outlayerDiff")!=null)      this.outlayerDiff=Double.parseDouble(properties.getProperty(prefix+"outlayerDiff"));
  			if (properties.getProperty(prefix+"outlayerDiff")!=null)      this.outlayerDiff=Double.parseDouble(properties.getProperty(prefix+"outlayerDiff"));
  			if (properties.getProperty(prefix+"outlayerDiffPos")!=null)   this.outlayerDiffPos=Double.parseDouble(properties.getProperty(prefix+"outlayerDiffPos"));
  			if (properties.getProperty(prefix+"outlayerDiffPos")!=null)   this.outlayerDiffPos=Double.parseDouble(properties.getProperty(prefix+"outlayerDiffPos"));
@@ -2555,6 +2562,8 @@ public class EyesisCorrectionParameters {
  			if (properties.getProperty(prefix+"combine_refine")!=null)    this.combine_refine=Boolean.parseBoolean(properties.getProperty(prefix+"combine_refine"));
  			if (properties.getProperty(prefix+"combine_refine")!=null)    this.combine_refine=Boolean.parseBoolean(properties.getProperty(prefix+"combine_refine"));


  			if (properties.getProperty(prefix+"combine_min_strength")!=null) this.combine_min_strength=Double.parseDouble(properties.getProperty(prefix+"combine_min_strength"));
  			if (properties.getProperty(prefix+"combine_min_strength")!=null) this.combine_min_strength=Double.parseDouble(properties.getProperty(prefix+"combine_min_strength"));
  			if (properties.getProperty(prefix+"combine_min_hor")!=null)   this.combine_min_hor=Double.parseDouble(properties.getProperty(prefix+"combine_min_hor"));
  			if (properties.getProperty(prefix+"combine_min_vert")!=null)  this.combine_min_vert=Double.parseDouble(properties.getProperty(prefix+"combine_min_vert"));
  			if (properties.getProperty(prefix+"unique_tolerance")!=null)  this.unique_tolerance=Double.parseDouble(properties.getProperty(prefix+"unique_tolerance"));
  			if (properties.getProperty(prefix+"unique_tolerance")!=null)  this.unique_tolerance=Double.parseDouble(properties.getProperty(prefix+"unique_tolerance"));
  			if (properties.getProperty(prefix+"grow_sweep")!=null)        this.grow_sweep=Integer.parseInt(properties.getProperty(prefix+"grow_sweep"));
  			if (properties.getProperty(prefix+"grow_sweep")!=null)        this.grow_sweep=Integer.parseInt(properties.getProperty(prefix+"grow_sweep"));
  			if (properties.getProperty(prefix+"grow_disp_max")!=null)     this.grow_disp_max=Double.parseDouble(properties.getProperty(prefix+"grow_disp_max"));
  			if (properties.getProperty(prefix+"grow_disp_max")!=null)     this.grow_disp_max=Double.parseDouble(properties.getProperty(prefix+"grow_disp_max"));
@@ -2779,6 +2788,7 @@ public class EyesisCorrectionParameters {
  			gd.addNumericField("Minimal backgroubnd disparity to extract as a maximum from the supertiles",    this.stMinBgDisparity,  6);
  			gd.addNumericField("Minimal backgroubnd disparity to extract as a maximum from the supertiles",    this.stMinBgDisparity,  6);
  			gd.addNumericField("Minimal fraction of the disparity histogram to use as background",             this.stMinBgFract,  6);
  			gd.addNumericField("Minimal fraction of the disparity histogram to use as background",             this.stMinBgFract,  6);
  			gd.addNumericField("Use background disparity from supertiles if tile strength is less",            this.stUseDisp,  6);
  			gd.addNumericField("Use background disparity from supertiles if tile strength is less",            this.stUseDisp,  6);
  			gd.addNumericField("Multiply st strength if used instead of regular strength ",                    this.stStrengthScale,  6);
  			gd.addNumericField("Outlayer tiles weaker than this may be replaced from neighbors",               this.outlayerStrength,  6);
  			gd.addNumericField("Outlayer tiles weaker than this may be replaced from neighbors",               this.outlayerStrength,  6);
  			gd.addNumericField("Replace weak outlayer tiles that do not have neighbors within this disparity difference", this.outlayerDiff,  6);
  			gd.addNumericField("Replace weak outlayer tiles that do not have neighbors within this disparity difference", this.outlayerDiff,  6);
  			gd.addNumericField("Replace weak outlayer tiles that have higher disparity than weighted average", this.outlayerDiffPos,  6);
  			gd.addNumericField("Replace weak outlayer tiles that have higher disparity than weighted average", this.outlayerDiffPos,  6);
@@ -2786,6 +2796,8 @@ public class EyesisCorrectionParameters {


  			gd.addCheckbox    ("Combine with all previous after refine pass",                                  this.combine_refine);
  			gd.addCheckbox    ("Combine with all previous after refine pass",                                  this.combine_refine);
  			gd.addNumericField("Disregard weaker tiles when combining scans",                                  this.combine_min_strength,  6);
  			gd.addNumericField("Disregard weaker tiles when combining scans",                                  this.combine_min_strength,  6);
  			gd.addNumericField("Disregard weaker tiles when combining scans  for horizontal correlation",      this.combine_min_hor,  6);
  			gd.addNumericField("Disregard weaker tiles when combining scans  for vertical correlation",        this.combine_min_vert,  6);
  			gd.addNumericField("Do not re-measure correlation if target disparity differs from some previous by this",this.unique_tolerance,  6);
  			gd.addNumericField("Do not re-measure correlation if target disparity differs from some previous by this",this.unique_tolerance,  6);
  			
  			
  			gd.addMessage     ("--- Growing disparity range to scan ---");
  			gd.addMessage     ("--- Growing disparity range to scan ---");
@@ -2997,6 +3009,7 @@ public class EyesisCorrectionParameters {
  			this.stMinBgDisparity=      gd.getNextNumber();
  			this.stMinBgDisparity=      gd.getNextNumber();
  			this.stMinBgFract=          gd.getNextNumber();
  			this.stMinBgFract=          gd.getNextNumber();
  			this.stUseDisp=             gd.getNextNumber();
  			this.stUseDisp=             gd.getNextNumber();
  			this.stStrengthScale=       gd.getNextNumber();
  			this.outlayerStrength=      gd.getNextNumber();
  			this.outlayerStrength=      gd.getNextNumber();
  			this.outlayerDiff=          gd.getNextNumber();
  			this.outlayerDiff=          gd.getNextNumber();
  			this.outlayerDiffPos=       gd.getNextNumber();
  			this.outlayerDiffPos=       gd.getNextNumber();
@@ -3005,6 +3018,8 @@ public class EyesisCorrectionParameters {
  			this.combine_refine=        gd.getNextBoolean();
  			this.combine_refine=        gd.getNextBoolean();


  			this.combine_min_strength=  gd.getNextNumber();
  			this.combine_min_strength=  gd.getNextNumber();
  			this.combine_min_hor=       gd.getNextNumber();
  			this.combine_min_vert=      gd.getNextNumber();
  			this.unique_tolerance=      gd.getNextNumber();
  			this.unique_tolerance=      gd.getNextNumber();


  			this.grow_sweep=      (int) gd.getNextNumber();
  			this.grow_sweep=      (int) gd.getNextNumber();
+2 −0
Original line number Original line Diff line number Diff line
@@ -4665,6 +4665,8 @@ private Panel panel1,
        	}
        	}
        }
        }
        QUAD_CLT.tp.resetCLTPasses();
        QUAD_CLT.tp.resetCLTPasses();
        QUAD_CLT.tp.setTrustedCorrelation(CLT_PARAMETERS.grow_disp_trust);

        return;
        return;
        
        
/// ============================================
/// ============================================
+173 −117
Original line number Original line Diff line number Diff line
@@ -64,6 +64,7 @@ public class QuadCLT {
					clt_parameters.transform_size,
					clt_parameters.transform_size,
					clt_parameters.stSize,
					clt_parameters.stSize,
					clt_parameters.corr_magic_scale,
					clt_parameters.corr_magic_scale,
					clt_parameters.grow_disp_trust,
					threadsMax);
					threadsMax);
		}  
		}  
	}
	}
@@ -4714,6 +4715,7 @@ public class QuadCLT {
				  clt_parameters,
				  clt_parameters,
				  threadsMax);
				  threadsMax);
		  tp.resetCLTPasses();
		  tp.resetCLTPasses();
		  tp.setTrustedCorrelation(clt_parameters.grow_disp_trust);		  
		  final int tilesX = tp.getTilesX();
		  final int tilesX = tp.getTilesX();
		  final int tilesY = tp.getTilesY();
		  final int tilesY = tp.getTilesY();
		  
		  
@@ -4773,7 +4775,7 @@ public class QuadCLT {
        	  int [] numLeftRemoved = tp.makeUnique(
        	  int [] numLeftRemoved = tp.makeUnique(
        				tp.clt_3d_passes,                  // final ArrayList <CLTPass3d> passes,
        				tp.clt_3d_passes,                  // final ArrayList <CLTPass3d> passes,
        				0,                                 //  final int                   firstPass,
        				0,                                 //  final int                   firstPass,
        				refine_pass - 1,                   //  final int                   lastPassPlus1,
        				refine_pass, // - 1,                   //  final int                   lastPassPlus1,
        				tp.clt_3d_passes.get(refine_pass), //  final CLTPass3d             new_scan,
        				tp.clt_3d_passes.get(refine_pass), //  final CLTPass3d             new_scan,
        				clt_parameters.unique_tolerance,   //  final double                unique_tolerance,
        				clt_parameters.unique_tolerance,   //  final double                unique_tolerance,
        				clt_parameters.show_unique);      // final boolean               show_unique)
        				clt_parameters.show_unique);      // final boolean               show_unique)
@@ -4794,22 +4796,36 @@ public class QuadCLT {
              }
              }
        	  
        	  
        	  if (clt_parameters.combine_refine){
        	  if (clt_parameters.combine_refine){
//        		  TileProcessor.CLTPass3d scan = tp.clt_3d_passes.get(scanIndex);
        		  TileProcessor.CLTPass3d combo_pass = tp.compositeScan(
        		  TileProcessor.CLTPass3d combo_pass = tp.combinePasses(
        				  tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
        				  tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
        				  bg_pass, //  final int                   firstPass,
        				  bg_pass, //  final int                   firstPass,
        				  tp.clt_3d_passes.size(),                          //  final int                   lastPassPlus1,
        				  tp.clt_3d_passes.size(),                          //  final int                   lastPassPlus1,
        				  true,  // skip_combo, // do not process other combo scans
        				  tp.getTrustedCorrelation(),                       // 	 final double                trustedCorrelation,
        				  true, //  final boolean               use_last,   // use last scan data if nothing better 
        				  0.0, // clt_parameters.bgnd_range,                //	 final double                disp_far,   // limit results to the disparity range
        				  false, // not calculated yet! true,  // 	 final boolean               useCombo, // use combined disparity/strength (false - use measured full correlation
        				  clt_parameters.grow_disp_max,                     // final double                disp_near,
        				  false, // final boolean               usePoly,  // use polynomial method to find max), valid if useCombo == false
        				  clt_parameters.combine_min_strength,              // final double                minStrength, 
        				  clt_parameters.combine_min_strength, // 	 final double                minStrength, // ignore too weak tiles
        				  clt_parameters.combine_min_hor,                   // final double                minStrengthHor,
            			  clt_parameters.show_combined);
        				  clt_parameters.combine_min_vert,                  // final double                minStrengthVert,
        				  false, // final boolean               use_last,   //  
        				  // TODO: when useCombo - pay attention to borders (disregard)
        				  false); // final boolean               usePoly)  // use polynomial method to find max), valid if useCombo == false
        		  
            	  tp.showScan(
            			  combo_pass, // CLTPass3d   scan,
            			  "after_compositeScan-"+tp.clt_3d_passes.size());
        		  
        		  tp.clt_3d_passes.add(combo_pass);
        		  tp.clt_3d_passes.add(combo_pass);
        		  
        		  
        		  
//        		  refine_pass = tp.clt_3d_passes.size();
//        		  refine_pass = tp.clt_3d_passes.size();
        	  }
        	  }
          }
          }
          // above - multiple refinements (reduce, make conditional?)
          int num_extended = -1;
          int [] numLeftRemoved; 
// process once more to try combining of processed
// process once more to try combining of processed
          for (int num_expand = 0; (num_expand < 2) && (num_extended != 0); num_expand++) {
        	  refine_pass = tp.clt_3d_passes.size(); // 1
        	  refine_pass = tp.clt_3d_passes.size(); // 1
        	  tp.refinePassSetup( // prepare tile tasks for the refine pass (re-measure disparities)
        	  tp.refinePassSetup( // prepare tile tasks for the refine pass (re-measure disparities)
        			  //				  final double [][][]       image_data, // first index - number of image in a quad
        			  //				  final double [][][]       image_data, // first index - number of image in a quad
@@ -4828,24 +4844,43 @@ public class QuadCLT {
        			  updateStatus,
        			  updateStatus,
        			  debugLevel);
        			  debugLevel);


          TileProcessor.CLTPass3d extended_pass = tp.combinePasses(
        	  tp.showScan(
        			  tp.clt_3d_passes.get(refine_pass), // CLTPass3d   scan,
        			  "after_refine-"+refine_pass);
        	  tp.calcMaxTried(
        			  tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
        			  bg_pass, //  final int                   firstPass,
        			  refine_pass, // may add 1 to include current (for future?)     //  final int                   lastPassPlus1,
        			  tp.clt_3d_passes.get(refine_pass)); //  final int                   lastPassPlus1,

    		  TileProcessor.CLTPass3d extended_pass = tp.compositeScan(
    				  tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
    				  tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
    				  bg_pass, //  final int                   firstPass,
    				  bg_pass, //  final int                   firstPass,
    				  tp.clt_3d_passes.size(),                          //  final int                   lastPassPlus1,
    				  tp.clt_3d_passes.size(),                          //  final int                   lastPassPlus1,
        		  false, // skip_combo, // do not process other combo scans
    				  tp.getTrustedCorrelation(),                       // 	 final double                trustedCorrelation,
        		  true,  //  final boolean               use_last,   // use last scan data if nothing better 
    				  0.0, // clt_parameters.bgnd_range,                //	 final double                disp_far,   // limit results to the disparity range
        		  true,  // not calculated yet! true,  // 	 final boolean               useCombo, // use combined disparity/strength (false - use measured full correlation
    				  clt_parameters.grow_disp_max,                     // final double                disp_near,
        		  false, // final boolean               usePoly,  // use polynomial method to find max), valid if useCombo == false
    				  clt_parameters.combine_min_strength,              // final double                minStrength, 
        		  clt_parameters.combine_min_strength, // 	 final double                minStrength, // ignore too weak tiles
    				  clt_parameters.combine_min_hor,                   // final double                minStrengthHor,
        		  true); //  clt_parameters.show_combined);
    				  clt_parameters.combine_min_vert,                  // final double                minStrengthVert,

    				  true, // false, // final boolean               use_last,   //  
          tp.setupExtendDisparity(
    				  // TODO: when useCombo - pay attention to borders (disregard)
    				  false); // final boolean               usePoly)  // use polynomial method to find max), valid if useCombo == false
        	  
        	  
        	  
        	  
        	  tp.showScan(
        			  tp.clt_3d_passes.get(refine_pass), // CLTPass3d   scan,
        			  "after_refine-combine-"+(tp.clt_3d_passes.size() - 1));

        	  num_extended = tp.setupExtendDisparity(
        			  extended_pass,                              // final CLTPass3d   scan,            // combined scan with max_tried_disparity, will be modified to re-scan
        			  extended_pass,                              // final CLTPass3d   scan,            // combined scan with max_tried_disparity, will be modified to re-scan
        			  tp.clt_3d_passes.get(refine_pass), // final CLTPass3d   last_scan,       // last prepared tile - can use last_scan.disparity, .border_tiles and .selected
        			  tp.clt_3d_passes.get(refine_pass), // final CLTPass3d   last_scan,       // last prepared tile - can use last_scan.disparity, .border_tiles and .selected
        			  tp.clt_3d_passes.get(bg_pass), // final CLTPass3d   bg_scan,         // background scan data
        			  tp.clt_3d_passes.get(bg_pass), // final CLTPass3d   bg_scan,         // background scan data
        			  clt_parameters.grow_sweep,      // 8; // Try these number of tiles around known ones 
        			  clt_parameters.grow_sweep,      // 8; // Try these number of tiles around known ones 
        			  clt_parameters.grow_disp_max,   //  =   50.0; // Maximal disparity to try
        			  clt_parameters.grow_disp_max,   //  =   50.0; // Maximal disparity to try
        		  clt_parameters.grow_disp_trust, //  =  4.0; // Trust measured disparity within +/- this value 
        			  0.5 * clt_parameters.grow_disp_trust, //  =  4.0; // Trust measured disparity within +/- this value 
        			  clt_parameters.grow_disp_step,  //  =   6.0; // Increase disparity (from maximal tried) if nothing found in that tile // TODO: handle enclosed dips?  
        			  clt_parameters.grow_disp_step,  //  =   6.0; // Increase disparity (from maximal tried) if nothing found in that tile // TODO: handle enclosed dips?  
        			  clt_parameters.grow_min_diff,    // =    0.5; // Grow more only if at least one channel has higher variance from others for the tile
        			  clt_parameters.grow_min_diff,    // =    0.5; // Grow more only if at least one channel has higher variance from others for the tile
        			  clt_parameters, // EyesisCorrectionParameters.CLTParameters           clt_parameters,
        			  clt_parameters, // EyesisCorrectionParameters.CLTParameters           clt_parameters,
@@ -4854,20 +4889,28 @@ public class QuadCLT {
        			  threadsMax,  // maximal number of threads to launch                         
        			  threadsMax,  // maximal number of threads to launch                         
        			  updateStatus,
        			  updateStatus,
        			  debugLevel);
        			  debugLevel);
        	  //TODO:  break if nothing wanted? - no, there are some left to be refined


        	  refine_pass = tp.clt_3d_passes.size(); // 1
        	  refine_pass = tp.clt_3d_passes.size(); // 1


        	  tp.clt_3d_passes.add(extended_pass);
        	  tp.clt_3d_passes.add(extended_pass);


          int [] numLeftRemoved = tp.makeUnique(
        	  numLeftRemoved = tp.makeUnique(
        			  tp.clt_3d_passes,                  // final ArrayList <CLTPass3d> passes,
        			  tp.clt_3d_passes,                  // final ArrayList <CLTPass3d> passes,
        			  0,                                 //  final int                   firstPass,
        			  0,                                 //  final int                   firstPass,
        		  refine_pass - 1,                   //  final int                   lastPassPlus1,
        			  refine_pass, // - 1,                   //  final int                   lastPassPlus1,
        			  tp.clt_3d_passes.get(refine_pass), //  final CLTPass3d             new_scan,
        			  tp.clt_3d_passes.get(refine_pass), //  final CLTPass3d             new_scan,
        			  clt_parameters.unique_tolerance,   //  final double                unique_tolerance,
        			  clt_parameters.unique_tolerance,   //  final double                unique_tolerance,
        			  clt_parameters.show_unique);      // final boolean               show_unique)
        			  clt_parameters.show_unique);      // final boolean               show_unique)
        	  tp.showScan(
        			  tp.clt_3d_passes.get(refine_pass), // CLTPass3d   scan,
        			  "before_measure-"+refine_pass); //String title)

        	  if (debugLevel > -1){
        	  if (debugLevel > -1){
        		  System.out.println("last makeUnique("+refine_pass+") -> left: "+numLeftRemoved[0]+", removed:" + numLeftRemoved[1]);
        		  System.out.println("last makeUnique("+refine_pass+") -> left: "+numLeftRemoved[0]+", removed:" + numLeftRemoved[1]);
        	  }
        	  }
        	  //TODO:  break if nothing wanted? - here yes, will make sens




        	  //          refine_pass = tp.clt_3d_passes.size(); // 
        	  //          refine_pass = tp.clt_3d_passes.size(); // 
@@ -4878,24 +4921,37 @@ public class QuadCLT {
        			  threadsMax,  // maximal number of threads to launch                         
        			  threadsMax,  // maximal number of threads to launch                         
        			  updateStatus,
        			  updateStatus,
        			  debugLevel); 
        			  debugLevel); 

        	  tp.showScan(
        			  tp.clt_3d_passes.get(refine_pass), // CLTPass3d   scan,
        			  "after_measure-"+refine_pass); //String title)


        	  if (debugLevel > -1){
        	  if (debugLevel > -1){
        		  System.out.println("extending: CLTMeasure("+refine_pass+")");
        		  System.out.println("extending: CLTMeasure("+refine_pass+")");
        	  }
        	  }
        	  
        	  
          if (clt_parameters.combine_refine){
    		  TileProcessor.CLTPass3d combo_pass = tp.compositeScan(
        	  //  		  TileProcessor.CLTPass3d scan = tp.clt_3d_passes.get(scanIndex);
        	  TileProcessor.CLTPass3d combo_pass = tp.combinePasses(
    				  tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
    				  tp.clt_3d_passes, // final ArrayList <CLTPass3d> passes,
    				  bg_pass, //  final int                   firstPass,
    				  bg_pass, //  final int                   firstPass,
    				  tp.clt_3d_passes.size(),                          //  final int                   lastPassPlus1,
    				  tp.clt_3d_passes.size(),                          //  final int                   lastPassPlus1,
        			  true,  // skip_combo, // do not process other combo scans
    				  tp.getTrustedCorrelation(),                       // 	 final double                trustedCorrelation,
        			  true, //  final boolean               use_last,   // use last scan data if nothing better 
    				  0.0, // clt_parameters.bgnd_range,                //	 final double                disp_far,   // limit results to the disparity range
        			  false, // not calculated yet! true,  // 	 final boolean               useCombo, // use combined disparity/strength (false - use measured full correlation
    				  clt_parameters.grow_disp_max,                     // final double                disp_near,
        			  false, // final boolean               usePoly,  // use polynomial method to find max), valid if useCombo == false
    				  clt_parameters.combine_min_strength,              // final double                minStrength, 
        			  clt_parameters.combine_min_strength, // 	 final double                minStrength, // ignore too weak tiles
    				  clt_parameters.combine_min_hor,                   // final double                minStrengthHor,
        			  clt_parameters.show_combined);
    				  clt_parameters.combine_min_vert,                  // final double                minStrengthVert,
    				  false, // final boolean               use_last,   //  
    				  // TODO: when useCombo - pay attention to borders (disregard)
    				  false); // final boolean               usePoly)  // use polynomial method to find max), valid if useCombo == false
        	  
        	  tp.clt_3d_passes.add(combo_pass);
        	  tp.clt_3d_passes.add(combo_pass);
        	  //  		  refine_pass = tp.clt_3d_passes.size();
        	  //  		  refine_pass = tp.clt_3d_passes.size();
        	  //          }
        	  tp.showScan(
        			  tp.clt_3d_passes.get(refine_pass), // CLTPass3d   scan,
        			  "after_combo_pass-"+(tp.clt_3d_passes.size()-1)); //String title)

          }
          }
          refine_pass = tp.clt_3d_passes.size(); // 1
          refine_pass = tp.clt_3d_passes.size(); // 1


@@ -4915,11 +4971,11 @@ public class QuadCLT {
        		  geometryCorrection,
        		  geometryCorrection,
        		  threadsMax,  // maximal number of threads to launch                         
        		  threadsMax,  // maximal number of threads to launch                         
        		  updateStatus,
        		  updateStatus,
    			  2); // debugLevel);
        		  debugLevel); // 2); // debugLevel);
          numLeftRemoved = tp.makeUnique(
          numLeftRemoved = tp.makeUnique(
        		  tp.clt_3d_passes,                  // final ArrayList <CLTPass3d> passes,
        		  tp.clt_3d_passes,                  // final ArrayList <CLTPass3d> passes,
        		  0,                                 //  final int                   firstPass,
        		  0,                                 //  final int                   firstPass,
    				refine_pass - 1,                   //  final int                   lastPassPlus1,
        		  refine_pass, // - 1,                   //  final int                   lastPassPlus1,
        		  tp.clt_3d_passes.get(refine_pass), //  final CLTPass3d             new_scan,
        		  tp.clt_3d_passes.get(refine_pass), //  final CLTPass3d             new_scan,
        		  clt_parameters.unique_tolerance,   //  final double                unique_tolerance,
        		  clt_parameters.unique_tolerance,   //  final double                unique_tolerance,
        		  clt_parameters.show_unique);      // final boolean               show_unique)
        		  clt_parameters.show_unique);      // final boolean               show_unique)