Commit 15cff9c7 authored by Andrey Filippov's avatar Andrey Filippov

Generated statistics from mixed synthetic noise

parent a74958ee
package com.elphel.imagej.cameras; package com.elphel.imagej.cameras;
/**
**
** CLTParameters - Class for handling multiple configuration parameters
**
** Copyright (C) 2017-2020 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** CLTParameters.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
//import static jcuda.driver.JCudaDriver.cuMemcpyDtoH;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
...@@ -875,7 +903,7 @@ public class CLTParameters { ...@@ -875,7 +903,7 @@ public class CLTParameters {
public LwirReaderParameters lwir = new LwirReaderParameters(); public LwirReaderParameters lwir = new LwirReaderParameters();
public OpticalFlowParameters ofp = new OpticalFlowParameters(); public OpticalFlowParameters ofp = new OpticalFlowParameters();
public IntersceneLmaParameters ilp = new IntersceneLmaParameters(); public IntersceneLmaParameters ilp = new IntersceneLmaParameters();
public InterNoiseParameters inp = new InterNoiseParameters();
public HashMap<String,Double> z_corr_map = new HashMap<String,Double>(); //old one public HashMap<String,Double> z_corr_map = new HashMap<String,Double>(); //old one
public HashMap<String,Double> infinity_distace_map = new HashMap<String,Double>(); //new one public HashMap<String,Double> infinity_distace_map = new HashMap<String,Double>(); //new one
...@@ -1729,6 +1757,7 @@ public class CLTParameters { ...@@ -1729,6 +1757,7 @@ public class CLTParameters {
lwir.setProperties (prefix+"_lwir", properties); lwir.setProperties (prefix+"_lwir", properties);
ofp.setProperties (prefix+"_ofp_", properties); ofp.setProperties (prefix+"_ofp_", properties);
ilp.setProperties (prefix+"_ilp_", properties); ilp.setProperties (prefix+"_ilp_", properties);
inp.setProperties (prefix+"_inp_", properties);
} }
...@@ -2554,6 +2583,7 @@ public class CLTParameters { ...@@ -2554,6 +2583,7 @@ public class CLTParameters {
lwir.getProperties (prefix+"_lwir", properties); lwir.getProperties (prefix+"_lwir", properties);
ofp.getProperties (prefix+"_ofp_", properties); ofp.getProperties (prefix+"_ofp_", properties);
ilp.getProperties (prefix+"_ilp_", properties); ilp.getProperties (prefix+"_ilp_", properties);
inp.getProperties (prefix+"_inp_", properties);
} }
public boolean showJDialog() { public boolean showJDialog() {
...@@ -3528,9 +3558,11 @@ public class CLTParameters { ...@@ -3528,9 +3558,11 @@ public class CLTParameters {
gd.addTab ("O-Flow", "parameters for the interscene Optical FLow calculations"); gd.addTab ("O-Flow", "parameters for the interscene Optical FLow calculations");
this.ofp.dialogQuestions(gd); this.ofp.dialogQuestions(gd);
gd.addTab ("Intra-LMA", "parameters for the interscene LMA fitting"); gd.addTab ("Inter-LMA", "parameters for the interscene LMA fitting");
this.ilp.dialogQuestions(gd); this.ilp.dialogQuestions(gd);
gd.addTab ("Inter-Noise", "parameters for the interscene noise testing");
this.inp.dialogQuestions(gd);
gd.addTab ("Debug", "Other debug images"); gd.addTab ("Debug", "Other debug images");
gd.addMessage ("--- Other debug images ---"); gd.addMessage ("--- Other debug images ---");
...@@ -4330,6 +4362,7 @@ public class CLTParameters { ...@@ -4330,6 +4362,7 @@ public class CLTParameters {
this.lwir.dialogAnswers(gd); this.lwir.dialogAnswers(gd);
this.ofp.dialogAnswers(gd); this.ofp.dialogAnswers(gd);
this.ilp.dialogAnswers(gd); this.ilp.dialogAnswers(gd);
this.inp.dialogAnswers(gd);
this.debug_initial_discriminate= gd.getNextBoolean(); this.debug_initial_discriminate= gd.getNextBoolean();
this.dbg_migrate= gd.getNextBoolean(); this.dbg_migrate= gd.getNextBoolean();
......
package com.elphel.imagej.cameras;
/**
**
** InterNoiseParameters - Class for handling configuration parameters
** to measure disparity map calculation with images degraded by the artificially
** introduced noise.
** related to the interscene LMA
**
** Copyright (C) 2020 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** InterNoiseParameters.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
import java.util.Properties;
import com.elphel.imagej.common.GenericJTabbedDialog;
public class InterNoiseParameters {
public double noise_sigma = 1.5;
public double noise_scale = 0.01;
public double initial_offset = 1.0;
public boolean ref_only = false; // also see imgdtt_params.dbg_pair_mask to switch between all pairs (63) and binocular only (1)
public int noise_debug_level = -1; // Noise testing debug level
public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addMessage("Additive noise parameters");
gd.addMessage("LMA other parameters");
gd.addNumericField("Noise Gaussian sigma", this.noise_sigma, 3,5,"pix",
"Blur noise with 2D Gaussian");
gd.addNumericField("Scale noise", this.noise_scale, 6,8,"",
"Scale noise relative to the average value of the color component.");
gd.addNumericField("Offset target disparity", this.initial_offset, 3,5,"pix",
"Offset target disparity before attempting to correlate and refine.");
gd.addCheckbox ("Reference scene only", this.ref_only,
"Process only reference scene (intra-scene, no inter-scene accumulation).");
gd.addNumericField("Debug level", this.noise_debug_level, 0,3,"",
"Debug level of interscene noise testing.");
}
public void dialogAnswers(GenericJTabbedDialog gd) {
this.noise_sigma = gd.getNextNumber();
this.noise_scale = gd.getNextNumber();
this.initial_offset = gd.getNextNumber();
this.ref_only = gd.getNextBoolean();
this.noise_debug_level = (int) gd.getNextNumber();
}
public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"noise_sigma", this.noise_sigma+"");
properties.setProperty(prefix+"noise_scale", this.noise_scale+"");
properties.setProperty(prefix+"initial_offset", this.initial_offset+"");
properties.setProperty(prefix+"ref_only", this.ref_only+"");
properties.setProperty(prefix+"noise_debug_level", this.noise_debug_level+"");
}
public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"noise_sigma")!=null) this.noise_sigma=Double.parseDouble(properties.getProperty(prefix+"noise_sigma"));
if (properties.getProperty(prefix+"noise_scale")!=null) this.noise_scale=Double.parseDouble(properties.getProperty(prefix+"noise_scale"));
if (properties.getProperty(prefix+"initial_offset")!=null) this.initial_offset=Double.parseDouble(properties.getProperty(prefix+"initial_offset"));
if (properties.getProperty(prefix+"ref_only")!=null) this.ref_only=Boolean.parseBoolean(properties.getProperty(prefix+"ref_only"));
if (properties.getProperty(prefix+"noise_debug_level")!=null) this.noise_debug_level=Integer.parseInt(properties.getProperty(prefix+"noise_debug_level"));
}
@Override
public InterNoiseParameters clone() throws CloneNotSupportedException {
InterNoiseParameters inp = new InterNoiseParameters();
inp.noise_sigma = this.noise_sigma;
inp.noise_scale = this.noise_scale;
inp.initial_offset = this.initial_offset;
inp.ref_only = this.ref_only;
inp.noise_debug_level = this.noise_debug_level;
return inp;
}
}
...@@ -1487,7 +1487,7 @@ public class ImageDtt extends ImageDttCPU { ...@@ -1487,7 +1487,7 @@ public class ImageDtt extends ImageDttCPU {
for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) { for (int i = 0; i < debug_offsets.length; i++) for (int j = 0; j < debug_offsets[i].length; j++) {
debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale; debug_offsets[i][j] = imgdtt_params.lma_dbg_offset[i][j]*imgdtt_params.lma_dbg_scale;
} }
//dbg_pair_mask
final int quad = 4; // number of subcameras final int quad = 4; // number of subcameras
// final int numcol = isMonochrome()?1:3; // final int numcol = isMonochrome()?1:3;
...@@ -1723,9 +1723,9 @@ public class ImageDtt extends ImageDttCPU { ...@@ -1723,9 +1723,9 @@ public class ImageDtt extends ImageDttCPU {
if (fcorr_tiles != null) { if (fcorr_tiles != null) {
fcorr_tiles[tileY * tilesX + tileX] = fcorrs; // does not require corr_common_GPU() fcorr_tiles[tileY * tilesX + tileX] = fcorrs; // does not require corr_common_GPU()
} }
if ((disparity_map != null) || (clt_corr_partial != null) || (clt_mismatch != null)) { if ((disparity_map != null) || (clt_corr_partial != null) || (clt_mismatch != null)) {
int used_pairs = pair_mask; // imgdtt_params.dbg_pair_mask; //TODO: use tile tasks // int used_pairs = pair_mask; // imgdtt_params.dbg_pair_mask; //TODO: use tile tasks
int used_pairs = pair_mask & imgdtt_params.dbg_pair_mask; // imgdtt_params.dbg_pair_mask; //TODO: use tile tasks
int tile_lma_debug_level = ((tileX == debug_tileX) && (tileY == debug_tileY))? (imgdtt_params.lma_debug_level-1) : -2; int tile_lma_debug_level = ((tileX == debug_tileX) && (tileY == debug_tileY))? (imgdtt_params.lma_debug_level-1) : -2;
boolean debugTile =(tileX == debug_tileX) && (tileY == debug_tileY) && (globalDebugLevel > -1); boolean debugTile =(tileX == debug_tileX) && (tileY == debug_tileY) && (globalDebugLevel > -1);
corr_common_GPU( corr_common_GPU(
......
package com.elphel.imagej.tileprocessor; package com.elphel.imagej.tileprocessor;
/**
**
** IntersceneLmaParameters - Class for handling multiple configuration parameters
** related to the interscene LMA
**
** Copyright (C) 2020 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** IntersceneLmaParameters.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
import java.util.Properties; import java.util.Properties;
......
...@@ -191,19 +191,31 @@ public class QuadCLTCPU { ...@@ -191,19 +191,31 @@ public class QuadCLTCPU {
this.ds_from_main = ErsCorrection.clone2d(qParent.ds_from_main); this.ds_from_main = ErsCorrection.clone2d(qParent.ds_from_main);
this.tp = qParent.tp; this.tp = qParent.tp;
} }
public QuadCLT spawnQuadCLTWithNoise(
String set_name,
CLTParameters clt_parameters,
ColorProcParameters colorProcParameters,
double [] noise_sigma_level,
int threadsMax,
int debugLevel)
{
QuadCLT quadCLT = new QuadCLT(this, set_name);
quadCLT.restoreFromModel(
clt_parameters,
colorProcParameters,
noise_sigma_level, // double [] noise_sigma_level,
threadsMax,
debugLevel);
return quadCLT;
}
public QuadCLT spawnQuadCLT( public QuadCLT spawnQuadCLT(
// QuadCLTCPU quadCLT_master,
String set_name, String set_name,
CLTParameters clt_parameters, CLTParameters clt_parameters,
ColorProcParameters colorProcParameters, // ColorProcParameters colorProcParameters, //
// String [] sourceFiles,
// String set_name,
// double [] referenceExposures,
// int [] channelFiles,
// double [] scaleExposures,
// boolean [][] saturation_imp,
int threadsMax, int threadsMax,
int debugLevel) int debugLevel)
{ {
...@@ -212,17 +224,10 @@ public class QuadCLTCPU { ...@@ -212,17 +224,10 @@ public class QuadCLTCPU {
quadCLT.restoreFromModel( quadCLT.restoreFromModel(
clt_parameters, clt_parameters,
colorProcParameters, colorProcParameters,
null, // double [] noise_sigma_level,
threadsMax, threadsMax,
debugLevel); debugLevel);
// quadCLT.showDSIMain();
// System.out.println("\n image_name="+(quadCLT.image_name)+"\n"+quadCLT.geometryCorrection.getCorrVector().toString());
// add to generator ?
/*
quadCLT.saveInterProperties( // save properties for interscene processing (extrinsics, ers, ...)
null, // String path, // full name with extension or w/o path to use x3d directory
-2); // int debugLevel)
*/
return quadCLT; return quadCLT;
} }
public double getTimeStamp() { public double getTimeStamp() {
......
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