Commit 1361f670 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

planes from neighbor supertiles

parent 3f6c6c63
Loading
Loading
Loading
Loading
+15 −2
Original line number Original line Diff line number Diff line
@@ -2147,7 +2147,8 @@ public class EyesisCorrectionParameters {
  		public double     plTargetEigen        =   0.1;  // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
  		public double     plTargetEigen        =   0.1;  // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
  		public double     plFractOutliers      =   0.3;  // Maximal fraction of outliers to remove
  		public double     plFractOutliers      =   0.3;  // Maximal fraction of outliers to remove
  		public int        plMaxOutliers        =    20;  // Maximal number of outliers to remove
  		public int        plMaxOutliers        =    20;  // Maximal number of outliers to remove
  		
  		public double     plMinStrength        =   0.1;  // Minimal total strength of a plane 
  		public double     plMaxEigen           =   0.3;  // Maximal eigenvalue of a plane 
  		
  		
  		// other debug images
  		// other debug images
  		public boolean    show_ortho_combine =     false; // Show 'ortho_combine' 
  		public boolean    show_ortho_combine =     false; // Show 'ortho_combine' 
@@ -2163,7 +2164,7 @@ public class EyesisCorrectionParameters {
  		public boolean    show_neighbors =         false; // show 'neighbors' 
  		public boolean    show_neighbors =         false; // show 'neighbors' 
  		public boolean    show_flaps_dirs =        false; // show 'flaps-dirs' 
  		public boolean    show_flaps_dirs =        false; // show 'flaps-dirs' 
  		public boolean    show_first_clusters =    false; // show 'first_N_clusters' 
  		public boolean    show_first_clusters =    false; // show 'first_N_clusters' 
  		
  		public boolean    show_planes =            false; // show planes 
  		
  		
  		public CLTParameters(){}
  		public CLTParameters(){}
  		public void setProperties(String prefix,Properties properties){
  		public void setProperties(String prefix,Properties properties){
@@ -2386,6 +2387,8 @@ public class EyesisCorrectionParameters {
			properties.setProperty(prefix+"plTargetEigen",    this.plTargetEigen +"");
			properties.setProperty(prefix+"plTargetEigen",    this.plTargetEigen +"");
			properties.setProperty(prefix+"plFractOutliers",  this.plFractOutliers +"");
			properties.setProperty(prefix+"plFractOutliers",  this.plFractOutliers +"");
  			properties.setProperty(prefix+"plMaxOutliers",    this.plMaxOutliers+"");
  			properties.setProperty(prefix+"plMaxOutliers",    this.plMaxOutliers+"");
			properties.setProperty(prefix+"plMinStrength",    this.plMinStrength +"");
			properties.setProperty(prefix+"plMaxEigen",       this.plMaxEigen +"");


			properties.setProperty(prefix+"show_ortho_combine",     this.show_ortho_combine+"");
			properties.setProperty(prefix+"show_ortho_combine",     this.show_ortho_combine+"");
			properties.setProperty(prefix+"show_refine_supertiles", this.show_refine_supertiles+"");
			properties.setProperty(prefix+"show_refine_supertiles", this.show_refine_supertiles+"");
@@ -2399,6 +2402,7 @@ public class EyesisCorrectionParameters {
			properties.setProperty(prefix+"show_neighbors",         this.show_neighbors+"");
			properties.setProperty(prefix+"show_neighbors",         this.show_neighbors+"");
			properties.setProperty(prefix+"show_flaps_dirs",        this.show_flaps_dirs+"");
			properties.setProperty(prefix+"show_flaps_dirs",        this.show_flaps_dirs+"");
			properties.setProperty(prefix+"show_first_clusters",    this.show_first_clusters+"");
			properties.setProperty(prefix+"show_first_clusters",    this.show_first_clusters+"");
			properties.setProperty(prefix+"show_planes",            this.show_planes+"");
  		}
  		}
  		public void getProperties(String prefix,Properties properties){
  		public void getProperties(String prefix,Properties properties){
  			if (properties.getProperty(prefix+"transform_size")!=null) this.transform_size=Integer.parseInt(properties.getProperty(prefix+"transform_size"));
  			if (properties.getProperty(prefix+"transform_size")!=null) this.transform_size=Integer.parseInt(properties.getProperty(prefix+"transform_size"));
@@ -2614,6 +2618,8 @@ public class EyesisCorrectionParameters {
  			if (properties.getProperty(prefix+"plTargetEigen")!=null)     this.plTargetEigen=Double.parseDouble(properties.getProperty(prefix+"plTargetEigen"));
  			if (properties.getProperty(prefix+"plTargetEigen")!=null)     this.plTargetEigen=Double.parseDouble(properties.getProperty(prefix+"plTargetEigen"));
  			if (properties.getProperty(prefix+"plFractOutliers")!=null)   this.plFractOutliers=Double.parseDouble(properties.getProperty(prefix+"plFractOutliers"));
  			if (properties.getProperty(prefix+"plFractOutliers")!=null)   this.plFractOutliers=Double.parseDouble(properties.getProperty(prefix+"plFractOutliers"));
  			if (properties.getProperty(prefix+"plMaxOutliers")!=null)     this.plMaxOutliers=Integer.parseInt(properties.getProperty(prefix+"plMaxOutliers"));
  			if (properties.getProperty(prefix+"plMaxOutliers")!=null)     this.plMaxOutliers=Integer.parseInt(properties.getProperty(prefix+"plMaxOutliers"));
  			if (properties.getProperty(prefix+"plMinStrength")!=null)     this.plMinStrength=Double.parseDouble(properties.getProperty(prefix+"plMinStrength"));
  			if (properties.getProperty(prefix+"plMaxEigen")!=null)        this.plMaxEigen=Double.parseDouble(properties.getProperty(prefix+"plMaxEigen"));


  			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"));
  			if (properties.getProperty(prefix+"show_refine_supertiles")!=null) this.show_refine_supertiles=Boolean.parseBoolean(properties.getProperty(prefix+"show_refine_supertiles"));
  			if (properties.getProperty(prefix+"show_refine_supertiles")!=null) this.show_refine_supertiles=Boolean.parseBoolean(properties.getProperty(prefix+"show_refine_supertiles"));
@@ -2627,6 +2633,7 @@ public class EyesisCorrectionParameters {
  			if (properties.getProperty(prefix+"show_neighbors")!=null)         this.show_neighbors=Boolean.parseBoolean(properties.getProperty(prefix+"show_neighbors"));
  			if (properties.getProperty(prefix+"show_neighbors")!=null)         this.show_neighbors=Boolean.parseBoolean(properties.getProperty(prefix+"show_neighbors"));
  			if (properties.getProperty(prefix+"show_flaps_dirs")!=null)        this.show_flaps_dirs=Boolean.parseBoolean(properties.getProperty(prefix+"show_flaps_dirs"));
  			if (properties.getProperty(prefix+"show_flaps_dirs")!=null)        this.show_flaps_dirs=Boolean.parseBoolean(properties.getProperty(prefix+"show_flaps_dirs"));
  			if (properties.getProperty(prefix+"show_first_clusters")!=null)    this.show_first_clusters=Boolean.parseBoolean(properties.getProperty(prefix+"show_first_clusters"));
  			if (properties.getProperty(prefix+"show_first_clusters")!=null)    this.show_first_clusters=Boolean.parseBoolean(properties.getProperty(prefix+"show_first_clusters"));
  			if (properties.getProperty(prefix+"show_planes")!=null)            this.show_planes=Boolean.parseBoolean(properties.getProperty(prefix+"show_planes"));
  		}
  		}
  		
  		
  		public boolean showDialog() {
  		public boolean showDialog() {
@@ -2864,6 +2871,8 @@ public class EyesisCorrectionParameters {
  			gd.addNumericField("Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below", this.plTargetEigen,  6);
  			gd.addNumericField("Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below", this.plTargetEigen,  6);
  			gd.addNumericField("Maximal fraction of outliers to remove",                                       this.plFractOutliers,  6);
  			gd.addNumericField("Maximal fraction of outliers to remove",                                       this.plFractOutliers,  6);
  			gd.addNumericField("Maximal number of outliers to remove",                                         this.plMaxOutliers,  0);
  			gd.addNumericField("Maximal number of outliers to remove",                                         this.plMaxOutliers,  0);
  			gd.addNumericField("Minimal total strength of a plane",                                            this.plMinStrength,  6);
  			gd.addNumericField("Maximal eigenvalue of a plane",                                                this.plMaxEigen,  6);


  			gd.addMessage     ("--- Other debug images ---");
  			gd.addMessage     ("--- Other debug images ---");
  			gd.addCheckbox    ("Show 'ortho_combine'",                                                         this.show_ortho_combine);
  			gd.addCheckbox    ("Show 'ortho_combine'",                                                         this.show_ortho_combine);
@@ -2878,6 +2887,7 @@ public class EyesisCorrectionParameters {
  			gd.addCheckbox    ("show 'neighbors'",                                                             this.show_neighbors);
  			gd.addCheckbox    ("show 'neighbors'",                                                             this.show_neighbors);
  			gd.addCheckbox    ("Show 'flaps-dirs'",                                                            this.show_flaps_dirs);
  			gd.addCheckbox    ("Show 'flaps-dirs'",                                                            this.show_flaps_dirs);
  			gd.addCheckbox    ("Show 'first_N_clusters'",                                                      this.show_first_clusters);
  			gd.addCheckbox    ("Show 'first_N_clusters'",                                                      this.show_first_clusters);
  			gd.addCheckbox    ("Show planes",                                                                  this.show_planes);
  			WindowTools.addScrollBars(gd);
  			WindowTools.addScrollBars(gd);
  			gd.showDialog();
  			gd.showDialog();
  			
  			
@@ -3101,6 +3111,8 @@ public class EyesisCorrectionParameters {
  			this.plTargetEigen=         gd.getNextNumber();
  			this.plTargetEigen=         gd.getNextNumber();
  			this.plFractOutliers=       gd.getNextNumber();
  			this.plFractOutliers=       gd.getNextNumber();
  			this.plMaxOutliers=   (int) gd.getNextNumber();
  			this.plMaxOutliers=   (int) gd.getNextNumber();
  			this.plMinStrength=         gd.getNextNumber();
  			this.plMaxEigen=            gd.getNextNumber();


  			this.show_ortho_combine=     gd.getNextBoolean();
  			this.show_ortho_combine=     gd.getNextBoolean();
  			this.show_refine_supertiles= gd.getNextBoolean();
  			this.show_refine_supertiles= gd.getNextBoolean();
@@ -3114,6 +3126,7 @@ public class EyesisCorrectionParameters {
  			this.show_neighbors=         gd.getNextBoolean();
  			this.show_neighbors=         gd.getNextBoolean();
  			this.show_flaps_dirs=        gd.getNextBoolean();
  			this.show_flaps_dirs=        gd.getNextBoolean();
  			this.show_first_clusters=    gd.getNextBoolean();
  			this.show_first_clusters=    gd.getNextBoolean();
  			this.show_planes=            gd.getNextBoolean();
  			return true;
  			return true;
  		}
  		}
    }
    }
+31 −10
Original line number Original line Diff line number Diff line
@@ -356,6 +356,36 @@ public class GeometryCorrection {
		return xyz;
		return xyz;
	}
	}
	
	
	/**
	 * Find disparity for the intersection of the view ray (px, py) and a real-world plane orthogonal through the end of the
	 * vector norm_xyz
	 * @param norm_xyz vector from the origin (camera) orthogonal to the plane, length is a distance to the plane 
	 * @param px pixel coordinate horizontal
	 * @param py pixel coordinate vertical
	 * @param correctDistortions true for lens distortion correction, false otherwise
	 * @return disparity for the point on the plane specified by norm_xyz and known view coordinates px, py
	 */
	public double getPlaneDisparity(
			double [] norm_xyz,
			double px,
			double py,
			boolean correctDistortions) // correct distortion (will need corrected background too !)
	{
		double pXcd = px - 0.5 * this.pixelCorrectionWidth;
		double pYcd = py - 0.5 * this.pixelCorrectionHeight;
		double rD = Math.sqrt(pXcd*pXcd + pYcd*pYcd)*0.001*this.pixelSize; // distorted radius in a virtual center camera
		double rND2R = correctDistortions?(getRByRDist(rD/this.distortionRadius, false)): 1.0;
		double pXc = pXcd * rND2R; // non-distorted coordinates relative to the (0.5 * this.pixelCorrectionWidth, 0.5 * this.pixelCorrectionHeight)
		double pYc = pYcd * rND2R; // in pixels
		// point for the unity disparity
		double x =  SCENE_UNITS_SCALE * pXc * this.disparityRadius;
		double y = -SCENE_UNITS_SCALE * pYc * this.disparityRadius;
		double z = -SCENE_UNITS_SCALE * this.focalLength * this.disparityRadius / (0.001*this.pixelSize); // "+" - near, "-" far
		double vect_dot_norm = (x * norm_xyz[0]) +           (y * norm_xyz[1]) +           (z * norm_xyz[2]);
		double norm_dot_norm = (norm_xyz[0] * norm_xyz[0]) + (norm_xyz[1] * norm_xyz[1]) + (norm_xyz[2] * norm_xyz[2]);
		return vect_dot_norm / norm_dot_norm; 
	}
	
	/* Just for testing using delta instead of d */
	/* Just for testing using delta instead of d */
	public double [][] getWorldJacobian(
	public double [][] getWorldJacobian(
			double px,
			double px,
@@ -419,15 +449,6 @@ public class GeometryCorrection {
		// k = rD/r
		// k = rD/r
		double d_k_d_rrND = correctDistortions?getDerivRDistFromR(rrND):0.0;
		double d_k_d_rrND = correctDistortions?getDerivRDistFromR(rrND):0.0;
		double d_rND2R_d_rrD = - rND2R * rND2R * d_k_d_rrND / ( d_k_d_rrND * rrND + 1.0/ rND2R); // rrND);
		double d_rND2R_d_rrD = - rND2R * rND2R * d_k_d_rrND / ( d_k_d_rrND * rrND + 1.0/ rND2R); // rrND);
/*		

		double d_rND2R_d_rrD0 = correctDistortions?(getDerivRByRDist(rrD, false)): 0.0;
		
		double d_rND2R_d_rrD1 = correctDistortions?(getDerivRByRDist(rrD, false, 0.00001)): 0.0;
		if (debug) {
			System.out.println("getWorldJacobian(): d_rND2R_d_rrD="+d_rND2R_d_rrD+", d_rND2R_d_rrD0="+d_rND2R_d_rrD0+", d_rND2R_d_rrD1="+d_rND2R_d_rrD1 ); 
		}
*/		
		
		
		double d_rND2R_d_px = d_rND2R_d_rrD * d_rRD_d_px;   
		double d_rND2R_d_px = d_rND2R_d_rrD * d_rRD_d_px;   
		double d_rND2R_d_py = d_rND2R_d_rrD * d_rRD_d_py;   
		double d_rND2R_d_py = d_rND2R_d_rrD * d_rRD_d_py;   
@@ -514,7 +535,7 @@ public class GeometryCorrection {
			boolean correctDistortions,
			boolean correctDistortions,
			int debugLevel)
			int debugLevel)
	{
	{
		if (debugLevel > 0){
		if (debugLevel > 1){
			System.out.println("getImageJacobian():");
			System.out.println("getImageJacobian():");
		}
		}
		double x = xyz[0];
		double x = xyz[0];
+194 −9
Original line number Original line Diff line number Diff line
@@ -21,8 +21,13 @@
 ** -----------------------------------------------------------------------------**
 ** -----------------------------------------------------------------------------**
 **
 **
 */
 */
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicInteger;


//import TilePlanes.PlaneData;

//import TilePlanes.PlaneData;

public class SuperTiles{
public class SuperTiles{
	        TileProcessor tileProcessor;
	        TileProcessor tileProcessor;
			double      step_far;
			double      step_far;
@@ -45,6 +50,8 @@ public class SuperTiles{
			double []   bgStrength = null;
			double []   bgStrength = null;
//			TileProcessor.CLTPass3d cltPass3d;
//			TileProcessor.CLTPass3d cltPass3d;
			CLTPass3d cltPass3d;
			CLTPass3d cltPass3d;
//			ArrayList<TilePlanes.PlaneData>[] planes = null;
			TilePlanes.PlaneData [][] planes = null;
			public SuperTiles(
			public SuperTiles(
					CLTPass3d cltPass3d,
					CLTPass3d cltPass3d,
					double                  step_near,
					double                  step_near,
@@ -118,7 +125,10 @@ public class SuperTiles{
				return min_disparity + d;  
				return min_disparity + d;  
			}
			}
			
			
			
			public TilePlanes.PlaneData [][] getPlanes()
			{
				return planes;			
			}
			private double [][] getLapWeights(){
			private double [][] getLapWeights(){
				final int superTileSize = tileProcessor.superTileSize;
				final int superTileSize = tileProcessor.superTileSize;
				final double [][] lapWeight = new double [2 * superTileSize][2 * superTileSize];
				final double [][] lapWeight = new double [2 * superTileSize][2 * superTileSize];
@@ -1051,6 +1061,9 @@ public class SuperTiles{
				final int len2 = superTileSize2*superTileSize2;
				final int len2 = superTileSize2*superTileSize2;
				final double []  double_zero =  new double  [len2];
				final double []  double_zero =  new double  [len2];
				final boolean [] boolean_zero = new boolean [len2];
				final boolean [] boolean_zero = new boolean [len2];
//ArrayList<Individual>[] group = (ArrayList<Individual>[])new ArrayList[4];
//				this.planes = (ArrayList<TilePlanes.PlaneData>[]) new ArrayList[nStiles];
				this.planes = new TilePlanes.PlaneData[nStiles][];
				
				
//				final int debug_stile = 18 * stilesX + 25; 
//				final int debug_stile = 18 * stilesX + 25; 
//				final int debug_stile = 20 * stilesX + 24; 
//				final int debug_stile = 20 * stilesX + 24; 
@@ -1102,8 +1115,9 @@ public class SuperTiles{
										}
										}
									}
									}
								}
								}
								planes[nsTile] = null;
								if (sw >0){
								if (sw >0){

									ArrayList<TilePlanes.PlaneData> st_planes = new ArrayList<TilePlanes.PlaneData>();
//									int dl = ((nsTile >= debug_stile-1) && (nsTile <= debug_stile+1) ) ? 1 : 0;
//									int dl = ((nsTile >= debug_stile-1) && (nsTile <= debug_stile+1) ) ? 1 : 0;
//									int dl = ((stileY == 17) && (stileX > 4)) ? 1 : 0;
//									int dl = ((stileY == 17) && (stileX > 4)) ? 1 : 0;
//									int dl = (stileY >= 0) ? 1 : 0;
//									int dl = (stileY >= 0) ? 1 : 0;
@@ -1124,7 +1138,7 @@ public class SuperTiles{
										//correct_distortions
										//correct_distortions
										double swc_common = pd.getWeight();
										double swc_common = pd.getWeight();
										if (dl > 0) {
										if (dl > 0) {
											if (swc_common > 1.0) {
											if (swc_common > 0.3) { // 1.0) {
												System.out.println("Processing planes["+nsTile+"]"+
												System.out.println("Processing planes["+nsTile+"]"+
														", stileX="+stileX+
														", stileX="+stileX+
														", stileY="+stileY+
														", stileY="+stileY+
@@ -1157,7 +1171,7 @@ public class SuperTiles{
													plMinPoints,  // int        minLeft,     // minimal number of tiles to keep
													plMinPoints,  // int        minLeft,     // minimal number of tiles to keep
													dl1); // 0); // debugLevel);
													dl1); // 0); // debugLevel);
											if (dl > 0) {
											if (dl > 0) {
												if (swc_common > 1.0) {
												if (swc_common > 0.3) { // 1.0) {
													System.out.println("Removed outliers["+nsTile+"]"+
													System.out.println("Removed outliers["+nsTile+"]"+
															", stileX="+stileX+
															", stileX="+stileX+
															", stileY="+stileY+
															", stileY="+stileY+
@@ -1182,6 +1196,7 @@ public class SuperTiles{
													norm_xyz[0]+", "+norm_xyz[1]+", "+norm_xyz[2]+"}");
													norm_xyz[0]+", "+norm_xyz[1]+", "+norm_xyz[2]+"}");


										}
										}
										st_planes.add(pd);
										
										
										// now try for each of the disparity-separated clusters
										// now try for each of the disparity-separated clusters
										
										
@@ -1274,6 +1289,7 @@ public class SuperTiles{
													}
													}
													norm_xyz = pd.getWorldXYZ(
													norm_xyz = pd.getWorldXYZ(
															correct_distortions);
															correct_distortions);
													st_planes.add(pd);
													if (dl > 0) {
													if (dl > 0) {
														System.out.println("World normal["+nsTile+"]["+m+"] = {"+
														System.out.println("World normal["+nsTile+"]["+m+"] = {"+
																norm_xyz[0]+", "+norm_xyz[1]+", "+norm_xyz[2]+"}");
																norm_xyz[0]+", "+norm_xyz[1]+", "+norm_xyz[2]+"}");
@@ -1283,7 +1299,11 @@ public class SuperTiles{
											}
											}
										}
										}
									}
									}
									if (st_planes.size() > 0){
										planes[nsTile] = st_planes.toArray(new TilePlanes.PlaneData[0] );
									}
									}
								} // if sw >0
								
							}
							}
						}
						}
					};
					};
@@ -1291,5 +1311,170 @@ public class SuperTiles{
				ImageDtt.startAndJoin(threads);
				ImageDtt.startAndJoin(threads);
			}
			}


			public int [] getShowPlanesWidthHeight()
			{
				final int tilesX =        tileProcessor.getTilesX();
				final int tilesY =        tileProcessor.getTilesY();
				final int superTileSize = tileProcessor.getSuperTileSize();
//				final int tileSize =      tileProcessor.getTileSize();
				final int stilesX = (tilesX + superTileSize -1)/superTileSize;  
				final int stilesY = (tilesY + superTileSize -1)/superTileSize;
				int [] wh = {
						stilesX * superTileSize,// * tileSize,
						stilesY * superTileSize};// * tileSize};
				return wh;
			}

//			public double [][] 
			TilePlanes.PlaneData [][] getNeibPlanes(
					final int     dir     // 0: get from up (N), 1:from NE, ... 7 - from NW
//					final double  minWeight,
//					final double  maxEigen,
//					final double  dispNorm,
//					final boolean use_NaN
					)
			{
				final int tilesX =        tileProcessor.getTilesX();
				final int tilesY =        tileProcessor.getTilesY();
				final int superTileSize = tileProcessor.getSuperTileSize();
				final int tileSize =      tileProcessor.getTileSize();
				final int stilesX = (tilesX + superTileSize -1)/superTileSize;  
				final int stilesY = (tilesY + superTileSize -1)/superTileSize;
//				final int width =  stilesX * superTileSize; // * tileSize;
//				final int height = stilesY * superTileSize; // * tileSize;
				final double [] nan_plane = new double [superTileSize*superTileSize];
				for (int i = 0; i < nan_plane.length; i++) nan_plane[i] = Double.NaN;
//				final int centerIndex = (superTileSize+1) * superTileSize / 2;
				final int [][] dirsYX = {{-1, 0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}};
				TilePlanes.PlaneData [][] neib_planes = new TilePlanes.PlaneData[stilesY * stilesX][];
				TilePlanes tpl = null; // new TilePlanes(tileSize,superTileSize, geometryCorrection);
//				final int debug_stile = 17 * stilesX + 27;
				final int debug_stile = 20 * stilesX + 27;

				for (int sty0 = 0; sty0 < stilesY; sty0++){
					int sty = sty0 + dirsYX[dir][0];
					for (int stx0 = 0; stx0 < stilesX; stx0++){
						int nsTile0 = sty0 * stilesX + stx0; // result tile
						int stx = stx0 + dirsYX[dir][1];
						int nsTile = sty * stilesX + stx; // from where to get
						if ((sty >= 0) && (sty < stilesY) && (stx >= 0) && (stx < stilesX) && (planes[nsTile] != null)) {
							neib_planes[nsTile0] = new TilePlanes.PlaneData[planes[nsTile].length];
							for (int np = 0; np < planes[nsTile].length; np++){
								GeometryCorrection geometryCorrection = planes[nsTile][np].getGeometryCorrection();
								int [] sTileXY0 = {stx0,sty0}; 
								if (tpl == null) {
									tpl = new TilePlanes(tileSize,superTileSize, geometryCorrection);
								}
								TilePlanes.PlaneData pd = tpl.new PlaneData(
										sTileXY0,
										tileSize,
										superTileSize,
										geometryCorrection);
								/*
								TilePlanes.PlaneData pd = planes[nsTile0][np].clone();
								pd.setS
								*/
								if (nsTile0 == debug_stile) {
									System.out.println("getNeibPlanes(): nsTile0="+nsTile0+", nsTile="+nsTile+", np = "+np+" dir = "+ dir ); 
								}
								neib_planes[nsTile0][np] = pd.getPlaneToThis(
										planes[nsTile][np], // PlaneData otherPd,
										(nsTile0 == debug_stile)? 1:0); // int       debugLevel)
							}
						} else {
							neib_planes[nsTile0] = null;
						}
					}
				}
				return neib_planes;
			}
			
			public double [][] getShowPlanes(
					TilePlanes.PlaneData [][] planes,
					double minWeight,
					double maxEigen,
					double dispNorm,
					boolean use_NaN)
			{
				final int tilesX =        tileProcessor.getTilesX();
				final int tilesY =        tileProcessor.getTilesY();
				final int superTileSize = tileProcessor.getSuperTileSize();
//				final int tileSize =      tileProcessor.getTileSize();
				final int stilesX = (tilesX + superTileSize -1)/superTileSize;  
				final int stilesY = (tilesY + superTileSize -1)/superTileSize;
				final int width =  stilesX * superTileSize; // * tileSize;
				final int height = stilesY * superTileSize; // * tileSize;
				final double [] nan_plane = new double [superTileSize*superTileSize];
				for (int i = 0; i < nan_plane.length; i++) nan_plane[i] = Double.NaN;
				final int centerIndex = (superTileSize+1) * superTileSize / 2;

//				final int debug_stile = 17 * stilesX + 27;
				final int debug_stile = 20 * stilesX + 27;
//				final int debug_stile = 19 * stilesX + 27;
				// scan all get maximal number of satisfying planes
				int num_planes = 0;
				for (int i = 0; i < planes.length; i++) {
					if (i == debug_stile) {
						System.out.println("getShowPlanes():1, tile = "+i);
					}
					if ((planes[i] != null) && (planes[i].length > num_planes)){
						int num_sat = 0;
						for (int j = 0; j < planes[i].length; j++){
							if (planes[i][j].getWeight() >= minWeight){
								double eigVal = planes[i][j].getValue(); // ************** generated does not have value ????????????
								double disp = planes[i][j].getPlaneDisparity(false)[centerIndex];
								if (disp > dispNorm) {
									eigVal *= dispNorm / disp;
								}
								if (eigVal < maxEigen) num_sat ++;
							}
						}
						if (num_sat > num_planes) num_planes = num_sat;
					}
				}
				double [][] data = new double[num_planes][width*height];
				for (int sty = 0; sty < stilesY; sty++){
					for (int stx = 0; stx < stilesX; stx++){
						int nsTile = sty * stilesX + stx;
						if (nsTile == debug_stile) {
							System.out.println("getShowPlanes():2, tile = "+nsTile);
						}
						int ns = 0;
						double [] plane = nan_plane;
						int indx = (sty * superTileSize) * width + (stx * superTileSize);
						boolean debug = (nsTile == debug_stile) ; // (sty == 18) && (stx == 28);
						if (debug) {
							System.out.println("getShowPlanes():"+((planes[nsTile] != null)? planes[nsTile].length : "null"));
						}
						if (planes[nsTile] != null) {
							for (int np = 0; np < planes[nsTile].length; np++){
								if (planes[nsTile][np].getWeight() >= minWeight){
									//&& (planes[nsTile][np].getValue() < maxEigen)){
									double eigVal = planes[nsTile][np].getValue();
//									double disp = planes[nsTile][np].getPlaneDisparity(false)[centerIndex];
									double disp = planes[nsTile][np].getZxy()[0];
									if (disp > dispNorm) {
										eigVal *= dispNorm / disp;
									}
									if (eigVal < maxEigen) {
										plane = planes[nsTile][np].getPlaneDisparity(use_NaN);
										for (int y = 0; y < superTileSize; y++) {
											System.arraycopy(plane, superTileSize * y, data[ns], indx + width * y, superTileSize);
										}
										ns ++;
									}
								}
							}
						}
						// fill same (nearest) plane or NaN if none was available
						for (; ns < num_planes; ns++){
							for (int y = 0; y < superTileSize; y++) {
								System.arraycopy(plane, superTileSize * y, data[ns], indx + width * y, superTileSize);
							}
						}
					}
				}
				return data;
			}


		} // end of class SuperTiles
		} // end of class SuperTiles