Loading src/main/java/com/elphel/imagej/cameras/CLTParameters.java +53 −7 Original line number Diff line number Diff line Loading @@ -37,11 +37,13 @@ import java.util.Set; import com.elphel.imagej.common.GenericJTabbedDialog; import com.elphel.imagej.common.WindowTools; import com.elphel.imagej.correction.CorrectionColorProc; import com.elphel.imagej.lwir.LwirReaderParameters; import com.elphel.imagej.tileprocessor.BiQuadParameters; import com.elphel.imagej.tileprocessor.ImageDtt; import com.elphel.imagej.tileprocessor.ImageDttParameters; import com.elphel.imagej.tileprocessor.IntersceneLmaParameters; import com.elphel.imagej.tileprocessor.IntersceneMatchParameters; import com.elphel.imagej.tileprocessor.MeasuredLayersFilterParameters; import com.elphel.imagej.tileprocessor.OpticalFlowParameters; import com.elphel.imagej.tileprocessor.PoleProcessorParameters; Loading Loading @@ -884,8 +886,10 @@ public class CLTParameters { public double gpu_sigma_corr_m = 0.15; public double gpu_sigma_log_corr = 3.0; // fill in after testing public double gpu_sigma_log_corr_m = 3.0; // fill in after testing public double gpu_fatz = 500.0; // was 30 public double gpu_fatz_m = 500.0; // was 30 public double gpu_fatz = 2000.0; // 500.0; // was 30 public double gpu_fatz_m = 2000.0; // 500.0; // was 30 public double gpu_fatz_inter = 10000.0; // There is some artifact (bug or float precision) public double gpu_fatz_inter_m = 10000.0; // public boolean gpu_woi = false; // if true - use gpu_woi_tx, ... public int gpu_woi_tx = 0; Loading Loading @@ -946,6 +950,7 @@ public class CLTParameters { public MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters(); public LwirReaderParameters lwir = new LwirReaderParameters(); public OpticalFlowParameters ofp = new OpticalFlowParameters(); public IntersceneMatchParameters imp = new IntersceneMatchParameters(); public IntersceneLmaParameters ilp = new IntersceneLmaParameters(); public InterNoiseParameters inp = new InterNoiseParameters(); Loading @@ -953,9 +958,30 @@ public class CLTParameters { public HashMap<String,Double> infinity_distace_map = new HashMap<String,Double>(); //new one public static String Z_CORR_PREFIX = "z_corr."; public static String INFINITY_DISTANCE_PREFIX = "infinity_distance."; public boolean batch_run = false; // turned on only while running in batch mode // Quick fix to pass these parameters public ColorProcParameters colorProcParameters; public ColorProcParameters colorProcParametersAux; public EyesisCorrectionParameters.RGBParameters rgbParameters; public void setColorProcParameters(ColorProcParameters colorProcParameters, boolean aux) { if (aux) { this.colorProcParametersAux = colorProcParameters; }else { this.colorProcParameters = colorProcParameters; } } public void setRGBParameters (EyesisCorrectionParameters.RGBParameters rgbParameters) { this.rgbParameters =rgbParameters; } public EyesisCorrectionParameters.RGBParameters getRGBParameters(){ return rgbParameters; } public ColorProcParameters getColorProcParameters(boolean aux) { return aux? colorProcParametersAux:colorProcParameters; } public boolean useGPU() { return useGPU(false) || useGPU(true); Loading @@ -981,6 +1007,10 @@ public class CLTParameters { return monochrome ? gpu_fatz_m : gpu_fatz; } public double getGpuFatZeroInter(boolean monochrome) { return monochrome ? gpu_fatz_inter_m : gpu_fatz_inter; } public double getGpuCorrSigma(boolean monochrome) { return monochrome ? gpu_sigma_corr_m : gpu_sigma_corr; } Loading Loading @@ -1765,6 +1795,8 @@ public class CLTParameters { properties.setProperty(prefix+"gpu_sigma_log_corr_m", this.gpu_sigma_log_corr_m +""); properties.setProperty(prefix+"gpu_fatz", this.gpu_fatz +""); properties.setProperty(prefix+"gpu_fatz_m", this.gpu_fatz_m +""); properties.setProperty(prefix+"gpu_fatz_inter", this.gpu_fatz_inter +""); properties.setProperty(prefix+"gpu_fatz_inter_m", this.gpu_fatz_inter_m +""); properties.setProperty(prefix+"gpu_woi", this.gpu_woi +""); properties.setProperty(prefix+"gpu_woi_tx", this.gpu_woi_tx +""); Loading Loading @@ -1836,6 +1868,7 @@ public class CLTParameters { poles.setProperties (prefix+"_poles", properties); lwir.setProperties (prefix+"_lwir", properties); ofp.setProperties (prefix+"_ofp_", properties); imp.setProperties (prefix+"_imp_", properties); ilp.setProperties (prefix+"_ilp_", properties); inp.setProperties (prefix+"_inp_", properties); Loading Loading @@ -2617,6 +2650,8 @@ public class CLTParameters { if (properties.getProperty(prefix+"gpu_sigma_log_corr_m")!=null) this.gpu_sigma_log_corr_m=Double.parseDouble(properties.getProperty(prefix+"gpu_sigma_log_corr_m")); if (properties.getProperty(prefix+"gpu_fatz")!=null) this.gpu_fatz=Double.parseDouble(properties.getProperty(prefix+"gpu_fatz")); if (properties.getProperty(prefix+"gpu_fatz_m")!=null) this.gpu_fatz_m=Double.parseDouble(properties.getProperty(prefix+"gpu_fatz_m")); if (properties.getProperty(prefix+"gpu_fatz_inter")!=null) this.gpu_fatz_inter=Double.parseDouble(properties.getProperty(prefix+"gpu_fatz_inter")); if (properties.getProperty(prefix+"gpu_fatz_inter_m")!=null) this.gpu_fatz_inter_m=Double.parseDouble(properties.getProperty(prefix+"gpu_fatz_inter_m")); if (properties.getProperty(prefix+"gpu_woi")!=null) this.gpu_woi=Boolean.parseBoolean(properties.getProperty(prefix+"gpu_woi")); if (properties.getProperty(prefix+"gpu_woi_tx")!=null) this.gpu_woi_tx=Integer.parseInt(properties.getProperty(prefix+"gpu_woi_tx")); Loading Loading @@ -2692,6 +2727,7 @@ public class CLTParameters { poles.getProperties (prefix+"_poles", properties); lwir.getProperties (prefix+"_lwir", properties); ofp.getProperties (prefix+"_ofp_", properties); imp.getProperties (prefix+"_imp_", properties); ilp.getProperties (prefix+"_ilp_", properties); inp.getProperties (prefix+"_inp_", properties); } Loading Loading @@ -3695,10 +3731,14 @@ public class CLTParameters { gd.addNumericField("LoG sigma for correlation, mono", this.gpu_sigma_log_corr_m, 4, 6,"pix", "Use LoG filter to reduce dynamic range of the correlation input to fit into float range"); gd.addNumericField("Fat zero (absolute) for phase correlation of color images", this.gpu_fatz, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes, color images"); gd.addNumericField("Fat zero (absolute) for phase correlation of monochrome images", this.gpu_fatz_m, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes, monochrome images"); gd.addNumericField("Fat zero (absolute) for intrascene phase correlation of color images", this.gpu_fatz, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes in intrascene mode, color images"); gd.addNumericField("Fat zero (absolute) for intrascene phase correlation of monochrome images", this.gpu_fatz_m, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes in intrascene mode, monochrome images"); gd.addNumericField("Fat zero (absolute) for interscene phase correlation of color images", this.gpu_fatz_inter, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes in interscene mode, color images"); gd.addNumericField("Fat zero (absolute) for interscene phase correlation of monochrome images", this.gpu_fatz_inter_m, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes in interscene mode, monochrome images"); gd.addMessage ("--- GPU WOI selection ---"); gd.addCheckbox ("Use following WOI for GPU processing (unchecked - ignore WOI dimensions)", this.gpu_woi); Loading Loading @@ -3734,6 +3774,9 @@ public class CLTParameters { gd.addTab ("O-Flow", "parameters for the interscene Optical FLow calculations"); this.ofp.dialogQuestions(gd); gd.addTab ("Inter-Match", "Parameters for full-resolution (no decimation/macrotiles) scene matching"); this.imp.dialogQuestions(gd); gd.addTab ("Inter-LMA", "parameters for the interscene LMA fitting"); this.ilp.dialogQuestions(gd); Loading Loading @@ -4541,6 +4584,8 @@ public class CLTParameters { this.gpu_sigma_log_corr_m = gd.getNextNumber(); this.gpu_fatz = gd.getNextNumber(); this.gpu_fatz_m = gd.getNextNumber(); this.gpu_fatz_inter = gd.getNextNumber(); this.gpu_fatz_inter_m = gd.getNextNumber(); this.gpu_woi= gd.getNextBoolean(); this.gpu_woi_tx = (int) gd.getNextNumber(); Loading @@ -4564,6 +4609,7 @@ public class CLTParameters { this.lwir.dialogAnswers(gd); this.ofp.dialogAnswers(gd); this.imp.dialogAnswers(gd); this.ilp.dialogAnswers(gd); this.inp.dialogAnswers(gd); Loading src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java +3 −0 Original line number Diff line number Diff line Loading @@ -6621,6 +6621,9 @@ public class Eyesis_Correction implements PlugIn, ActionListener { QUAD_CLT_AUX.setGPU(GPU_QUAD_AUX); } } CLT_PARAMETERS.setColorProcParameters(COLOR_PROC_PARAMETERS, false); CLT_PARAMETERS.setColorProcParameters(COLOR_PROC_PARAMETERS_AUX, true); CLT_PARAMETERS.setRGBParameters(RGB_PARAMETERS); try { TWO_QUAD_CLT.batchLwirRig(QUAD_CLT, // QuadCLT quadCLT_main, Loading src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java +19 −14 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ public class GPUTileProcessor { static String GPU_CONVERT_DIRECT_NAME = "convert_direct"; // name in C code static String GPU_IMCLT_ALL_NAME = "imclt_rbg_all"; static String GPU_CORRELATE2D_NAME = "correlate2D"; // name in C code static String GPU_CORRELATE2D_INTER_NAME = "correlate2D_inter"; // name in C code static String GPU_CORR2D_COMBINE_NAME = "corr2D_combine"; // name in C code static String GPU_CORR2D_NORMALIZE_NAME = "corr2D_normalize"; // name in C code static String GPU_TEXTURES_NAME = "textures_nonoverlap"; // name in C code Loading Loading @@ -163,6 +164,7 @@ public class GPUTileProcessor { CUfunction GPU_CONVERT_DIRECT_kernel = null; // "convert_direct" CUfunction GPU_IMCLT_ALL_kernel = null; // "imclt_rbg_all" CUfunction GPU_CORRELATE2D_kernel = null; // "correlate2D" CUfunction GPU_CORRELATE2D_INTER_kernel = null; // "correlate2D_inter" CUfunction GPU_CORR2D_COMBINE_kernel = null; // "corr2D_combine" CUfunction GPU_CORR2D_NORMALIZE_kernel = null; // "corr2D_normalize"; CUfunction GPU_TEXTURES_kernel = null; // "textures_nonoverlap" Loading Loading @@ -314,6 +316,7 @@ public class GPUTileProcessor { GPU_CONVERT_DIRECT_NAME, GPU_IMCLT_ALL_NAME, GPU_CORRELATE2D_NAME, GPU_CORRELATE2D_INTER_NAME, GPU_CORR2D_COMBINE_NAME, GPU_CORR2D_NORMALIZE_NAME, GPU_TEXTURES_NAME, Loading @@ -337,27 +340,29 @@ public class GPUTileProcessor { GPU_CONVERT_DIRECT_kernel = functions[0]; GPU_IMCLT_ALL_kernel = functions[1]; GPU_CORRELATE2D_kernel = functions[2]; GPU_CORR2D_COMBINE_kernel = functions[3]; GPU_CORR2D_NORMALIZE_kernel = functions[4]; GPU_TEXTURES_kernel= functions[5]; GPU_RBGA_kernel= functions[6]; GPU_ROT_DERIV_kernel = functions[7]; GPU_CALCULATE_TILES_OFFSETS_kernel = functions[8]; GPU_CALC_REVERSE_DISTORTION_kernel = functions[9]; GPU_CORRELATE2D_INTER_kernel = functions[3]; GPU_CORR2D_COMBINE_kernel = functions[4]; GPU_CORR2D_NORMALIZE_kernel = functions[5]; GPU_TEXTURES_kernel= functions[6]; GPU_RBGA_kernel= functions[7]; GPU_ROT_DERIV_kernel = functions[8]; GPU_CALCULATE_TILES_OFFSETS_kernel = functions[9]; GPU_CALC_REVERSE_DISTORTION_kernel = functions[10]; // Kernels to use w/o Dynamic Parallelism GPU_CLEAR_TEXTURE_LIST_kernel = functions[10]; GPU_MARK_TEXTURE_LIST_kernel = functions[11]; GPU_MARK_TEXTURE_NEIGHBOR_kernel = functions[12]; GPU_GEN_TEXTURE_LIST_kernel = functions[13]; GPU_CLEAR_TEXTURE_RBGA_kernel = functions[14]; GPU_TEXTURES_ACCUMULATE_kernel = functions[15]; GPU_CREATE_NONOVERLAP_LIST_kernel = functions[16]; GPU_CLEAR_TEXTURE_LIST_kernel = functions[11]; GPU_MARK_TEXTURE_LIST_kernel = functions[12]; GPU_MARK_TEXTURE_NEIGHBOR_kernel = functions[13]; GPU_GEN_TEXTURE_LIST_kernel = functions[14]; GPU_CLEAR_TEXTURE_RBGA_kernel = functions[15]; GPU_TEXTURES_ACCUMULATE_kernel = functions[16]; GPU_CREATE_NONOVERLAP_LIST_kernel = functions[17]; System.out.println("GPU kernel functions initialized"); System.out.println(GPU_CONVERT_DIRECT_kernel.toString()); System.out.println(GPU_IMCLT_ALL_kernel.toString()); System.out.println(GPU_CORRELATE2D_kernel.toString()); System.out.println(GPU_CORRELATE2D_INTER_kernel.toString()); System.out.println(GPU_CORR2D_COMBINE_kernel.toString()); System.out.println(GPU_CORR2D_NORMALIZE_kernel.toString()); System.out.println(GPU_TEXTURES_kernel.toString()); Loading src/main/java/com/elphel/imagej/gpu/GpuQuad.java +187 −31 File changed.Preview size limit exceeded, changes collapsed. Show changes src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java +67 −1 Original line number Diff line number Diff line Loading @@ -2384,7 +2384,7 @@ public class Correlation2d { * @return argmax() relative to the tile center */ public double [] getMaxXYCm( // not used in lwir public static double [] getMaxXYCm( // not used in lwir double [] data, int data_width, // = 2 * transform_size - 1; int center_row, Loading @@ -2411,6 +2411,72 @@ public class Correlation2d { return rslt; } public static double [] getMaxXYCm( double [] data, int data_width, // = 2 * transform_size - 1; double radius, // 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad) int refine, // re-center window around new maximum. 0 -no refines (single-pass) boolean debug) { int data_height = data.length/data_width; int center_xy = (data_width - 1)/2; // = transform_size - 1; double x0 = center_xy, y0 = center_xy; int imax= 0; for (int i= 1; i < data.length;i++) { if (data[i] > data[imax]) { imax = i; } } double mx = data[imax]; x0 = imax % data_width; y0 = imax / data_width; //calculate as "center of mass" if (radius == 0) { double s0 = 0, sx=0,sy = 0; for (int iy = 0; iy < data_height; iy++) { double y = iy - y0; for (int ix = 0; ix < data_width; ix++) { double x = ix - x0; double d = data[iy * data_width + ix]; s0 += d; sx += d * x; sy += d * y; } } x0 += sx / s0; y0 += sy / s0; } else { double radius2 = radius*radius; for (int nref = 0; nref <= refine; nref++) { double s0 = 0, sx=0,sy = 0; for (int iy = 0; iy < data_height; iy++) { double y = iy - y0; for (int ix = 0; ix < data_width; ix++) { double x = ix - x0; double r2= x*x + y*y; if (r2 < radius2) { double r = Math.sqrt(r2); double d = data[iy * data_width + ix]; d *= Math.cos(0.5*Math.PI*r/radius); s0 += d; sx += d * x; sy += d * y; } } } x0 += sx / s0; y0 += sy / s0; } } double [] rslt = {x0 - center_xy, y0 - center_xy, mx}; if (debug){ System.out.println("getMaxXYCm() -> "+rslt[0]+":"+rslt[1]); } return rslt; } /** * Analyze 1d correlation (single centerline of the 3D phase correlation combined output * from all pairs or only diameters to detect double maximum (simultaneous FG+BG) Loading Loading
src/main/java/com/elphel/imagej/cameras/CLTParameters.java +53 −7 Original line number Diff line number Diff line Loading @@ -37,11 +37,13 @@ import java.util.Set; import com.elphel.imagej.common.GenericJTabbedDialog; import com.elphel.imagej.common.WindowTools; import com.elphel.imagej.correction.CorrectionColorProc; import com.elphel.imagej.lwir.LwirReaderParameters; import com.elphel.imagej.tileprocessor.BiQuadParameters; import com.elphel.imagej.tileprocessor.ImageDtt; import com.elphel.imagej.tileprocessor.ImageDttParameters; import com.elphel.imagej.tileprocessor.IntersceneLmaParameters; import com.elphel.imagej.tileprocessor.IntersceneMatchParameters; import com.elphel.imagej.tileprocessor.MeasuredLayersFilterParameters; import com.elphel.imagej.tileprocessor.OpticalFlowParameters; import com.elphel.imagej.tileprocessor.PoleProcessorParameters; Loading Loading @@ -884,8 +886,10 @@ public class CLTParameters { public double gpu_sigma_corr_m = 0.15; public double gpu_sigma_log_corr = 3.0; // fill in after testing public double gpu_sigma_log_corr_m = 3.0; // fill in after testing public double gpu_fatz = 500.0; // was 30 public double gpu_fatz_m = 500.0; // was 30 public double gpu_fatz = 2000.0; // 500.0; // was 30 public double gpu_fatz_m = 2000.0; // 500.0; // was 30 public double gpu_fatz_inter = 10000.0; // There is some artifact (bug or float precision) public double gpu_fatz_inter_m = 10000.0; // public boolean gpu_woi = false; // if true - use gpu_woi_tx, ... public int gpu_woi_tx = 0; Loading Loading @@ -946,6 +950,7 @@ public class CLTParameters { public MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters(); public LwirReaderParameters lwir = new LwirReaderParameters(); public OpticalFlowParameters ofp = new OpticalFlowParameters(); public IntersceneMatchParameters imp = new IntersceneMatchParameters(); public IntersceneLmaParameters ilp = new IntersceneLmaParameters(); public InterNoiseParameters inp = new InterNoiseParameters(); Loading @@ -953,9 +958,30 @@ public class CLTParameters { public HashMap<String,Double> infinity_distace_map = new HashMap<String,Double>(); //new one public static String Z_CORR_PREFIX = "z_corr."; public static String INFINITY_DISTANCE_PREFIX = "infinity_distance."; public boolean batch_run = false; // turned on only while running in batch mode // Quick fix to pass these parameters public ColorProcParameters colorProcParameters; public ColorProcParameters colorProcParametersAux; public EyesisCorrectionParameters.RGBParameters rgbParameters; public void setColorProcParameters(ColorProcParameters colorProcParameters, boolean aux) { if (aux) { this.colorProcParametersAux = colorProcParameters; }else { this.colorProcParameters = colorProcParameters; } } public void setRGBParameters (EyesisCorrectionParameters.RGBParameters rgbParameters) { this.rgbParameters =rgbParameters; } public EyesisCorrectionParameters.RGBParameters getRGBParameters(){ return rgbParameters; } public ColorProcParameters getColorProcParameters(boolean aux) { return aux? colorProcParametersAux:colorProcParameters; } public boolean useGPU() { return useGPU(false) || useGPU(true); Loading @@ -981,6 +1007,10 @@ public class CLTParameters { return monochrome ? gpu_fatz_m : gpu_fatz; } public double getGpuFatZeroInter(boolean monochrome) { return monochrome ? gpu_fatz_inter_m : gpu_fatz_inter; } public double getGpuCorrSigma(boolean monochrome) { return monochrome ? gpu_sigma_corr_m : gpu_sigma_corr; } Loading Loading @@ -1765,6 +1795,8 @@ public class CLTParameters { properties.setProperty(prefix+"gpu_sigma_log_corr_m", this.gpu_sigma_log_corr_m +""); properties.setProperty(prefix+"gpu_fatz", this.gpu_fatz +""); properties.setProperty(prefix+"gpu_fatz_m", this.gpu_fatz_m +""); properties.setProperty(prefix+"gpu_fatz_inter", this.gpu_fatz_inter +""); properties.setProperty(prefix+"gpu_fatz_inter_m", this.gpu_fatz_inter_m +""); properties.setProperty(prefix+"gpu_woi", this.gpu_woi +""); properties.setProperty(prefix+"gpu_woi_tx", this.gpu_woi_tx +""); Loading Loading @@ -1836,6 +1868,7 @@ public class CLTParameters { poles.setProperties (prefix+"_poles", properties); lwir.setProperties (prefix+"_lwir", properties); ofp.setProperties (prefix+"_ofp_", properties); imp.setProperties (prefix+"_imp_", properties); ilp.setProperties (prefix+"_ilp_", properties); inp.setProperties (prefix+"_inp_", properties); Loading Loading @@ -2617,6 +2650,8 @@ public class CLTParameters { if (properties.getProperty(prefix+"gpu_sigma_log_corr_m")!=null) this.gpu_sigma_log_corr_m=Double.parseDouble(properties.getProperty(prefix+"gpu_sigma_log_corr_m")); if (properties.getProperty(prefix+"gpu_fatz")!=null) this.gpu_fatz=Double.parseDouble(properties.getProperty(prefix+"gpu_fatz")); if (properties.getProperty(prefix+"gpu_fatz_m")!=null) this.gpu_fatz_m=Double.parseDouble(properties.getProperty(prefix+"gpu_fatz_m")); if (properties.getProperty(prefix+"gpu_fatz_inter")!=null) this.gpu_fatz_inter=Double.parseDouble(properties.getProperty(prefix+"gpu_fatz_inter")); if (properties.getProperty(prefix+"gpu_fatz_inter_m")!=null) this.gpu_fatz_inter_m=Double.parseDouble(properties.getProperty(prefix+"gpu_fatz_inter_m")); if (properties.getProperty(prefix+"gpu_woi")!=null) this.gpu_woi=Boolean.parseBoolean(properties.getProperty(prefix+"gpu_woi")); if (properties.getProperty(prefix+"gpu_woi_tx")!=null) this.gpu_woi_tx=Integer.parseInt(properties.getProperty(prefix+"gpu_woi_tx")); Loading Loading @@ -2692,6 +2727,7 @@ public class CLTParameters { poles.getProperties (prefix+"_poles", properties); lwir.getProperties (prefix+"_lwir", properties); ofp.getProperties (prefix+"_ofp_", properties); imp.getProperties (prefix+"_imp_", properties); ilp.getProperties (prefix+"_ilp_", properties); inp.getProperties (prefix+"_inp_", properties); } Loading Loading @@ -3695,10 +3731,14 @@ public class CLTParameters { gd.addNumericField("LoG sigma for correlation, mono", this.gpu_sigma_log_corr_m, 4, 6,"pix", "Use LoG filter to reduce dynamic range of the correlation input to fit into float range"); gd.addNumericField("Fat zero (absolute) for phase correlation of color images", this.gpu_fatz, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes, color images"); gd.addNumericField("Fat zero (absolute) for phase correlation of monochrome images", this.gpu_fatz_m, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes, monochrome images"); gd.addNumericField("Fat zero (absolute) for intrascene phase correlation of color images", this.gpu_fatz, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes in intrascene mode, color images"); gd.addNumericField("Fat zero (absolute) for intrascene phase correlation of monochrome images", this.gpu_fatz_m, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes in intrascene mode, monochrome images"); gd.addNumericField("Fat zero (absolute) for interscene phase correlation of color images", this.gpu_fatz_inter, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes in interscene mode, color images"); gd.addNumericField("Fat zero (absolute) for interscene phase correlation of monochrome images", this.gpu_fatz_inter_m, 4, 6,"", "Add squared fat zero to the sum of squared amplitudes in interscene mode, monochrome images"); gd.addMessage ("--- GPU WOI selection ---"); gd.addCheckbox ("Use following WOI for GPU processing (unchecked - ignore WOI dimensions)", this.gpu_woi); Loading Loading @@ -3734,6 +3774,9 @@ public class CLTParameters { gd.addTab ("O-Flow", "parameters for the interscene Optical FLow calculations"); this.ofp.dialogQuestions(gd); gd.addTab ("Inter-Match", "Parameters for full-resolution (no decimation/macrotiles) scene matching"); this.imp.dialogQuestions(gd); gd.addTab ("Inter-LMA", "parameters for the interscene LMA fitting"); this.ilp.dialogQuestions(gd); Loading Loading @@ -4541,6 +4584,8 @@ public class CLTParameters { this.gpu_sigma_log_corr_m = gd.getNextNumber(); this.gpu_fatz = gd.getNextNumber(); this.gpu_fatz_m = gd.getNextNumber(); this.gpu_fatz_inter = gd.getNextNumber(); this.gpu_fatz_inter_m = gd.getNextNumber(); this.gpu_woi= gd.getNextBoolean(); this.gpu_woi_tx = (int) gd.getNextNumber(); Loading @@ -4564,6 +4609,7 @@ public class CLTParameters { this.lwir.dialogAnswers(gd); this.ofp.dialogAnswers(gd); this.imp.dialogAnswers(gd); this.ilp.dialogAnswers(gd); this.inp.dialogAnswers(gd); Loading
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java +3 −0 Original line number Diff line number Diff line Loading @@ -6621,6 +6621,9 @@ public class Eyesis_Correction implements PlugIn, ActionListener { QUAD_CLT_AUX.setGPU(GPU_QUAD_AUX); } } CLT_PARAMETERS.setColorProcParameters(COLOR_PROC_PARAMETERS, false); CLT_PARAMETERS.setColorProcParameters(COLOR_PROC_PARAMETERS_AUX, true); CLT_PARAMETERS.setRGBParameters(RGB_PARAMETERS); try { TWO_QUAD_CLT.batchLwirRig(QUAD_CLT, // QuadCLT quadCLT_main, Loading
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java +19 −14 Original line number Diff line number Diff line Loading @@ -85,6 +85,7 @@ public class GPUTileProcessor { static String GPU_CONVERT_DIRECT_NAME = "convert_direct"; // name in C code static String GPU_IMCLT_ALL_NAME = "imclt_rbg_all"; static String GPU_CORRELATE2D_NAME = "correlate2D"; // name in C code static String GPU_CORRELATE2D_INTER_NAME = "correlate2D_inter"; // name in C code static String GPU_CORR2D_COMBINE_NAME = "corr2D_combine"; // name in C code static String GPU_CORR2D_NORMALIZE_NAME = "corr2D_normalize"; // name in C code static String GPU_TEXTURES_NAME = "textures_nonoverlap"; // name in C code Loading Loading @@ -163,6 +164,7 @@ public class GPUTileProcessor { CUfunction GPU_CONVERT_DIRECT_kernel = null; // "convert_direct" CUfunction GPU_IMCLT_ALL_kernel = null; // "imclt_rbg_all" CUfunction GPU_CORRELATE2D_kernel = null; // "correlate2D" CUfunction GPU_CORRELATE2D_INTER_kernel = null; // "correlate2D_inter" CUfunction GPU_CORR2D_COMBINE_kernel = null; // "corr2D_combine" CUfunction GPU_CORR2D_NORMALIZE_kernel = null; // "corr2D_normalize"; CUfunction GPU_TEXTURES_kernel = null; // "textures_nonoverlap" Loading Loading @@ -314,6 +316,7 @@ public class GPUTileProcessor { GPU_CONVERT_DIRECT_NAME, GPU_IMCLT_ALL_NAME, GPU_CORRELATE2D_NAME, GPU_CORRELATE2D_INTER_NAME, GPU_CORR2D_COMBINE_NAME, GPU_CORR2D_NORMALIZE_NAME, GPU_TEXTURES_NAME, Loading @@ -337,27 +340,29 @@ public class GPUTileProcessor { GPU_CONVERT_DIRECT_kernel = functions[0]; GPU_IMCLT_ALL_kernel = functions[1]; GPU_CORRELATE2D_kernel = functions[2]; GPU_CORR2D_COMBINE_kernel = functions[3]; GPU_CORR2D_NORMALIZE_kernel = functions[4]; GPU_TEXTURES_kernel= functions[5]; GPU_RBGA_kernel= functions[6]; GPU_ROT_DERIV_kernel = functions[7]; GPU_CALCULATE_TILES_OFFSETS_kernel = functions[8]; GPU_CALC_REVERSE_DISTORTION_kernel = functions[9]; GPU_CORRELATE2D_INTER_kernel = functions[3]; GPU_CORR2D_COMBINE_kernel = functions[4]; GPU_CORR2D_NORMALIZE_kernel = functions[5]; GPU_TEXTURES_kernel= functions[6]; GPU_RBGA_kernel= functions[7]; GPU_ROT_DERIV_kernel = functions[8]; GPU_CALCULATE_TILES_OFFSETS_kernel = functions[9]; GPU_CALC_REVERSE_DISTORTION_kernel = functions[10]; // Kernels to use w/o Dynamic Parallelism GPU_CLEAR_TEXTURE_LIST_kernel = functions[10]; GPU_MARK_TEXTURE_LIST_kernel = functions[11]; GPU_MARK_TEXTURE_NEIGHBOR_kernel = functions[12]; GPU_GEN_TEXTURE_LIST_kernel = functions[13]; GPU_CLEAR_TEXTURE_RBGA_kernel = functions[14]; GPU_TEXTURES_ACCUMULATE_kernel = functions[15]; GPU_CREATE_NONOVERLAP_LIST_kernel = functions[16]; GPU_CLEAR_TEXTURE_LIST_kernel = functions[11]; GPU_MARK_TEXTURE_LIST_kernel = functions[12]; GPU_MARK_TEXTURE_NEIGHBOR_kernel = functions[13]; GPU_GEN_TEXTURE_LIST_kernel = functions[14]; GPU_CLEAR_TEXTURE_RBGA_kernel = functions[15]; GPU_TEXTURES_ACCUMULATE_kernel = functions[16]; GPU_CREATE_NONOVERLAP_LIST_kernel = functions[17]; System.out.println("GPU kernel functions initialized"); System.out.println(GPU_CONVERT_DIRECT_kernel.toString()); System.out.println(GPU_IMCLT_ALL_kernel.toString()); System.out.println(GPU_CORRELATE2D_kernel.toString()); System.out.println(GPU_CORRELATE2D_INTER_kernel.toString()); System.out.println(GPU_CORR2D_COMBINE_kernel.toString()); System.out.println(GPU_CORR2D_NORMALIZE_kernel.toString()); System.out.println(GPU_TEXTURES_kernel.toString()); Loading
src/main/java/com/elphel/imagej/gpu/GpuQuad.java +187 −31 File changed.Preview size limit exceeded, changes collapsed. Show changes
src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java +67 −1 Original line number Diff line number Diff line Loading @@ -2384,7 +2384,7 @@ public class Correlation2d { * @return argmax() relative to the tile center */ public double [] getMaxXYCm( // not used in lwir public static double [] getMaxXYCm( // not used in lwir double [] data, int data_width, // = 2 * transform_size - 1; int center_row, Loading @@ -2411,6 +2411,72 @@ public class Correlation2d { return rslt; } public static double [] getMaxXYCm( double [] data, int data_width, // = 2 * transform_size - 1; double radius, // 0 - all same weight, > 0 cosine(PI/2*sqrt(dx^2+dy^2)/rad) int refine, // re-center window around new maximum. 0 -no refines (single-pass) boolean debug) { int data_height = data.length/data_width; int center_xy = (data_width - 1)/2; // = transform_size - 1; double x0 = center_xy, y0 = center_xy; int imax= 0; for (int i= 1; i < data.length;i++) { if (data[i] > data[imax]) { imax = i; } } double mx = data[imax]; x0 = imax % data_width; y0 = imax / data_width; //calculate as "center of mass" if (radius == 0) { double s0 = 0, sx=0,sy = 0; for (int iy = 0; iy < data_height; iy++) { double y = iy - y0; for (int ix = 0; ix < data_width; ix++) { double x = ix - x0; double d = data[iy * data_width + ix]; s0 += d; sx += d * x; sy += d * y; } } x0 += sx / s0; y0 += sy / s0; } else { double radius2 = radius*radius; for (int nref = 0; nref <= refine; nref++) { double s0 = 0, sx=0,sy = 0; for (int iy = 0; iy < data_height; iy++) { double y = iy - y0; for (int ix = 0; ix < data_width; ix++) { double x = ix - x0; double r2= x*x + y*y; if (r2 < radius2) { double r = Math.sqrt(r2); double d = data[iy * data_width + ix]; d *= Math.cos(0.5*Math.PI*r/radius); s0 += d; sx += d * x; sy += d * y; } } } x0 += sx / s0; y0 += sy / s0; } } double [] rslt = {x0 - center_xy, y0 - center_xy, mx}; if (debug){ System.out.println("getMaxXYCm() -> "+rslt[0]+":"+rslt[1]); } return rslt; } /** * Analyze 1d correlation (single centerline of the 3D phase correlation combined output * from all pairs or only diameters to detect double maximum (simultaneous FG+BG) Loading