Commit 369937de authored by Andrey Filippov's avatar Andrey Filippov
Browse files

debugging ndew code

parent b569637d
Loading
Loading
Loading
Loading
+22 −1
Original line number Original line Diff line number Diff line
@@ -2210,6 +2210,10 @@ public class EyesisCorrectionParameters {
  		public double     plSnapDispWeight     =  .5;   // Maximal disparity diff. by weight product to snap to plane
  		public double     plSnapDispWeight     =  .5;   // Maximal disparity diff. by weight product to snap to plane
  		public int        plSnapZeroMode       =  1;    // Zero strength snap mode: 0: no special treatment, 1 - strongest, 2 - farthest
  		public int        plSnapZeroMode       =  1;    // Zero strength snap mode: 0: no special treatment, 1 - strongest, 2 - farthest
  		
  		
  		public boolean    msUseSel             =   true; // Use planes selection masks (generated when splitting to intersecting pairs  
  		public boolean    msDivideByArea       =   true; // Divide plane strengths by ellipsoid area
  		public double     msScaleProj          =   1.5;  // Scale projection of the plane ellkipsoid 
  		
  		public boolean    replaceWeakOutlayers =   true; // false; 
  		public boolean    replaceWeakOutlayers =   true; // false; 
  		
  		
  		public boolean    dbg_migrate =            true; 
  		public boolean    dbg_migrate =            true; 
@@ -2509,6 +2513,10 @@ public class EyesisCorrectionParameters {
			properties.setProperty(prefix+"plSnapDispWeight", this.plSnapDispWeight +"");
			properties.setProperty(prefix+"plSnapDispWeight", this.plSnapDispWeight +"");
  			properties.setProperty(prefix+"plSnapZeroMode",   this.plSnapZeroMode+"");
  			properties.setProperty(prefix+"plSnapZeroMode",   this.plSnapZeroMode+"");


			properties.setProperty(prefix+"msUseSel",         this.msUseSel+"");
			properties.setProperty(prefix+"msDivideByArea",   this.msDivideByArea+"");
			properties.setProperty(prefix+"msScaleProj",      this.msScaleProj +"");
  			
			properties.setProperty(prefix+"dbg_migrate",            this.dbg_migrate+"");
			properties.setProperty(prefix+"dbg_migrate",            this.dbg_migrate+"");
  			
  			
			properties.setProperty(prefix+"show_ortho_combine",     this.show_ortho_combine+"");
			properties.setProperty(prefix+"show_ortho_combine",     this.show_ortho_combine+"");
@@ -2801,6 +2809,11 @@ public class EyesisCorrectionParameters {
  			if (properties.getProperty(prefix+"plSnapDispWeight")!=null)  this.plSnapDispWeight=Double.parseDouble(properties.getProperty(prefix+"plSnapDispWeight"));
  			if (properties.getProperty(prefix+"plSnapDispWeight")!=null)  this.plSnapDispWeight=Double.parseDouble(properties.getProperty(prefix+"plSnapDispWeight"));
  			if (properties.getProperty(prefix+"plSnapZeroMode")!=null)    this.plPrecision=Integer.parseInt(properties.getProperty(prefix+"plSnapZeroMode"));
  			if (properties.getProperty(prefix+"plSnapZeroMode")!=null)    this.plPrecision=Integer.parseInt(properties.getProperty(prefix+"plSnapZeroMode"));


  			if (properties.getProperty(prefix+"msUseSel")!=null)          this.msUseSel=Boolean.parseBoolean(properties.getProperty(prefix+"msUseSel"));
  			if (properties.getProperty(prefix+"msDivideByArea")!=null)    this.msDivideByArea=Boolean.parseBoolean(properties.getProperty(prefix+"msDivideByArea"));
  			if (properties.getProperty(prefix+"msScaleProj")!=null)       this.msScaleProj=Double.parseDouble(properties.getProperty(prefix+"msScaleProj"));

  			
  			if (properties.getProperty(prefix+"dbg_migrate")!=null)       this.dbg_migrate=Boolean.parseBoolean(properties.getProperty(prefix+"dbg_migrate"));
  			if (properties.getProperty(prefix+"dbg_migrate")!=null)       this.dbg_migrate=Boolean.parseBoolean(properties.getProperty(prefix+"dbg_migrate"));


  			if (properties.getProperty(prefix+"show_ortho_combine")!=null)     this.show_ortho_combine=Boolean.parseBoolean(properties.getProperty(prefix+"show_ortho_combine"));
  			if (properties.getProperty(prefix+"show_ortho_combine")!=null)     this.show_ortho_combine=Boolean.parseBoolean(properties.getProperty(prefix+"show_ortho_combine"));
@@ -3118,6 +3131,10 @@ public class EyesisCorrectionParameters {
  			gd.addNumericField("Maximal disparity diff. by weight product to snap to plane",                   this.plSnapDispWeight,  6);
  			gd.addNumericField("Maximal disparity diff. by weight product to snap to plane",                   this.plSnapDispWeight,  6);
  			gd.addNumericField("Zero strength snap mode: 0: no special treatment, 1 - strongest, 2 - farthest",this.plSnapZeroMode,  0);
  			gd.addNumericField("Zero strength snap mode: 0: no special treatment, 1 - strongest, 2 - farthest",this.plSnapZeroMode,  0);


  			gd.addCheckbox    ("Use planes selection masks (generated when splitting to intersecting pairs",   this.msUseSel);
  			gd.addCheckbox    ("Divide plane strengths by ellipsoid area",                                     this.msDivideByArea);
  			gd.addNumericField("Scale projection of the plane ellipsoid",                                      this.msScaleProj,  6);
  			
  			gd.addCheckbox    ("Test new mode after migration",                                                this.dbg_migrate);
  			gd.addCheckbox    ("Test new mode after migration",                                                this.dbg_migrate);


  			gd.addMessage     ("--- Other debug images ---");
  			gd.addMessage     ("--- Other debug images ---");
@@ -3417,6 +3434,10 @@ public class EyesisCorrectionParameters {
  			this.plSnapDispWeight=      gd.getNextNumber();
  			this.plSnapDispWeight=      gd.getNextNumber();
  			this.plSnapZeroMode=  (int) gd.getNextNumber();
  			this.plSnapZeroMode=  (int) gd.getNextNumber();


  			this.msUseSel=              gd.getNextBoolean();
  			this.msDivideByArea=        gd.getNextBoolean();
  			this.msScaleProj=           gd.getNextNumber();
  			
  			this.dbg_migrate=           gd.getNextBoolean();
  			this.dbg_migrate=           gd.getNextBoolean();


  			this.show_ortho_combine=    gd.getNextBoolean();
  			this.show_ortho_combine=    gd.getNextBoolean();
+30 −6
Original line number Original line Diff line number Diff line
@@ -21,12 +21,12 @@
 ** -----------------------------------------------------------------------------**
 ** -----------------------------------------------------------------------------**
 **
 **
 */
 */
import java.awt.Point;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Collections;
import java.util.Comparator;
import java.util.Comparator;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicInteger;



//import java.awt.Point;
//import java.awt.Point;
//import java.util.ArrayList;
//import java.util.ArrayList;


@@ -124,8 +124,8 @@ public class SuperTiles{
		for (bin = 0; bin < numBins; bin ++){
		for (bin = 0; bin < numBins; bin ++){
			bin_centers[bin] = binToDisparity(bin);  
			bin_centers[bin] = binToDisparity(bin);  
		}
		}
		initFuseCoeff(0.5, true); // true);
//		initFuseCoeff(0.5, true); // true);
//		initFuseCoeff(0.5, false); // true);
		initFuseCoeff(0.5, false); // true);
		
		
// Set up MeasuredLayers		
// Set up MeasuredLayers		
		measuredLayers = new MeasuredLayers(
		measuredLayers = new MeasuredLayers(
@@ -1566,7 +1566,7 @@ public class SuperTiles{
			data [nd] = new double [4* superTileSize*superTileSize];
			data [nd] = new double [4* superTileSize*superTileSize];
			for (int i = 0; i < data[nd].length; i++){
			for (int i = 0; i < data[nd].length; i++){
				data [nd][i] = Double.NaN; 		
				data [nd][i] = Double.NaN; 		
				for (int np = 0; np < num_p; np++) if ((selections [np] != null) && selections [np][ml][i]){
				for (int np = 0; np < num_p; np++) if ((selections [np] != null) && (selections [np][ml] != null) && selections [np][ml][i]){
					data [nd][i] = np + 1; 		
					data [nd][i] = np + 1; 		
					break;
					break;
				}
				}
@@ -1972,7 +1972,7 @@ public class SuperTiles{
								}
								}
							}
							}


							if (dl > 2) {
							if (dl > 3) {
								String [] dbg_titles = showSupertileSeparationTitles( disp_strength, plane_sels);
								String [] dbg_titles = showSupertileSeparationTitles( disp_strength, plane_sels);
								double [][] dbg_img = showSupertileSeparation(disp_strength, plane_sels);
								double [][] dbg_img = showSupertileSeparation(disp_strength, plane_sels);
								showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays();
								showDoubleFloatArrays sdfa_instance = new showDoubleFloatArrays();
@@ -2451,6 +2451,10 @@ public class SuperTiles{
			final double     max_diff_vert,  // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for vertical plane
			final double     max_diff_vert,  // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for vertical plane
			final int        max_tries,       // on last run - assign all rfemaining pixels to some cluster (disregard max_diff)
			final int        max_tries,       // on last run - assign all rfemaining pixels to some cluster (disregard max_diff)


			final boolean    msUseSel,        // final boolean                   use_sel,
			final boolean    msDivideByArea,  // final boolean                   divide_by_area,
			final double     msScaleProj,     // final double                    scale_projection,
			
			final double     smallDiff,  //       = 0.4;   // Consider merging initial planes if disparity difference below
			final double     smallDiff,  //       = 0.4;   // Consider merging initial planes if disparity difference below
			final double     highMix,    //stHighMix         = 0.4;   // Consider merging initial planes if jumps between ratio above
			final double     highMix,    //stHighMix         = 0.4;   // Consider merging initial planes if jumps between ratio above
			final double []  world_hor, // horizontal plane normal (default [0.0, 1.0, 0.0])
			final double []  world_hor, // horizontal plane normal (default [0.0, 1.0, 0.0])
@@ -2532,6 +2536,26 @@ public class SuperTiles{
				dbg_X,               // final int        dbg_X,
				dbg_X,               // final int        dbg_X,
				dbg_Y);              // final int        dbg_Y)
				dbg_Y);              // final int        dbg_Y)
		this.planes = new_planes; // save as "measured" (as opposed to "smoothed" by neighbors) planes
		this.planes = new_planes; // save as "measured" (as opposed to "smoothed" by neighbors) planes
/*		
		TileSurface tileSurface = new TileSurface(
				tileProcessor.getTileSize(),      // int tileSize,
				tileProcessor.getSuperTileSize(), // int superTileSize,
				tileProcessor.getTilesX(),        // int tilesX,
				tileProcessor.getTilesY(),        // int tilesY,
				geometryCorrection,               // GeometryCorrection geometryCorrection,
				tileProcessor.threadsMax);        // int threadsMax); 

		
		TileSurface.TileData [][] tileData = tileSurface.createTileShells (
				msUseSel,            // final boolean                   use_sel,
				msDivideByArea,      // final boolean                   divide_by_area,
				msScaleProj,         // final double                    scale_projection,
				this.planes,         // final TilePlanes.PlaneData [][] planes,
				debugLevel,          // final int        debugLevel,
				dbg_X,               // final int        dbg_X,
				dbg_Y);              // final int        dbg_Y)
*/		
		
	}
	}
	
	
	
	
+5 −3
Original line number Original line Diff line number Diff line
@@ -1487,7 +1487,7 @@ public class TilePlanes {
				double    scale_projection,
				double    scale_projection,
				int       debugLevel)
				int       debugLevel)
		{
		{
			double [][] disp_strength = new double[2][superTileSize*superTileSize];
			double [][] disp_strength = new double[2][4*superTileSize*superTileSize];
			double [] normal = getVector();
			double [] normal = getVector();
			double [] zxy =    getZxy(); // {disparity, x center in pixels, y center in pixels (relative to a supertile center)
			double [] zxy =    getZxy(); // {disparity, x center in pixels, y center in pixels (relative to a supertile center)
			double    weight = getWeight();
			double    weight = getWeight();
@@ -1533,10 +1533,12 @@ public class TilePlanes {
					{ss2, ss4,   0, ss2, -ss2,  ss2 },  // NE	
					{ss2, ss4,   0, ss2, -ss2,  ss2 },  // NE	
					{  0, ss4,   0, ss2,    0,  ss2 },  // E	
					{  0, ss4,   0, ss2,    0,  ss2 },  // E	
					{  0, ss2,   0, ss2,  ss2,  ss2 },  // SE	
					{  0, ss2,   0, ss2,  ss2,  ss2 },  // SE	
					{  0, ss2,   0, ss2,  ss2,    0 },  // S	
//					{  0, ss2,   0, ss2,  ss2,    0 },  // S	
					{  0, ss2,   0, ss4,  ss2,    0 },  // S	
					{  0, ss2, ss2, ss4,  ss2, -ss2 },  // SW	
					{  0, ss2, ss2, ss4,  ss2, -ss2 },  // SW	
					{  0, ss4, ss2, ss4,    0, -ss2 },  // W	
					{  0, ss4, ss2, ss4,    0, -ss2 },  // W	
					{ss2, ss4,   0, ss4, -ss2, -ss2 }}; // NW
//					{ss2, ss4,   0, ss4, -ss2, -ss2 }}; // NW
					{ss2, ss4, ss2, ss4, -ss2, -ss2 }}; // NW
			int dir1 = dir + 1;
			int dir1 = dir + 1;


//			for (int sy = -superTileSize; sy < superTileSize; sy++){
//			for (int sy = -superTileSize; sy < superTileSize; sy++){
+37 −1
Original line number Original line Diff line number Diff line
@@ -3066,6 +3066,11 @@ public class TileProcessor {
					clt_parameters.plMaxDiffVert,   // final double     max_diff_vert,  // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for vertical plane
					clt_parameters.plMaxDiffVert,   // final double     max_diff_vert,  // maximal disparity difference (to assign to a cluster (of Double.NaN) at first run for vertical plane
					clt_parameters.plInitPasses,    // final int        max_tries,       // on last run - assign all rfemaining pixels to some cluster (disregard max_diff)
					clt_parameters.plInitPasses,    // final int        max_tries,       // on last run - assign all rfemaining pixels to some cluster (disregard max_diff)


					clt_parameters.msUseSel,        // final boolean    msUseSel,        // final boolean                   use_sel,
					clt_parameters.msDivideByArea,  // final boolean    msDivideByArea,  // final boolean                   divide_by_area,
					clt_parameters.msScaleProj,     //final double     msScaleProj,     // final double                    scale_projection,
					
					
					clt_parameters.stSmallDiff,     //       = 0.4;   // Consider merging initial planes if disparity difference below
					clt_parameters.stSmallDiff,     //       = 0.4;   // Consider merging initial planes if disparity difference below
					clt_parameters.stHighMix,       // stHighMix         = 0.4;   // Consider merging initial planes if jumps between ratio above
					clt_parameters.stHighMix,       // stHighMix         = 0.4;   // Consider merging initial planes if jumps between ratio above
					world_hor,                      // final double []  world_hor, // horizontal plane normal (default [0.0, 1.0, 0.0])
					world_hor,                      // final double []  world_hor, // horizontal plane normal (default [0.0, 1.0, 0.0])
@@ -3156,6 +3161,37 @@ public class TileProcessor {
			}
			}
		}
		}
		
		

		
		TileSurface tileSurface = new TileSurface(
				st.tileProcessor.getTileSize(),      // int tileSize,
				st.tileProcessor.getSuperTileSize(), // int superTileSize,
				st.tileProcessor.getTilesX(),        // int tilesX,
				st.tileProcessor.getTilesY(),        // int tilesY,
				geometryCorrection,               // GeometryCorrection geometryCorrection,
				st.tileProcessor.threadsMax);        // int threadsMax); 

		
		TileSurface.TileData [][] tileData = tileSurface.createTileShells (
				clt_parameters.msUseSel,            // final boolean                   use_sel,
				clt_parameters.msDivideByArea,      // final boolean                   divide_by_area,
				clt_parameters.msScaleProj,         // final double                    scale_projection,
				st.planes,         // final TilePlanes.PlaneData [][] planes,
				0, // -1, // debugLevel,                  // final int        debugLevel)
				clt_parameters.tileX,
				clt_parameters.tileY);
		
		/*
		
					clt_parameters.msUseSel,        // final boolean    msUseSel,        // final boolean                   use_sel,
					clt_parameters.msDivideByArea,  // final boolean    msDivideByArea,  // final boolean                   divide_by_area,
					clt_parameters.msScaleProj,     //final double     msScaleProj,     // final double                    scale_projection,
		
 */
		
		
		
		
		TilePlanes.PlaneData[][][]       split_planes =   // use original (measured planes. See if smoothed are needed here)
		TilePlanes.PlaneData[][][]       split_planes =   // use original (measured planes. See if smoothed are needed here)
				st.breakPlanesToPairs(
				st.breakPlanesToPairs(
				st.getPlanes(), // Mod(),             // final TilePlanes.PlaneData[][] center_planes, // measured_planes,
				st.getPlanes(), // Mod(),             // final TilePlanes.PlaneData[][] center_planes, // measured_planes,