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

more debugging of surfaces and tile sorting

parent d129b782
Loading
Loading
Loading
Loading
+43 −7
Original line number Diff line number Diff line
@@ -2219,13 +2219,18 @@ public class EyesisCorrectionParameters {
		public double     tsMinDiffOther       = 0.35;   // Minimal disparity difference to be considered as a competitor surface
		public double     tsMinStrength        = 0.05;   // Minimal tile correlation strength to be assigned
		public double     tsMaxStrength        = 10.0;   // Maximal tile correlation strength to be assigned
		public double     tsMinSurface         = 0.0001; // Minimal surface strength at the tile location
		public int        tsMoveDirs           = 3;      // Allowed tile disparity correction: 1 increase, 2 - decrease, 3 - both directions
		public boolean    tsEnMulti            = false;  // Allow assignment when several surfaces fit
		public boolean    tsLoopMulti          = true;   // Repeat multi-choice assignment while succeeding 
		public double     tsSurfStrPow         = 0.0;    // Raise surface strengths ratio to this power when comparing candidates
		public double     tsAddStrength        = 0.01;   // Add to strengths when calculating pull of assigned tiles
		public double     tsSigma              = 2.0;    // Radius of influence (in tiles) of the previously assigned tiles
		public double     tsNSigma             = 2.0;    // Maximal relative to radius distance to calculate influence
		public double     tsMinPull            = 0.001;  // Additional pull of each surface 
		public double     tsMinAdvantage       = 3.0;    // Minimal ratio of the best surface candidate to the next one to make selection
		public boolean    tsReset              = false;  // Reset tiles to surfaces assignment
		public boolean    tsShow               = false;  // Show results of tiles to surfaces assignment
  		
  		public boolean    replaceWeakOutlayers =   true; // false; 
  		
@@ -2535,12 +2540,17 @@ public class EyesisCorrectionParameters {
			properties.setProperty(prefix+"tsMinDiffOther",   this.tsMinDiffOther +"");
			properties.setProperty(prefix+"tsMinStrength",    this.tsMinStrength +"");
			properties.setProperty(prefix+"tsMaxStrength",    this.tsMaxStrength +"");
			properties.setProperty(prefix+"tsMinSurface",     this.tsMinSurface +"");
  			properties.setProperty(prefix+"tsMoveDirs",       this.tsMoveDirs+"");
			properties.setProperty(prefix+"tsEnMulti",        this.tsEnMulti+"");
			properties.setProperty(prefix+"tsLoopMulti",      this.tsLoopMulti+"");
			properties.setProperty(prefix+"tsSurfStrPow",     this.tsSurfStrPow +"");
			properties.setProperty(prefix+"tsAddStrength",    this.tsAddStrength +"");
			properties.setProperty(prefix+"tsSigma",          this.tsSigma +"");
			properties.setProperty(prefix+"tsNSigma",         this.tsNSigma +"");
			properties.setProperty(prefix+"tsMinPull",        this.tsMinPull +"");
			properties.setProperty(prefix+"tsMinAdvantage",   this.tsMinAdvantage +"");
			properties.setProperty(prefix+"tsShow",           this.tsShow+"");
			
			properties.setProperty(prefix+"dbg_migrate",            this.dbg_migrate+"");
  			
@@ -2844,12 +2854,17 @@ public class EyesisCorrectionParameters {
  			if (properties.getProperty(prefix+"tsMinDiffOther")!=null)    this.tsMinDiffOther=Double.parseDouble(properties.getProperty(prefix+"tsMinDiffOther"));
  			if (properties.getProperty(prefix+"tsMinStrength")!=null)     this.tsMinStrength=Double.parseDouble(properties.getProperty(prefix+"tsMinStrength"));
  			if (properties.getProperty(prefix+"tsMaxStrength")!=null)     this.tsMaxStrength=Double.parseDouble(properties.getProperty(prefix+"tsMaxStrength"));
  			if (properties.getProperty(prefix+"tsMinSurface")!=null)      this.tsMinSurface=Double.parseDouble(properties.getProperty(prefix+"tsMinSurface"));
  			if (properties.getProperty(prefix+"tsMoveDirs")!=null)        this.tsMoveDirs=Integer.parseInt(properties.getProperty(prefix+"tsMoveDirs"));
  			if (properties.getProperty(prefix+"tsEnMulti")!=null)         this.tsEnMulti=Boolean.parseBoolean(properties.getProperty(prefix+"tsEnMulti"));
  			if (properties.getProperty(prefix+"tsLoopMulti")!=null)       this.tsLoopMulti=Boolean.parseBoolean(properties.getProperty(prefix+"tsLoopMulti"));
  			if (properties.getProperty(prefix+"tsSurfStrPow")!=null)      this.tsSurfStrPow=Double.parseDouble(properties.getProperty(prefix+"tsSurfStrPow"));
  			if (properties.getProperty(prefix+"tsAddStrength")!=null)     this.tsAddStrength=Double.parseDouble(properties.getProperty(prefix+"tsAddStrength"));
  			if (properties.getProperty(prefix+"tsSigma")!=null)           this.tsSigma=Double.parseDouble(properties.getProperty(prefix+"tsSigma"));
  			if (properties.getProperty(prefix+"tsNSigma")!=null)          this.tsNSigma=Double.parseDouble(properties.getProperty(prefix+"tsNSigma"));
  			if (properties.getProperty(prefix+"tsMinPull")!=null)         this.tsMinPull=Double.parseDouble(properties.getProperty(prefix+"tsMinPull"));
  			if (properties.getProperty(prefix+"tsMinAdvantage")!=null)    this.tsMinAdvantage=Double.parseDouble(properties.getProperty(prefix+"tsMinAdvantage"));
  			if (properties.getProperty(prefix+"tsShow")!=null)            this.tsShow=Boolean.parseBoolean(properties.getProperty(prefix+"tsShow"));
  			
  			
  			if (properties.getProperty(prefix+"dbg_migrate")!=null)       this.dbg_migrate=Boolean.parseBoolean(properties.getProperty(prefix+"dbg_migrate"));
@@ -3178,12 +3193,17 @@ public class EyesisCorrectionParameters {
  			gd.addNumericField("Minimal disparity difference to be considered as a competitor surface",           this.tsMinDiffOther,  6);
  			gd.addNumericField("Minimal tile correlation strength to be assigned",                                this.tsMinStrength,  6);
  			gd.addNumericField("Maximal tile correlation strength to be assigned",                                this.tsMaxStrength,  6);
  			gd.addNumericField("Minimal surface strength at the tile location",                                   this.tsMinSurface,  6);
  			gd.addNumericField("Allowed tile disparity correction: 1 increase, 2 - decrease, 3 - both directions",this.tsMoveDirs,  0);
  			gd.addCheckbox    ("Allow assignment when several surfaces fit",                                      this.tsEnMulti);
  			gd.addCheckbox    ("Repeat multi-choice assignment while succeeding",                                 this.tsLoopMulti);
  			gd.addNumericField("Raise surface strengths ratio to this power when comparing candidates",           this.tsSurfStrPow,  6);
  			gd.addNumericField("Add to strengths when calculating pull of assigned tiles",                        this.tsAddStrength,  6);
  			gd.addNumericField("Radius of influence (in tiles) of the previously assigned tiles",                 this.tsSigma,  6);
  			gd.addNumericField("Maximal relative to radius distance to calculate influence",                      this.tsNSigma,  6);
  			gd.addNumericField(" Additional pull of each surface ",                                               this.tsMinPull,  6);
  			gd.addNumericField("Minimal ratio of the best surface candidate to the next one to make selection",   this.tsMinAdvantage,  6);
  			gd.addCheckbox    ("Show results of tiles to surfaces assignment",                                    this.tsShow);
  			
  			gd.addCheckbox    ("Test new mode after migration",                                                this.dbg_migrate);

@@ -3493,13 +3513,18 @@ public class EyesisCorrectionParameters {
  			this.tsMinDiffOther=        gd.getNextNumber();
  			this.tsMinStrength=         gd.getNextNumber();
  			this.tsMaxStrength=         gd.getNextNumber();
  			this.tsMinSurface=          gd.getNextNumber();
  			this.tsMoveDirs=      (int) gd.getNextNumber();
  			this.tsEnMulti=             gd.getNextBoolean();
  			this.tsLoopMulti=           gd.getNextBoolean();
  			this.tsSurfStrPow=          gd.getNextNumber();
  			this.tsAddStrength=         gd.getNextNumber();
  			this.tsSigma=               gd.getNextNumber();
  			this.tsNSigma=              gd.getNextNumber();
  			this.tsMinPull=             gd.getNextNumber();
  			this.tsMinAdvantage=        gd.getNextNumber();
  			this.tsReset              = false;  // Reset tiles to surfaces assignment
  			this.tsShow               = gd.getNextBoolean();
  			
  			this.dbg_migrate=           gd.getNextBoolean();

@@ -3521,18 +3546,24 @@ public class EyesisCorrectionParameters {
  		}
  		
  		public boolean showTsDialog() {
  			GenericDialog gd = new GenericDialog("Set CLT parameters");
  			GenericDialog gd = new GenericDialog("Set CLT tiles to surfaces assignment parameters");
  			gd.addNumericField("Maximal disparity difference when assigning tiles",                               this.tsMaxDiff,  6);
  			gd.addNumericField("Minimal disparity difference to be considered as a competitor surface",           this.tsMinDiffOther,  6);
  			gd.addNumericField("Minimal tile correlation strength to be assigned",                                this.tsMinStrength,  6);
  			gd.addNumericField("Maximal tile correlation strength to be assigned",                                this.tsMaxStrength,  6);
  			gd.addNumericField("Minimal surface strength at the tile location",                                   this.tsMinSurface,  6);
  			gd.addNumericField("Allowed tile disparity correction: 1 increase, 2 - decrease, 3 - both directions",this.tsMoveDirs,  0);
  			gd.addCheckbox    ("Allow assignment when several surfaces fit",                                      this.tsEnMulti);
  			gd.addCheckbox    ("Repeat multi-choice assignment while succeeding",                                 this.tsLoopMulti);
  			gd.addNumericField("Raise surface strengths ratio to this power when comparing candidates",           this.tsSurfStrPow,  6);
  			gd.addNumericField("Add to strengths when calculating pull of assigned tiles",                        this.tsAddStrength,  6);
  			gd.addNumericField("Radius of influence (in tiles) of the previously assigned tiles",                 this.tsSigma,  6);
  			gd.addNumericField("Maximal relative to radius distance to calculate influence",                      this.tsNSigma,  6);
  			gd.addNumericField(" Additional pull of each surface ",                                               this.tsMinPull,  6);
  			gd.addNumericField("Minimal ratio of the best surface candidate to the next one to make selection",   this.tsMinAdvantage,  6);
  			gd.addCheckbox    ("Reset tiles to surfaces assignment",                                              false);
  			gd.addCheckbox    ("Show results of tiles to surfaces assignment",                                    this.tsShow);
  			
  			WindowTools.addScrollBars(gd);
  			gd.showDialog();
  			if (gd.wasCanceled()) return false;
@@ -3540,13 +3571,18 @@ public class EyesisCorrectionParameters {
  			this.tsMinDiffOther=        gd.getNextNumber();
  			this.tsMinStrength=         gd.getNextNumber();
  			this.tsMaxStrength=         gd.getNextNumber();
  			this.tsMinSurface=          gd.getNextNumber();
  			this.tsMoveDirs=      (int) gd.getNextNumber();
  			this.tsEnMulti=             gd.getNextBoolean();
  			this.tsLoopMulti=           gd.getNextBoolean();
  			this.tsSurfStrPow=          gd.getNextNumber();
  			this.tsAddStrength=         gd.getNextNumber();
  			this.tsSigma=               gd.getNextNumber();
  			this.tsNSigma=              gd.getNextNumber();
  			this.tsMinPull=             gd.getNextNumber();
  			this.tsMinAdvantage=        gd.getNextNumber();
  			this.tsReset=               gd.getNextBoolean();
  			this.tsShow               = gd.getNextBoolean();
  			return true;
  		}
  		
+30 −17
Original line number Diff line number Diff line
@@ -2969,16 +2969,20 @@ public class TileProcessor {
				tileSel,      // final boolean [][]                             tileSel,
                debugLevel);    // final int                                    debugLevel,

		for (int nTry = 0; nTry < 100; nTry++) {
			int [] stats=  tileSurface.assignTilesToSurfaces(
					clt_parameters.tsMaxDiff,       //final double        maxDiff,
					clt_parameters.tsMinDiffOther,  //final double        minDiffOther, // should be >= maxDiff
					clt_parameters.tsMinStrength,   //final double        minStrength,
					clt_parameters.tsMaxStrength,   //final double        maxStrength,
					clt_parameters.tsMinSurface,    //final double        minSurfStrength, // minimal surface strength at the tile location
					clt_parameters.tsMoveDirs,      //final int           moveDirs, // 1 increase disparity, 2 - decrease disparity, 3 - both directions
					clt_parameters.tsEnMulti,       //final boolean       enMulti,
					clt_parameters.tsSurfStrPow,    //final double        surfStrPow, // surface strength power
					clt_parameters.tsAddStrength,   //final double        addStrength,
					clt_parameters.tsSigma,         //final double        sigma,
					clt_parameters.tsNSigma,        //final double        nSigma,
					clt_parameters.tsMinPull,       //final double        minPull,
					clt_parameters.tsMinAdvantage,  //final double        minAdvantage,
					clt_parameters.plDispNorm,      // final double        dispNorm, // disparity normalize (proportionally scale down disparity difference if above
					dispStrength,                   // final double [][][] dispStrength,
@@ -2986,6 +2990,15 @@ public class TileProcessor {
					clt_parameters.tileX,
					clt_parameters.tileY);
			tileSurface.printStats(stats);
			if (!clt_parameters.tsEnMulti || !clt_parameters.tsLoopMulti || !tileSurface.makesSensToTry(stats)){
				break;
			}
		}
		if (clt_parameters.tsShow){
			tileSurface.showAssignment(
					"assignments", // String title,
					dispStrength); // final double [][][] dispStrength)
		}
		return true;
	}