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

Matching image pairs

parent fec6933a
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -1347,6 +1347,37 @@ public class EyesisCorrectionParameters {
    		return true;
    	}

// get list of source files in a directory
    	public String[]  selectSourceFileInSet(String setdir, int debugLevel) {
    		int num_chn_main = numSubCameras;
    		int num_chn_aux =  ((aux_camera != null)? aux_camera.numSubCameras : 0);
    		int num_chn_files = num_chn_main + num_chn_aux;
    		String [] extensions = getSourceSuffixes();//    		={this.sourceSuffix};
    		String [] prefixes = getSourcePrefixes();
    		extensions[0] = sourceSuffix;
    		prefixes[0] =   sourcePrefix;
			MultipleExtensionsFileFilter setFilter = new MultipleExtensionsFileFilter(prefixes,extensions,"Image sets");
	    	File fsetdir = new File(setdir);
	    	ArrayList<File>  setFilesList = new ArrayList<File>(); // list of set files
	    	File [] setChnFiles = fsetdir.listFiles(setFilter);
	    	int num_match = setChnFiles.length;
	    	if (    (num_match == num_chn_files) || // all files for main and aux
	    			(num_match == num_chn_main) || // only main camera files
	    			(num_match == num_chn_aux))   // only aux camera files
	    	{ // only use sets of exact number of files
	    		for (File f: setChnFiles) {
	    			setFilesList.add(f);
	    		}
	    	}

	    	String [] sourcePaths = new String[setFilesList.size()];
	    	for (int nFile = 0; nFile < sourcePaths.length; nFile++) {
	    		sourcePaths[nFile]= setFilesList.get(nFile).getPath();
	    	}
    		return sourcePaths;
    	}
    	
    	
    	

    	public boolean selectSourceFiles(boolean allFiles) {
+5 −0
Original line number Diff line number Diff line
@@ -294,6 +294,11 @@ public class EyesisCorrections {
	// FIXME: Use only this PixelMappings's channels, do not mix exposures from main/aux!
	public double [] calcReferenceExposures(int debugLevel){
		String [] paths=this.correctionsParameters.getSourcePaths();
		return calcReferenceExposures(paths, debugLevel);
	}

	public double [] calcReferenceExposures(String [] paths,int debugLevel){
//		String [] paths=this.correctionsParameters.getSourcePaths();
		double [] exposures=new double [paths.length];
		if (this.correctionsParameters.exposureCorrectionMode<2){
			for (int nFile=0;nFile<paths.length;nFile++) {
+101 −1
Original line number Diff line number Diff line
@@ -699,6 +699,7 @@ private Panel panel1,
			addButton("LIST extrinsics",            panelClt5, color_report);
			addButton("DSI histogram",              panelClt5, color_report);
			addButton("ML recalc",                  panelClt5, color_process);
			addButton("Inter Test",                  panelClt5, color_stop);
			plugInFrame.add(panelClt5);
		}

@@ -5099,6 +5100,13 @@ private Panel panel1,
        CLT_PARAMETERS.batch_run = true;
    	batchLwir();
    	return;
/* ======================================================================== */
    } else if (label.equals("Inter Test")) {
        DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
    	EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
        CLT_PARAMETERS.batch_run = true;
        testInterScene();
    	return;
    	
/* ======================================================================== */
    } else if (label.equals("CLT rig edit")) {
@@ -5700,6 +5708,9 @@ private Panel panel1,
        return true;
	}

	
	
	
	public boolean getPairImages2() {
		if (!prepareRigImages()) return false;
		String configPath=getSaveCongigPath();
@@ -6378,6 +6389,95 @@ private Panel panel1,
	}


	public boolean testInterScene() {
		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 (GPU_TILE_PROCESSOR == null) {
				try {
					GPU_TILE_PROCESSOR = new GPUTileProcessor(CORRECTION_PARAMETERS.tile_processor_gpu);
				} catch (Exception e) {
					System.out.println("Failed to initialize GPU class");
					// TODO Auto-generated catch block
					e.printStackTrace();
					return false;
				} //final int        debugLevel);
			}
			if (CLT_PARAMETERS.useGPU(false) && (QUAD_CLT != null) && (GPU_QUAD == null)) { // if GPU main is needed
				try {
					GPU_QUAD = GPU_TILE_PROCESSOR.new GpuQuad(
							QUAD_CLT,
							4,
							3);
				} 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.setGPU(GPU_QUAD);
			}
			/*
			if (CLT_PARAMETERS.useGPU(true) && (QUAD_CLT_AUX != null) && (GPU_QUAD_AUX == null)) { // if GPU AUX is needed
				try {
					GPU_QUAD_AUX = GPU_TILE_PROCESSOR. new GpuQuad(//
							QUAD_CLT_AUX,
							4,
							3);
				} 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);
			}*/
		}
		
		try {
			TWO_QUAD_CLT.TestInterScene(
					QUAD_CLT, // QuadCLT quadCLT_main,
//					QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
					CLT_PARAMETERS,  // EyesisCorrectionParameters.DCTParameters           dct_parameters,
					DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters     debayerParameters,
					COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
					COLOR_PROC_PARAMETERS_AUX, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters_aux,
					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 exportMLData() {
+11 −1
Original line number Diff line number Diff line
@@ -590,7 +590,7 @@ public class GPUTileProcessor {
    }

   public class GpuQuad{ // quad camera description
        public final QuadCLT quadCLT;
        public           QuadCLT quadCLT;
    	public final int img_width;
    	public final int img_height;
    	public final int kernels_hor;        // int                kernels_hor,
@@ -657,6 +657,16 @@ public class GPUTileProcessor {
        private boolean geometry_correction_set = false;
        private boolean geometry_correction_vector_set = false;
        public  int gpu_debug_level = 1;
        // should only be updated with the same cameras instance
        public void updateQuadCLT(final QuadCLT quadCLT) {
        	this.quadCLT =      quadCLT;
    		resetGeometryCorrection();
    		resetGeometryCorrectionVector();
    		bayer_set =        false;
        }
        public QuadCLT getQuadCLT( ) {
        	return this.quadCLT;
        }
    	public GpuQuad(
        	final QuadCLT quadCLT,    			
//   			final int img_width,
+9 −0
Original line number Diff line number Diff line
@@ -615,6 +615,15 @@ public class CLTPass3d{
			calc_disparity_combo = calc_disparity.clone(); // for now - just clone, can be modified separately and combined with hor/vert
		}
		
		// bypassing calculations
		public void setCalcDisparityStrength(
				double [] disparity,
				double [] strength) {
			this.calc_disparity = disparity;
			this.strength =       strength;
			calc_disparity_combo = calc_disparity.clone();
		}

		/**
		 * Replaces current combo disparity for tiles that are weak and do not have any neighbor within disparity range from this one
		 * @param selection optional boolean mask of tiles to use/update
Loading