Commit 02a4440e authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Documenting, cleaning up

parent b4600e81
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3172,7 +3172,7 @@ public class CLTParameters {
		gd.addNumericField("Lazy eye cluster size",                                                             this.tileStep,                  0, 6, "tiles",
				"Process tileStep x tileStep cluster of tiles when adjusting lazy eye parameters");
		gd.addNumericField("Consolidate multiple clusterts around given for low-contrast infinity",             this.super_radius,              0, 6, "clusters",
				"e.g. for clouds in tghe sky  0 - none, 1 - 3x3, 2 - 5x5");
				"e.g. for clouds in the sky  0 - none, 1 - 3x3, 2 - 5x5");
		gd.addNumericField("Bit mask - which of 4 transforms to combine after iclt",                            this.iclt_mask,                 0);
		gd.addNumericField("Tile X to extract (0..163)",                                                        this.tileX,                     0);
		gd.addNumericField("Tile Y to extract (0..122)",                                                        this.tileY,                     0);
@@ -3628,7 +3628,7 @@ public class CLTParameters {
		gd.addNumericField("Maximal motion blur to reduce weight",this.tex_mb, 5,7,"pix",
				"Reduce texture weight if motion blur exceeds this (as square of MB length).");
		
		gd.addNumericField("Max disparity for meshe generation", this.tex_max_disparity_lim, 5,7,"pix",
		gd.addNumericField("Max disparity for mesh generation",  this.tex_max_disparity_lim, 5,7,"pix",
				"Do not allow stray disparities above this.");
		gd.addNumericField("Minimal disparity for FG trimming",  this.tex_min_trim_disparity, 5,7,"pix",
				"Do not try to trim texture outlines with lower disparities.");
+1 −1
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ public class IntersceneMatchParameters {
	public  double  cold_scale =                       0.2;  // <=1.0. 1.0 - disables temperature dependence
	public  double  sky_seed =                         5.0;  // start with product of strength by diff_second below this
	public  double  lma_seed =                         2.0;  // seed - disparity_lma limit		double sky_lim  =      15.0; // then expand to product of strength by diff_second below this
	public  int     sky_shrink =                       3;
	public  int     sky_shrink =                       2;
	public  int     seed_rows =                        5; // sky should appear in this top rows 
	public  double  sky_lim =                         15.0; // then expand to product of strength by diff_second below this
	public  int     sky_expand_extra =                 0; // 1?
+5 −4
Original line number Diff line number Diff line
@@ -4878,7 +4878,7 @@ public class OpticalFlow {
		
		// generates 3-d modes, colors, stereos, tiffs/videos
		
		if (generate_mapped || reuse_video) {
		if (generate_mapped || reuse_video) { // modifies combo_dsn_final ?
			int tilesX =  quadCLTs[ref_index].getTileProcessor().getTilesX();
	        int tilesY =  quadCLTs[ref_index].getTileProcessor().getTilesY();
	        double [] disparity_fg =  null;
@@ -5328,7 +5328,7 @@ public class OpticalFlow {
		
		// debugging 3D model
		if (export3d) {
		if (export3d) { //combo_dsn_final had strength 1.0e-4 where it should not? Reset it?
			boolean ok_3d = TexturedModel.output3d( // quadCLTs have same image name, and everything else
					clt_parameters,      // CLTParameters                            clt_parameters,
					colorProcParameters, // ColorProcParameters                      colorProcParameters,
@@ -10472,7 +10472,8 @@ public class OpticalFlow {
				sigma);               // double      sigma);
		dbg_img[11] = disp.clone();
		double [][] ds = {disp,     dls[2]};
		if (blue_sky != null) { // Temporary, dix - pass blue_sky to fillDisparityStrength()
		if (blue_sky != null) { // Temporary, fix - pass blue_sky to fillDisparityStrength()
			ds[1] = ds[1].clone();
			for (int i = 0; i < clean_lma.length; i++) if (blue_sky[i]){
				ds[0][i] = 0.0;
				ds[1][i] = 0.0001;
+7 −4
Original line number Diff line number Diff line
@@ -1653,7 +1653,7 @@ public class TexturedModel {
		final int     jpeg_quality =     clt_parameters.tex_jpeg_quality; //95;   // JPEG quality for textures
		
		final boolean showTri =          !batch_mode && (debugLevel > -1) && (clt_parameters.show_triangles);
		final boolean disp_hires_tri =    clt_parameters.tex_disp_hires_tri;
		final boolean disp_hires_tri =   !batch_mode && clt_parameters.tex_disp_hires_tri;
		final int dbg_scale_mesh =        clt_parameters.tex_dbg_scale_mesh; //  4; // <=0 - do not show
		
		
@@ -1678,6 +1678,11 @@ public class TexturedModel {
		final int width = tilesX * transform_size;
		final int height = tp.getTilesY() * transform_size;
		// get multi-scene disparity map for FG and BG and filter it
		if (combo_dsn_final != null) {
			System.out.println("output3d(): combo_dsn_final is not null - setting it to null");
			System.out.println("As there was a problem with (wrong?) blue sky setting strength to 0.0001");
			combo_dsn_final = null;
		}
		if (combo_dsn_final == null) {
			combo_dsn_final =scenes[ref_index].readDoubleArrayFromModelDirectory(
					"-INTER-INTRA-LMA", // String      suffix,
@@ -2000,9 +2005,8 @@ public class TexturedModel {
								tp.getTilesY(),         // int             tilesY,
								ref_scene.getGeometryCorrection(), // GeometryCorrection geometryCorrection,
								clt_parameters.correct_distortions, // requires backdrop image to be corrected also
								dbg_mesh_imgs[nslice],  //   double []       tri_img,   //
								((dbg_mesh_imgs != null) ? dbg_mesh_imgs[nslice]:null),  //   double []       tri_img,   //
								dbg_scaled_width,       // int             tri_img_width,
//								showTri,                // (scanIndex < next_pass + 1) && clt_parameters.show_triangles,
								// FIXME: make a separate parameter:
								infinity_disparity,            //  0.25 * clt_parameters.bgnd_range,  // 0.3
								clt_parameters.grow_disp_max,  // other_range, // 2.0 'other_range - difference from the specified (*_CM)
@@ -2010,7 +2014,6 @@ public class TexturedModel {
							    clt_parameters.maxZtoXY,       // double          maxZtoXY,       // 10.0. <=0 - do not use
							    clt_parameters.maxZ,
							    clt_parameters.limitZ,
//							    dbg_disp_tri_slice,           //   double [][]     dbg_disp_tri_slice,
								debugLevel + 1,               //   int             debug_level) > 0
								clt_parameters.tex_dbg_plot_center,              //   boolean         dbg_plot_center, //  = true;
								clt_parameters.tex_dbg_line_color,               //   double          dbg_line_color, //  =  1.0;
+57 −4
Original line number Diff line number Diff line
@@ -392,6 +392,11 @@ public class TileNeibs{
		return -1; // should not happen
	}
	
	/**
	 * Invert selection in a single or multithreaded environment.
	 * @param tiles array to invert
	 * @return inverted array
	 */
	public static boolean [] invertSelection(
			final boolean [] tiles) {
		final boolean [] itiles = new boolean [tiles.length];
@@ -399,6 +404,12 @@ public class TileNeibs{
		return itiles;
	}

	/**
	 * Invert selection in a single or multithreaded environment. May be in-place if tiles and itiles
	 * are the same array.
	 * @param tiles  input array to be inverted
	 * @param itiles output array of the same size as the input one. May be the same as tiles
	 */
	public static void invertSelection(
			final boolean [] tiles,
			final boolean [] itiles
@@ -423,6 +434,12 @@ public class TileNeibs{
		}
	}

	/**
	 * And boolean array to another boolean array in a single or multithreaded environment.
	 * dst_tiles &= src_tiles
	 * @param src_tiles array to AND to another one
	 * @param dst_tiles array to be modified by AND-ing with the first one
	 */
	public static void andSelection(
			final boolean [] src_tiles,
			final boolean [] dst_tiles
@@ -448,9 +465,15 @@ public class TileNeibs{
	}
	
	
	
	/**
	 * Shrink boolean array (single or multithreaded depending on is
	 * it called from the main thread or not) 
	 * @param shrink    see definitons for growSelection()
	 * @param tiles     selection array (should be [sizeX * sizeY])
	 * @param prohibit  optional (may be null) array of prohibited tiles (for both originating and destination)
	 */
	public void shrinkSelection(
			int        shrink,           // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
			final int        shrink,           // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
			final boolean [] tiles,  
			final boolean [] prohibit)
	{
@@ -463,6 +486,14 @@ public class TileNeibs{
	}

	
	/**
	 * Select outmost pixels of the selection (single or multithreaded depending on is
	 * it called from the main thread or not)
	 * @param shrink    see definitons for growSelection()
	 * @param tiles     selection array (should be [sizeX * sizeY])
	 * @param prohibit  optional (may be null) array of prohibited tiles
	 * @return tile selection of the outmost tiles of the input tiles
	 */
	public boolean [] getEdgeSelection(
			int        shrink,           // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
			boolean [] tiles,
@@ -807,6 +838,14 @@ public class TileNeibs{
		}
	}

	/**
	 * Grow pixel selection in multiple threads.
	 * @param grow     amount of growth: 1 - 1 pixel in ortho (up/down, right/left) directions,
	 *                 2 - ortho+diagonal, 3 - 2 steps in ortho, etc.
	 * @param tiles    boolean array to grow (should be [sizeX * sizeY])
	 * @param prohibit optional array (may be null) that prohibits growth (for both originating and
	 *                 destination tiles). 
	 */
	public void growSelectionMulti( // multithreaded version
			int        grow,           // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
			final boolean [] tiles,
@@ -925,12 +964,26 @@ public class TileNeibs{
	
	
	
	
	/**
	 * Find out if the current thread is main.
	 * @return true for the main thread, false - for others
	 */
	public static boolean isMainThread() {
		return Thread.currentThread().getName().equals("main");
	}
	

	
	/**
	 * Grow pixel selection in either a single thread (if the method is called from one of
	 * concurrent threads (already used by multiple callers) or in multiple threads if the
	 * current thread is "main"
	 * @param grow     amount of growth: 1 - 1 pixel in ortho (up/down, right/left) directions,
	 *                 2 - ortho+diagonal, 3 - 2 steps in ortho, etc.
	 * @param tiles    boolean array to grow (should be [sizeX * sizeY])
	 * @param prohibit optional array (may be null) that prohibits growth (for both originating and
	 *                 destination tiles). 
	 */
	public void growSelection(
			int              grow,           // grow tile selection by 1 over non-background tiles 1: 4 directions, 2 - 8 directions, 3 - 8 by 1, 4 by 1 more
			final boolean [] tiles,
Loading