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

Generating files to feed to ML

parent c682d587
Loading
Loading
Loading
Loading
+85 −20
Original line number Original line Diff line number Diff line
@@ -745,6 +745,7 @@ private Panel panel1,
			addButton("Batch Noise Aux",            panelClt5aux, color_report);
			addButton("Batch Noise Aux",            panelClt5aux, color_report);
			addButton("Noise Stats Aux",            panelClt5aux, color_process);
			addButton("Noise Stats Aux",            panelClt5aux, color_process);
			addButton("Colorize Depth",             panelClt5aux, color_process);
			addButton("Colorize Depth",             panelClt5aux, color_process);
			addButton("Inter Intra ML",             panelClt5aux, color_report);
			plugInFrame.add(panelClt5aux);
			plugInFrame.add(panelClt5aux);
		}
		}
		
		
@@ -5325,6 +5326,13 @@ private Panel panel1,
        CLT_PARAMETERS.batch_run = true;
        CLT_PARAMETERS.batch_run = true;
        intersceneNoise(true, false, false); // boolean  bayer_artifacts_debug);
        intersceneNoise(true, false, false); // boolean  bayer_artifacts_debug);
    	return;
    	return;
/* ======================================================================== */
    } else if (label.equals("Inter Intra ML")) {
        DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
    	EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
        CLT_PARAMETERS.batch_run = true;
        inter_intra_export(true);
    	return;
/* ======================================================================== */
/* ======================================================================== */
    } else if (label.equals("Batch Noise Aux")) {
    } else if (label.equals("Batch Noise Aux")) {
        DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
        DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
@@ -7211,10 +7219,9 @@ private Panel panel1,
		return true;
		return true;
	}
	}
	public boolean intersceneNoise(
	public boolean inter_intra_export(
			boolean use_aux,
			boolean use_aux) {
			boolean batch_noise,
		
			boolean bayer_artifacts_debug) {
		long startTime=System.nanoTime();
		long startTime=System.nanoTime();
		// load needed sensor and kernels files
		// load needed sensor and kernels files
		if (!prepareRigImages()) return false;
		if (!prepareRigImages()) return false;
@@ -7224,7 +7231,6 @@ private Panel panel1,
		if (DEBUG_LEVEL > -2){
		if (DEBUG_LEVEL > -2){
			System.out.println("++++++++++++++ Testing Interscene processing ++++++++++++++");
			System.out.println("++++++++++++++ Testing Interscene processing ++++++++++++++");
		}
		}
		/*
		if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
		if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
			if (GPU_TILE_PROCESSOR == null) {
			if (GPU_TILE_PROCESSOR == null) {
				try {
				try {
@@ -7236,12 +7242,24 @@ private Panel panel1,
					return false;
					return false;
				} //final int        debugLevel);
				} //final int        debugLevel);
			}
			}
			if (use_aux) {
				if (CLT_PARAMETERS.useGPU(true) && (QUAD_CLT_AUX != null) && (GPU_QUAD_AUX == null)) { // if GPU AUX is needed
					try {
						GPU_QUAD_AUX =  new GpuQuad(//
								GPU_TILE_PROCESSOR, QUAD_CLT_AUX);
					} catch (Exception e) {
						System.out.println("Failed to initialize GpuQuad class");
						// TODO Auto-generated catch block
						e.printStackTrace();
						return false;
					} //final int        debugLevel);
					QUAD_CLT_AUX.setGPU(GPU_QUAD_AUX);
				}
			} else {
				if (CLT_PARAMETERS.useGPU(false) && (QUAD_CLT != null) && (GPU_QUAD == null)) { // if GPU main is needed
				if (CLT_PARAMETERS.useGPU(false) && (QUAD_CLT != null) && (GPU_QUAD == null)) { // if GPU main is needed
					try {
					try {
						GPU_QUAD = new GpuQuad(
						GPU_QUAD = new GpuQuad(
							GPU_TILE_PROCESSOR, QUAD_CLT,
								GPU_TILE_PROCESSOR, QUAD_CLT);
							4,
							3);
					} catch (Exception e) {
					} catch (Exception e) {
						System.out.println("Failed to initialize GpuQuad class");
						System.out.println("Failed to initialize GpuQuad class");
						// TODO Auto-generated catch block
						// TODO Auto-generated catch block
@@ -7250,8 +7268,55 @@ private Panel panel1,
					} //final int        debugLevel);
					} //final int        debugLevel);
					QUAD_CLT.setGPU(GPU_QUAD);
					QUAD_CLT.setGPU(GPU_QUAD);
				}
				}
			}
		}
		QuadCLT quadCLT = use_aux ? QUAD_CLT_AUX : QUAD_CLT;
		ColorProcParameters colorProcParameters = use_aux ? COLOR_PROC_PARAMETERS_AUX : COLOR_PROC_PARAMETERS;
		try {
			TWO_QUAD_CLT.interIntraExportML(
					quadCLT,                    // QuadCLT quadCLT_main,
					CLT_PARAMETERS,             // EyesisCorrectionParameters.DCTParameters           dct_parameters,
					DEBAYER_PARAMETERS,         // EyesisCorrectionParameters.DebayerParameters     debayerParameters,
					colorProcParameters,        // EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
					CHANNEL_GAINS_PARAMETERS,   // CorrectionColorProc.ColorGainsParameters     channelGainParameters,
					RGB_PARAMETERS,             // EyesisCorrectionParameters.RGBParameters             rgbParameters,
					EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
					PROPERTIES,                 // Properties                                           properties,
					THREADS_MAX,                // final int          threadsMax,  // maximal number of threads to launch
					UPDATE_STATUS,              // final boolean    updateStatus,
					DEBUG_LEVEL);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} //final int        debugLevel);
		if (configPath!=null) {
			saveTimestampedProperties( // save config again
					configPath,      // full path or null
					null, // use as default directory if path==null
					true,
					PROPERTIES);
		}
		System.out.println("batchRig(): Processing finished at "+
				IJ.d2s(0.000000001*(System.nanoTime()-startTime),3)+" sec, --- Free memory="+
				Runtime.getRuntime().freeMemory()+" (of "+Runtime.getRuntime().totalMemory()+")");
		return true;
	}
	
	
	public boolean intersceneNoise(
			boolean use_aux,
			boolean batch_noise,
			boolean bayer_artifacts_debug) {
		long startTime=System.nanoTime();
		// load needed sensor and kernels files
		if (!prepareRigImages()) return false;
		String configPath=getSaveCongigPath();
		if (configPath.equals("ABORT")) return false;
		setAllProperties(PROPERTIES); // batchRig may save properties with the model. Extrinsics will be updated, others should be set here
		if (DEBUG_LEVEL > -2){
			System.out.println("++++++++++++++ Testing Interscene processing ++++++++++++++");
		}
		}
		*/
		if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
		if (CLT_PARAMETERS.useGPU()) { // only init GPU instances if it is used
			if (GPU_TILE_PROCESSOR == null) {
			if (GPU_TILE_PROCESSOR == null) {
				try {
				try {
+2 −2
Original line number Original line Diff line number Diff line
@@ -139,7 +139,7 @@ public class GPUTileProcessor {
	public static int TASK_TEXTURE_W_BIT =        3; // Texture with West  neighbor
	public static int TASK_TEXTURE_W_BIT =        3; // Texture with West  neighbor
//	public static int TASK_TEXTURE_BIT =          3;  // bit to request texture calculation int task field of struct tp_task
//	public static int TASK_TEXTURE_BIT =          3;  // bit to request texture calculation int task field of struct tp_task
	public static int LIST_TEXTURE_BIT =          7;  // bit to request texture calculation
	public static int LIST_TEXTURE_BIT =          7;  // bit to request texture calculation
	public static int CORR_OUT_RAD =              4;  // output radius of the correlations (implemented)
//	public static int CORR_OUT_RAD =              4;  // output radius of the correlations (implemented)
	public static double FAT_ZERO_WEIGHT =        0.0001; // add to port weights to avoid nan
	public static double FAT_ZERO_WEIGHT =        0.0001; // add to port weights to avoid nan


	public static int THREADS_DYNAMIC_BITS =      5; // treads in block for CDP creation of the texture list
	public static int THREADS_DYNAMIC_BITS =      5; // treads in block for CDP creation of the texture list
@@ -225,7 +225,7 @@ public class GPUTileProcessor {
        				"#define TASK_TEXTURE_S_BIT " +             TASK_TEXTURE_S_BIT+"\n"+
        				"#define TASK_TEXTURE_S_BIT " +             TASK_TEXTURE_S_BIT+"\n"+
        				"#define TASK_TEXTURE_W_BIT " +             TASK_TEXTURE_W_BIT+"\n"+
        				"#define TASK_TEXTURE_W_BIT " +             TASK_TEXTURE_W_BIT+"\n"+
        				"#define LIST_TEXTURE_BIT " +               LIST_TEXTURE_BIT+"\n"+
        				"#define LIST_TEXTURE_BIT " +               LIST_TEXTURE_BIT+"\n"+
        				"#define CORR_OUT_RAD " +                   CORR_OUT_RAD+"\n" +
//        				"#define CORR_OUT_RAD " +                   CORR_OUT_RAD+"\n" +
        				"#define FAT_ZERO_WEIGHT " +                FAT_ZERO_WEIGHT+"\n"+
        				"#define FAT_ZERO_WEIGHT " +                FAT_ZERO_WEIGHT+"\n"+
        				"#define THREADS_DYNAMIC_BITS " +           THREADS_DYNAMIC_BITS+"\n"+
        				"#define THREADS_DYNAMIC_BITS " +           THREADS_DYNAMIC_BITS+"\n"+
        				"#define RBYRDIST_LEN " +                   RBYRDIST_LEN+"\n"+
        				"#define RBYRDIST_LEN " +                   RBYRDIST_LEN+"\n"+
+336 −83

File changed.

Preview size limit exceeded, changes collapsed.

+32 −1
Original line number Original line Diff line number Diff line
@@ -102,6 +102,17 @@ public class Correlation2d {
				img_dtt.mcorr_limit_sensors); // 0 - no limit, 1 - (4,12) 2 - (2, 6, 10, 14), 3 - (0,2,4,6,8,10,12,14)
				img_dtt.mcorr_limit_sensors); // 0 - no limit, 1 - (4,12) 2 - (2, 6, 10, 14), 3 - (0,2,4,6,8,10,12,14)
	}
	}


	public static int corrSelEncodeAll(int limit_sensors) { // 0 - no limit, 1 - (4,12) 2 - (2, 6, 10, 14), 3 - (0,2,4,6,8,10,12,14)
		return corrSelEncode(
				true,  // boolean sel_all,
				false,  // boolean sel_dia,
				false,  // boolean sel_sq,
				false,  // boolean sel_neib,
				false,  // boolean sel_hor,
				false,  // boolean sel_vert);
				limit_sensors); // 0 - no limit, 1 - (4,12) 2 - (2, 6, 10, 14), 3 - (0,2,4,6,8,10,12,14)
	}
	
	  
	  
	// configuration for 8-lens and 4-lens cameras. 8-lens has baseline = 1 for 1..4 and 1/2 for 4..7
	// configuration for 8-lens and 4-lens cameras. 8-lens has baseline = 1 for 1..4 and 1/2 for 4..7
/*0        1
/*0        1
@@ -332,7 +343,26 @@ public class Correlation2d {
     return  numSensors * (numSensors-1) /2;
     return  numSensors * (numSensors-1) /2;
    }
    }
    
    
    public void setCorrPairs(int mcorr_sel) {
    public static boolean [] boolCorrPairs(int mcorr_sel, int numSensors) {
    	Correlation2d c2d = new Correlation2d(
    			numSensors, // other parameters do not matter
    			8, 
    			true,
    			false);
		return c2d.setCorrPairs(mcorr_sel);
    }
    
    public static int [] intCorrPairs(int mcorr_sel, int numSensors, int num_out) {
    	boolean [] boolCorrPairs = boolCorrPairs(mcorr_sel, numSensors);
    	int [] int_pairs = new int [num_out]; // normally 4
    	for (int i = 0; i < boolCorrPairs.length; i++) if (boolCorrPairs[i]){
    		int_pairs[i >> 5] |= 1 << (i & 31);
    	}
    	return int_pairs;
    	
    }
    
    public boolean[] setCorrPairs(int mcorr_sel) {
		boolean [] corr_calculate = null;
		boolean [] corr_calculate = null;
		if (isCorrAll  (mcorr_sel)) corr_calculate = selectAll();
		if (isCorrAll  (mcorr_sel)) corr_calculate = selectAll();
		if (isCorrDia  (mcorr_sel)) corr_calculate = selectDiameters  (corr_calculate);
		if (isCorrDia  (mcorr_sel)) corr_calculate = selectDiameters  (corr_calculate);
@@ -362,6 +392,7 @@ public class Correlation2d {
			//*********************************** limit pairs
			//*********************************** limit pairs
		}
		}
		setCorrPairs(corr_calculate);
		setCorrPairs(corr_calculate);
		return corr_calculate;
    }
    }
    
    
    
    
+693 −24

File changed.

Preview size limit exceeded, changes collapsed.

Loading