Commit 1aa3cc9e authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Other earlier changes

parent 31d4cc0f
Loading
Loading
Loading
Loading
+0 −63
Original line number Diff line number Diff line
@@ -639,7 +639,6 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
			addButton("CLT process files", panelClt1, color_process);
			addButton("CLT process sets", panelClt1, color_process);
			addButton("CLT process quads", panelClt1, color_process);
			plugInFrame.add(panelClt1);
		}
@@ -4301,68 +4300,6 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
			}
			return;
		} else if (label.equals("CLT process quads")) {
			DEBUG_LEVEL = MASTER_DEBUG_LEVEL;
			EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
			if (QUAD_CLT == null) {
				QUAD_CLT = new QuadCLT(QuadCLT.PREFIX, PROPERTIES, EYESIS_CORRECTIONS, CORRECTION_PARAMETERS);
				if (DEBUG_LEVEL > 0) {
					System.out.println("Created new QuadCLT instance, will need to read CLT kernels");
				}
			}
			String configPath = getSaveCongigPath();
			if (configPath.equals("ABORT"))
				return;
			EYESIS_CORRECTIONS.initSensorFiles(DEBUG_LEVEL);
			int numChannels = EYESIS_CORRECTIONS.getNumChannels();
//        NONLIN_PARAMETERS.modifyNumChannels(numChannels);
			CHANNEL_GAINS_PARAMETERS.modifyNumChannels(numChannels);
			if (!QUAD_CLT.CLTKernelsAvailable()) {
				if (DEBUG_LEVEL > 0) {
					System.out.println("Reading CLT kernels");
				}
				QUAD_CLT.readCLTKernels(CLT_PARAMETERS, THREADS_MAX, UPDATE_STATUS, // update status info
						DEBUG_LEVEL);
				if (DEBUG_LEVEL > 1) {
					QUAD_CLT.showCLTKernels(THREADS_MAX, UPDATE_STATUS, // update status info
							DEBUG_LEVEL);
				}
			}
			if (!QUAD_CLT.geometryCorrectionAvailable()) {
				if (DEBUG_LEVEL > 0) {
					System.out.println("Calculating geometryCorrection");
				}
				if (!QUAD_CLT.initGeometryCorrection(DEBUG_LEVEL + 2)) {
					return;
				}
			}
///========================================
			QUAD_CLT.processCLTQuads( // uses quad
					CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
					DEBAYER_PARAMETERS, // EyesisCorrectionParameters.DebayerParameters debayerParameters,
					COLOR_PROC_PARAMETERS, // EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
					CHANNEL_GAINS_PARAMETERS, // CorrectionColorProc.ColorGainsParameters channelGainParameters,
					RGB_PARAMETERS, // EyesisCorrectionParameters.RGBParameters rgbParameters,
					EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters
												// equirectangularParameters,
					THREADS_MAX, // final int threadsMax, // maximal number of threads to launch
					UPDATE_STATUS, // final boolean updateStatus,
					DEBUG_LEVEL); // 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);
			}
			return;
		} else if (label.equals("CLT 4 images") || label.equals("CLT apply fine corr")
				|| label.equals("CLT infinity corr") || label.equals("CORR TEST") || label.equals("ERS main")) {
			boolean apply_corr = label.equals("CLT apply fine corr");
+115 −1399

File changed.

Preview size limit exceeded, changes collapsed.

+0 −203
Original line number Diff line number Diff line
@@ -16598,209 +16598,6 @@ public class ImageDttCPU {
		return;
	}	
	@Deprecated
	public double [][] correlateMultiTilted( // Not used
			final CLTParameters  clt_parameters,
			final GeometryCorrection  geometryCorrection,			
			final double [][][]       image_data,      // first index - number of image in a quad
			final int                 width,
			final TpTask []           tp_tasks,
			final ImageDttParameters  imgdtt_params,    // Now just extra correlation parameters, later will include, most others
			// dcorr_td should be either null, or double [tp_tasks.length][][];
			final double [][][][]     dcorr_td,        // [tile][pair][4][64] sparse by pair transform domain representation of corr pairs
			// no combo here - rotate, combine in pixel domain after interframe
			final double [][][][][][] clt_kernels,     // [sensor][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
			final int                 kernel_step,
			final int                 window_type,
			final double              corr_red,
			final double              corr_blue,
			final int                 mcorr_sel,    // Which pairs to correlate // +1 - all, +2 - dia, +4 - sq, +8 - neibs, +16 - hor + 32 - vert
//			ref_scene.getErsCorrection().getRXY(false), // final double [][]         rXY,             // from geometryCorrection
//			final double [][]         rXY,             // from geometryCorrection
			final int                 tilesX,          // tp_tasks may lack maximal tileX, tileY  
			final int                 tilesY,
//			final double []           dcorr_weight,    // [tile] weighted number of tiles averaged (divide squared fat zero by this)
			// next both can be nulls
			final double [][][][]     clt_corr_out,   // sparse (by the first index) [type][tilesY][tilesX][(2*transform_size-1)*(2*transform_size-1)] or null
			// combo will be added as extra pair if mcorr_comb_width > 0 and clt_corr_out has a slot for it
			// to be converted to float
			// just for debug (or null)
			final float  [][][]       fclt_corr, 			
			// When clt_mismatch is non-zero, no far objects extraction will be attempted
			//optional, may be null
			final double [][]         disparity_map,   // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
			final boolean             run_lma,         // calculate LMA, false - CM only
			final double              afat_zero2,      // gpu_fat_zero ==30? clt_parameters.getGpuFatZero(is_mono); absolute fat zero, same units as components squared values
			final double              corr_sigma,      //
			// define combining of all 2D correlation pairs for CM (LMA does not use them)
			final int                 mcorr_comb_width,  // combined correlation tile width (set <=0 to skip combined correlations)
			final int                 mcorr_comb_height, // combined correlation tile full height
			final int                 mcorr_comb_offset, // combined correlation tile height offset: 0 - centered (-height/2 to height/2), height/2 - only positive (0 to height)
			final double              mcorr_comb_disp,   // Combined tile per-pixel disparity for baseline == side of a square
			// related to tilt
			final int                 clustRadius,  // 1 - single tile, 2 - 3x3, 3 - 5x5, ...
			final double              arange,  // absolute disparity range to consolidate
			final double              rrange,  // relative disparity range to consolidate
			final double              no_tilt, // no tilt if center disparity is lower
			final double              damp_tilt,    // 0.1?
			//			final int                 window_type,     // GPU: will not be used
			final int                 debug_tileX,
			final int                 debug_tileY,
			final int                 threadsMax,      // maximal number of threads to launch
			final int                 debugLevel){
		final int num_pairs =   Correlation2d.getNumPairs(getNumSensors());
		double [][][]       dcorr_tiles = (fclt_corr != null)? (new double [tp_tasks.length][][]):null;
		if ((this instanceof ImageDtt) && (getGPU() != null)) { // GPU mode
			ImageDtt imageDtt = (ImageDtt) this;
			final double gpu_sigma_corr =     clt_parameters.getGpuCorrSigma(isMonochrome());
			final double gpu_sigma_rb_corr =  isMonochrome()? 1.0 : clt_parameters.gpu_sigma_rb_corr;
			final double gpu_sigma_log_corr = clt_parameters.getGpuCorrLoGSigma(isMonochrome());
			float  [][][][]     fcorr_td =       new float[tilesY][tilesX][][];
//			double [][][]       dcorr_tiles = (fclt_corr != null)? (new double [tp_tasks.length][][]):null;
			imageDtt.quadCorrTD( // maybe remove "imageDtt."
					clt_parameters.img_dtt,            // final ImageDttParameters imgdtt_params,    // Now just extra correlation parameters, later will include, most others
					tp_tasks, // *** will be updated inside from GPU-calculated geometry
					fcorr_td, // fcorrs_td[nscene],                 // [tilesY][tilesX][pair][4*64] transform domain representation of 6 corr pairs
//					geometryCorrection, //
					clt_parameters.gpu_sigma_r,        // 0.9, 1.1
					clt_parameters.gpu_sigma_b,        // 0.9, 1.1
					clt_parameters.gpu_sigma_g,        // 0.6, 0.7
					clt_parameters.gpu_sigma_m,        //  =       0.4; // 0.7;
					gpu_sigma_rb_corr,                 // final double              gpu_sigma_rb_corr, //  = 0.5; // apply LPF after accumulating R and B correlation before G, monochrome ? 1.0 : gpu_sigma_rb_corr;
					gpu_sigma_corr,                    //  =    0.9;gpu_sigma_corr_m
					gpu_sigma_log_corr,                // final double              gpu_sigma_log_corr,   // hpf to reduce dynamic range for correlations
					clt_parameters.corr_red,           // +used
					clt_parameters.corr_blue,          // +used
					mcorr_sel,                         // final int                 mcorr_sel,    // Which pairs to correlate // +1 - all, +2 - dia, +4 - sq, +8 - neibs, +16 - hor + 32 - vert
					threadsMax,       // maximal number of threads to launch
					debugLevel);
			if (getGPU().getGpu_debug_level() > -1) {
				System.out.println("==ooo=after image_dtt.correlateMultiTilted(): 1");
			}
			float  [][][]     num_acc = null; // new float [tilesY][tilesX][num_pairs];
			if (clustRadius >= 1) { 
				
			/*
			accumulateCorrelations(
					num_acc,       // final int [][][]     num_acc,          // number of accumulated tiles [tilesY][tilesX][pair]
					fcorr_td,      // final float [][][][] fcorr_td,         // [tilesY][tilesX][pair][256] sparse transform domain representation of corr pairs 
					fcorr_td_acc); // final float [][][][] fcorr_td_acc      // [tilesY][tilesX][pair][256] sparse transform domain representation of corr pairs
			if (getGPU().gpu_debug_level > -1) {
				System.out.println("==ooo=after image_dtt.correlateMultiTilted(): 1");
			}
			*/
			}
			// fcorr_td now has either single center corr TD, or accumulated
			
			imageDtt.clt_process_tl_correlations( // convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
					clt_parameters.img_dtt,		   // final ImageDttParameters  imgdtt_params,   // Now just extra correlation parameters, later will include, most others
					fcorr_td,		 	           // final float  [][][][]     fcorr_td,        // [tilesY][tilesX][pair][4*64] transform domain representation of all selected corr pairs
					num_acc,                       // int [][][]                num_acc,         // number of accumulated tiles [tilesY][tilesX][pair] (or null)
					null, // dcorr_weight,                  // double []                 dcorr_weight,    // alternative to num_acc, compatible with CPU processing (only one non-zero enough)
					clt_parameters.gpu_corr_scale, //  final double              gpu_corr_scale,  //  0.75; // reduce GPU-generated correlation values
					clt_parameters.getGpuFatZero(isMonochrome()),   // final double     gpu_fat_zero,    // clt_parameters.getGpuFatZero(is_mono);absolute == 30.0
					transform_size - 1,  // final int                 gpu_corr_rad,    // = transform_size - 1 ?
			        // The tp_tasks data should be decoded from GPU to get coordinates
					tp_tasks,                  // final TpTask []           tp_tasks,        // data from the reference frame - will be applied to LMW for the integrated correlations
					geometryCorrection.getRXY(false), // final double [][]      rXY,             // from geometryCorrection
					// next both can be nulls
					null,                          // final double [][][][]     clt_corr_out,   // sparse (by the first index) [type][tilesY][tilesX][(2*transform_size-1)*(2*transform_size-1)] or null
				    // combo will be added as extra pair if mcorr_comb_width > 0 and clt_corr_out has a slot for it
					// to be converted to float
					dcorr_tiles,                   // final double  [][][]      dcorr_tiles,     // [tile][pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
					// When clt_mismatch is non-zero, no far objects extraction will be attempted
					//optional, may be null
					disparity_map,                 // final double [][]         disparity_map,   // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
					null,                          // final double [][]         ddnd,            // data for LY. SHould be either null or [num_sensors][]
					clt_parameters.correlate_lma,  // final boolean             run_lma,         // calculate LMA, false - CM only
		  		    // define combining of all 2D correlation pairs for CM (LMA does not use them)
					clt_parameters.img_dtt.mcorr_comb_width, //final int                 mcorr_comb_width,  // combined correlation tile width (set <=0 to skip combined correlations)
					clt_parameters.img_dtt.mcorr_comb_height,//final int                 mcorr_comb_height, // combined correlation tile full height
					clt_parameters.img_dtt.mcorr_comb_offset,//final int                 mcorr_comb_offset, // combined correlation tile height offset: 0 - centered (-height/2 to height/2), height/2 - only positive (0 to height)
					clt_parameters.img_dtt.mcorr_comb_disp,	 //final double              mcorr_comb_disp,   // Combined tile per-pixel disparity for baseline == side of a square
					clt_parameters.clt_window,     // final int                 window_type,     // GPU: will not be used
					clt_parameters.tileX,          // final int                 debug_tileX,
					clt_parameters.tileY,          // final int                 debug_tileY,
					threadsMax,                    // final int                 threadsMax,      // maximal number of threads to launch
					null,                          // final String              debug_suffix,
					debugLevel + 2); // -1 );              // final int                 globalDebugLevel)
			
		} else { // if ((this instanceof ImageDtt) && (getGPU() != null)) - CPU mode
			quadCorrTD(
					image_data,                                         // final double [][][]       image_data,      // first index - number of image in a quad
					width,                                              // final int                 width,
					tp_tasks,                                           // final TpTask []           tp_tasks,
					clt_parameters.img_dtt,                             // final ImageDttParameters  imgdtt_params,    // Now just extra correlation parameters, later will include, most others
					dcorr_td,                                           // final double [][][][][]   dcorr_td,        // [pair][tilesY][tilesX][4][64] sparse transform domain representation of corr pairs
					// no combo here - rotate, combine in pixel domain after interframe
					clt_kernels,                                        // final double [][][][][][] clt_kernels,     // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
//					clt_parameters.kernel_step,                         // final int                 kernel_step,
					clt_parameters.clt_window,                          // final int                 window_type,
					clt_parameters.corr_red,                            // final double              corr_red,
					clt_parameters.corr_blue,                           // final double              corr_blue,
					mcorr_sel,                                          // final int                 mcorr_sel,    // Which pairs to correlate // +1 - all, +2 - dia, +4 - sq, +8 - neibs, +16 - hor + 32 - vert
					clt_parameters.tileX,                               // final int                 debug_tileX,
					clt_parameters.tileY,                               // final int                 debug_tileY,
					threadsMax,                                         // final int                 threadsMax,       // maximal number of threads to launch
					debugLevel);                                        // final int                 globalDebugLevel)
			float  [][][]     num_acc = null; // new float [tilesY][tilesX][num_pairs];
			double []         dcorr_weight = null;
			if (clustRadius >= 1) { // skip additional processing 
			
			
			}
			clt_process_tl_correlations( // convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
					clt_parameters.img_dtt,		      // final ImageDttParameters  imgdtt_params,   // Now just extra correlation parameters, later will include, most others
					tp_tasks,                         // final TpTask []           tp_tasks,        // data from the reference frame - will be applied to LMW for the integrated correlations
					// only listed tiles will be processed
					geometryCorrection.getRXY(false), // final double [][]         rXY,             // from geometryCorrection
					tilesX,                        // final int                 tilesX,          // tp_tasks may lack maximal tileX, tileY  
					tilesY,                        // final int                 tilesY,
					// no fcorr_combo_td here both arrays should have same non-null tiles
					dcorr_td,                      // final double [][][][]     dcorr_td,        // [tile][pair][4][64] sparse by pair transform domain representation of corr pairs
					dcorr_weight,                  // final double []           dcorr_weight,    // [tile] weighted number of tiles averaged (divide squared fat zero by this)
					// next both can be nulls
					null,                          // final double [][][][]     clt_corr_out,   // sparse (by the first index) [type][tilesY][tilesX][(2*transform_size-1)*(2*transform_size-1)] or null
					// to be converted to float
					dcorr_tiles,                   // final double  [][][]      dcorr_tiles,     // [tile][pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
					// When clt_mismatch is non-zero, no far objects extraction will be attempted
					//optional, may be null
					disparity_map,                 // final double [][]         disparity_map,   // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
					// not yet implemented - see ImageDtt.java (GPU version)
					null,                          // final double [][]         ddnd,            // data for LY. SHould be either null or [num_sensors][]
					clt_parameters.correlate_lma,  // final boolean             run_lma,         // calculate LMA, false - CM only
					// last 2 - contrast, avg/ "geometric average)
					clt_parameters.getGpuFatZero(isMonochrome()),   // clt_parameters.getGpuFatZero(ref_scene.isMonochrome()), // final double              afat_zero2,      // gpu_fat_zero ==30? clt_parameters.getGpuFatZero(is_mono); absolute fat zero, same units as components squared values
					clt_parameters.gpu_sigma_m,    // final double              corr_sigma,      //
					// define combining of all 2D correlation pairs for CM (LMA does not use them)
					clt_parameters.img_dtt.mcorr_comb_width, // final int                 mcorr_comb_width,  // combined correlation tile width
					clt_parameters.img_dtt.mcorr_comb_height,// final int                 mcorr_comb_height, // combined correlation tile full height
					clt_parameters.img_dtt.mcorr_comb_offset,// final int                 mcorr_comb_offset, // combined correlation tile height offset: 0 - centered (-height/2 to height/2), height/2 - only positive (0 to height)
					clt_parameters.img_dtt.mcorr_comb_disp,	 // final double              mcorr_comb_disp,   // Combined tile per-pixel disparity for baseline == side of a square
					clt_parameters.clt_window,     // final int                 window_type,     // GPU: will not be used
					clt_parameters.tileX,          // final int                 debug_tileX,
					clt_parameters.tileY,          // final int                 debug_tileY,
					threadsMax,                    // final int                 threadsMax,      // maximal number of threads to launch
					null,                          // final String              debug_suffix,
					debugLevel + 2); // -1 );              // final int                 globalDebugLevel)
			
		}
		convertFcltCorr( // for debug only
				dcorr_tiles, // double [][][] dcorr_tiles,// [tile][sparse, correlation pair][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
				fclt_corr);  // float  [][][] fclt_corr) //  new float [tilesX * tilesY][][] or null
		return null;
	}
	
	
	
	
	public double [][][][] clt_process_texture_tiles( // final double [][][][]     texture_tiles
			final ImageDttParameters  imgdtt_params,   // Now just extra correlation parameters, later will include, most others
			final TpTask []           tp_tasks,        // data from the reference frame - will be applied to LMW for the integrated correlations
+199 −2090

File changed.

Preview size limit exceeded, changes collapsed.

+311 −3167

File changed.

Preview size limit exceeded, changes collapsed.

Loading