Commit 0d087c0b authored by Andrey Filippov's avatar Andrey Filippov

debugging texture generation in GPU, fixed old NaN bug, similar to noticed in the GPU code

parent 6254f686
......@@ -4536,7 +4536,7 @@ public class MatchSimulatedPattern {
final int debugLevel
){
final int debugThreshold=2; // -1; // 1; ** Restore 1
if (debugThreshold < 0) {
if ((debugThreshold < 0) || (debugLevel < -10000)) {
System.out.println("findPatternCandidates(): debugThreshold < 0 - restore when done");
}
if ((debugLevel>debugThreshold) && ((debugLevel>1) || (startScanIndex>3))) {
......
......@@ -112,6 +112,7 @@ public class CLTParameters {
public boolean show_overlap = true; // show result RGBA (first channels, then RGBA combined?)
public boolean show_rgba_color = true; // show combined color image
public boolean show_map = true; // show disparity maps
public boolean show_corr = true; // show GPU correlation
public double disp_scan_start = 0.0; // disparity scan start value
public double disp_scan_step = 1.0; // disparity scan step
......@@ -768,10 +769,10 @@ public class CLTParameters {
public int gpu_corr_rad = 7; // size of the correlation to save - initially only 15x15
public double gpu_weight_r = 0.25;
public double gpu_weight_b = 0.25; // weight g = 1.0 - gpu_weight_r - gpu_weight_b
public double gpu_sigma_r = 1.1;
public double gpu_sigma_b = 1.1;
public double gpu_sigma_g = 0.7;
public double gpu_sigma_m = 0.7;
public double gpu_sigma_r = 0.9; // 1.1;
public double gpu_sigma_b = 0.9; // 1.1;
public double gpu_sigma_g = 0.6; // 0.7;
public double gpu_sigma_m = 0.4; // 0.7;
public double gpu_sigma_rb_corr = 0.5; // apply LPF after accumulating R and B correlation before G,
public double gpu_sigma_corr = 0.9;
public double gpu_sigma_corr_m = 0.15;
......@@ -946,6 +947,7 @@ public class CLTParameters {
properties.setProperty(prefix+"show_overlap", this.show_overlap+"");
properties.setProperty(prefix+"show_rgba_color", this.show_rgba_color+"");
properties.setProperty(prefix+"show_map", this.show_map+"");
properties.setProperty(prefix+"show_corr", this.show_corr+"");
properties.setProperty(prefix+"disp_scan_start", this.disp_scan_start +"");
properties.setProperty(prefix+"disp_scan_step", this.disp_scan_step +"");
properties.setProperty(prefix+"disp_scan_count", this.disp_scan_count+"");
......@@ -1693,6 +1695,8 @@ public class CLTParameters {
if (properties.getProperty(prefix+"show_overlap")!=null) this.show_overlap=Boolean.parseBoolean(properties.getProperty(prefix+"show_overlap"));
if (properties.getProperty(prefix+"show_rgba_color")!=null) this.show_rgba_color=Boolean.parseBoolean(properties.getProperty(prefix+"show_rgba_color"));
if (properties.getProperty(prefix+"show_map")!=null) this.show_map=Boolean.parseBoolean(properties.getProperty(prefix+"show_map"));
if (properties.getProperty(prefix+"show_corr")!=null) this.show_corr=Boolean.parseBoolean(properties.getProperty(prefix+"show_corr"));
if (properties.getProperty(prefix+"disp_scan_start")!=null) this.disp_scan_start=Double.parseDouble(properties.getProperty(prefix+"disp_scan_start"));
if (properties.getProperty(prefix+"disp_scan_step")!=null) this.disp_scan_step=Double.parseDouble(properties.getProperty(prefix+"disp_scan_step"));
if (properties.getProperty(prefix+"disp_scan_count")!=null) this.disp_scan_count=Integer.parseInt(properties.getProperty(prefix+"disp_scan_count"));
......@@ -2473,11 +2477,13 @@ public class CLTParameters {
gd.addNumericField("Alpha channel 1.0 threshold (higher - opaque)", this.alpha1, 3);
gd.addCheckbox ("Generate shifted channel linear RGB stacks", this.gen_chn_stacks);
gd.addCheckbox ("Generate shifted channel color image stack", this.gen_chn_img);
gd.addCheckbox ("Generate shifted channel images and save with the model 'CLT process corr'", this.gen_4_img);
gd.addCheckbox ("Generate shifted channel images and save with the model 'CLT process corr'", this.gen_4_img);
gd.addCheckbox ("Show result RGBA before overlap combined", this.show_nonoverlap);
gd.addCheckbox ("Show result RGBA", this.show_overlap);
gd.addCheckbox ("Show result color", this.show_rgba_color);
gd.addCheckbox ("Show disparity maps", this.show_map);
gd.addCheckbox ("Show correlation tiles", this.show_corr);
gd.addNumericField("Disparity scan start value", this.disp_scan_start, 2);
gd.addNumericField("Disparity scan step", this.disp_scan_step, 2);
gd.addNumericField("Disparity scan number of disparity values to scan", this.disp_scan_count, 0);
......@@ -3374,6 +3380,7 @@ public class CLTParameters {
this.show_overlap= gd.getNextBoolean();
this.show_rgba_color= gd.getNextBoolean();
this.show_map= gd.getNextBoolean();
this.show_corr= gd.getNextBoolean();
this.disp_scan_start= gd.getNextNumber();
this.disp_scan_step= gd.getNextNumber();
this.disp_scan_count= (int) gd.getNextNumber();
......
......@@ -1220,7 +1220,11 @@ public class EyesisDCT {
}
if (this.correctionsParameters.deconvolve) { // process with DCT, otherwise use simple debayer
ImageDtt image_dtt = new ImageDtt(dctParameters.dct_size, false, 1.0); // Bayer( not monochrome), scale correlation strengths
ImageDtt image_dtt = new ImageDtt(
dctParameters.dct_size,
false, // mono
false, // lwir
1.0); // Bayer( not monochrome), scale correlation strengths
double [][][][] dct_data = image_dtt.mdctStack(
stack,
channel,
......
......@@ -3075,7 +3075,11 @@ private Panel panel1,
}
}
ImageDtt image_dtt = new ImageDtt(DCT_PARAMETERS.dct_size, false, 1.0); // Bayer( not monochrome), scale correlation strengths
ImageDtt image_dtt = new ImageDtt(
DCT_PARAMETERS.dct_size,
false, // mono
false, // lwir
1.0); // Bayer( not monochrome), scale correlation strengths
double [][][][] dctdc_data = image_dtt.mdctScale(
DBG_IMP.getStack(),
DCT_PARAMETERS.kernel_chn,
......@@ -3173,7 +3177,11 @@ private Panel panel1,
}
}
ImageDtt image_dtt = new ImageDtt(DCT_PARAMETERS.dct_size,false, 1.0); // Bayer( not monochrome), scale correlation strengths
ImageDtt image_dtt = new ImageDtt(
DCT_PARAMETERS.dct_size,
false, // mono
false, // lwir
1.0); // Bayer( not monochrome), scale correlation strengths
double [][][][] dctdc_data = image_dtt.mdctStack(
DBG_IMP.getStack(),
DCT_PARAMETERS.kernel_chn,
......@@ -7052,8 +7060,9 @@ private Panel panel1,
ImageDtt image_dtt = new ImageDtt(
CLT_PARAMETERS.transform_size,
false,
1.0); // Bayer( not monochrome), scale correlation strengths
false, // mono
false, // lwir
1.0); // Bayer( not monochrome), scale correlation strengths
double [][][][][] clt_data = image_dtt.cltStack(
DBG_IMP.getStack(),
0, // CLT_PARAMETERS.kernel_chn,
......@@ -7186,6 +7195,7 @@ private Panel panel1,
ImageDtt image_dtt = new ImageDtt(
CLT_PARAMETERS.transform_size,
COLOR_PROC_PARAMETERS.isMonochrome(),
COLOR_PROC_PARAMETERS.isLwir(),
CLT_PARAMETERS.getScaleStrength(false)); // Bayer, not monochrome
String [] titles = {
"redCC", "redSC", "redCS", "redSS",
......
......@@ -63,6 +63,7 @@ public class MacroCorrelation {
tileSize, // int tileSize,
tp.superTileSize, // int superTileSize,
tp.isMonochrome(),
tp.isLwir(),
tp.isAux(),
tp.getMagicScale(), // double scale,
trusted_correlation, // double trustedCorrelation,
......@@ -309,6 +310,7 @@ public class MacroCorrelation {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
this.mtp.isMonochrome(),
this.mtp.isLwir(),
clt_parameters.getScaleStrength(this.mtp.isAux()));
image_dtt.clt_aberrations_quad_corr(
clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
......
......@@ -123,6 +123,7 @@ public class QuadCLT {
// magic scale should be set before using TileProcessor (calculated disparities depend on it)
public boolean isMonochrome() {return is_mono;} // USED in lwir
public boolean isAux() {return is_aux;} // USED in lwir
public String sAux() {return isAux()?"-AUX":"";} // USED in lwir
public boolean isLwir() {return !Double.isNaN(lwir_offset);} // clt_kernels // USED in lwir
......@@ -170,6 +171,7 @@ public class QuadCLT {
clt_parameters.transform_size,
clt_parameters.stSize,
isMonochrome(),
isLwir(),
isAux(),
clt_parameters.corr_magic_scale,
clt_parameters.grow_disp_trust,
......@@ -583,6 +585,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
int chn,tileY,tileX;
DttRad2 dtt = new DttRad2(dtt_size);
......@@ -759,7 +762,11 @@ public class QuadCLT {
if (globalDebugLevel > 1) System.out.println("Threads done at "+IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
System.out.println("1.Threads done at "+IJ.d2s(0.000000001*(System.nanoTime()-startTime),3));
// Calculate differential offsets to interpolate for tiles between kernel centers
ImageDtt image_dtt = new ImageDtt(clt_parameters.transform_size,isMonochrome(),clt_parameters.getScaleStrength(isAux()));
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
image_dtt.clt_fill_coord_corr(
clt_parameters.kernel_step, // final int kern_step, // distance between kernel centers, in pixels.
clt_kernels, // final double [][][][] clt_data,
......@@ -1722,6 +1729,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
for (int i =0 ; i < double_stack[0].length; i++){
double_stack[2][i]*=0.5; // Scale blue twice to compensate less pixels than green
......@@ -2327,6 +2335,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
for (int i =0 ; i < double_stack[0].length; i++){
double_stack[2][i]*=0.5; // Scale blue twice to compensate less pixels than green
......@@ -2895,6 +2904,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
for (int i = 0; i < double_stacks.length; i++){
for (int j =0 ; j < double_stacks[i][0].length; j++){
......@@ -4130,6 +4140,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
for (int i = 0; i < double_stacks.length; i++){
if ( double_stacks[i].length > 2) {
......@@ -4730,10 +4741,8 @@ public class QuadCLT {
debugLevel = clt_parameters.ly_debug_level;
}
final boolean batch_mode = clt_parameters.batch_run; //disable any debug images
String name=this.correctionsParameters.getModelName((String) imp_quad[0].getProperty("name"));
// int channel= Integer.parseInt((String) imp_src.getProperty("channel"));
/// final boolean batch_mode = clt_parameters.batch_run; //disable any debug images
/// String name=this.correctionsParameters.getModelName((String) imp_quad[0].getProperty("name"));
String path= (String) imp_quad[0].getProperty("path");
ImagePlus [] results = new ImagePlus[imp_quad.length];
......@@ -4746,19 +4755,14 @@ public class QuadCLT {
setTiles (imp_quad[0], // set global tp.tilesX, tp.tilesY
clt_parameters,
threadsMax);
// double [][] disparity_array = tp.setSameDisparity(clt_parameters.disparity); // 0.0); // [tp.tilesY][tp.tilesX] - individual per-tile expected disparity
ShowDoubleFloatArrays sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
// clt_parameters.tileStep,
final int tilesX=tp.getTilesX(); // imp_quad[0].getWidth()/clt_parameters.transform_size;
final int tilesY=tp.getTilesY(); // imp_quad[0].getHeight()/clt_parameters.transform_size;
final int clustersX= (tilesX + clt_parameters.tileStep - 1) / clt_parameters.tileStep;
final int clustersY= (tilesY + clt_parameters.tileStep - 1) / clt_parameters.tileStep;
final double [][] lazy_eye_data = new double [clustersY*clustersX][];
// final int nTilesInChn=tilesX*tilesY;
final int nClustersInChn=clustersX * clustersY;
/// final double [][] lazy_eye_data = new double [clustersY*clustersX][];
/// final int nClustersInChn=clustersX * clustersY;
double [][] dsxy = new double[clustersX * clustersY][];
ImagePlus imp_sel = WindowManager.getCurrentImage();
......@@ -4895,7 +4899,11 @@ public class QuadCLT {
this.is_mono);
}
ImageDtt image_dtt = new ImageDtt(clt_parameters.transform_size,isMonochrome(),clt_parameters.getScaleStrength(isAux()));
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
for (int i = 0; i < double_stacks.length; i++){
if ( double_stacks[i].length > 2) {
for (int j =0 ; j < double_stacks[i][0].length; j++){
......@@ -6065,6 +6073,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
for (int i = 0; i < double_stacks.length; i++){
for (int j =0 ; j < double_stacks[i][0].length; j++){
......@@ -9441,6 +9450,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
double [][] texture_overlap = image_dtt.combineRBGATiles(
texture_tiles_bgnd, // texture_tiles, // array [tp.tilesY][tp.tilesX][4][4*transform_size] or [tp.tilesY][tp.tilesX]{null}
......@@ -9542,6 +9552,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
double [][]alphaFade = tp.getAlphaFade(image_dtt.transform_size);
if ((debugLevel > 0) && (scanIndex == 1)) { // not used in lwir
......@@ -9756,6 +9767,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
double z_correction = clt_parameters.z_correction;
if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
......@@ -9994,6 +10006,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
double z_correction = clt_parameters.z_correction;
if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
......@@ -10129,6 +10142,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
double z_correction = clt_parameters.z_correction;
if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
......@@ -10304,6 +10318,7 @@ public class QuadCLT {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(isAux()));
double z_correction = clt_parameters.z_correction;
if (clt_parameters.z_corr_map.containsKey(image_name)){ // not used in lwir
......
......@@ -80,6 +80,7 @@ public class TileProcessor {
public double [][] main_ds_ml = null; // main camera DSI restored from the COMBO-DSI file to generate ML test files
public boolean monochrome = false; // these are monochrome images
public boolean lwir = false; // all monochrome are lwir
private boolean is_aux = false; // this camera is aux
public int clt_3d_passes_size = 0; //clt_3d_passes size after initial processing
public int clt_3d_passes_rig_size = 0; //clt_3d_passes size after initial processing and rig processing
......@@ -110,6 +111,7 @@ public class TileProcessor {
int tileSize,
int superTileSize,
boolean monochrome,
boolean lwir,
boolean is_aux,
double scale,
double trustedCorrelation,
......@@ -121,6 +123,7 @@ public class TileProcessor {
this.tileSize = tileSize;
this.superTileSize = superTileSize;
this.monochrome = monochrome;
this.lwir = lwir;
this.is_aux = is_aux;
this.corr_magic_scale = scale;
this.trustedCorrelation = trustedCorrelation;
......@@ -128,6 +131,7 @@ public class TileProcessor {
this.threadsMax = threadsMax;
}
public boolean isMonochrome() {return monochrome;}
public boolean isLwir() {return lwir;}
public boolean isAux() {return is_aux;}
public int getTilesX() {return tilesX;}
......@@ -5809,6 +5813,7 @@ public class TileProcessor {
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
isLwir(),
clt_parameters.getScaleStrength(is_aux));
double [][][] dispStrength = st.getDisparityStrengths(
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment