Commit 28f7044c authored by Andrey Filippov's avatar Andrey Filippov

Ground truth from EO to LWIR

parent e2478b97
...@@ -1544,8 +1544,8 @@ public class CLTParameters { ...@@ -1544,8 +1544,8 @@ public class CLTParameters {
if (properties.getProperty(prefix+"max_corr_radius")!=null) this.max_corr_radius=Double.parseDouble(properties.getProperty(prefix+"max_corr_radius")); if (properties.getProperty(prefix+"max_corr_radius")!=null) this.max_corr_radius=Double.parseDouble(properties.getProperty(prefix+"max_corr_radius"));
// for compatibility with old settings // for compatibility with old settings
if (properties.getProperty(prefix+"enhortho_width")!=null) this.img_dtt.enhortho_width=Integer.parseInt(properties.getProperty(prefix+"enhortho_width")); if (properties.getProperty(prefix+"enhortho_width")!=null) this.img_dtt.setEnhOrthoWidth(Integer.parseInt(properties.getProperty(prefix+"enhortho_width")));
if (properties.getProperty(prefix+"enhortho_scale")!=null) this.img_dtt.enhortho_scale=Double.parseDouble(properties.getProperty(prefix+"enhortho_scale")); if (properties.getProperty(prefix+"enhortho_scale")!=null) this.img_dtt.setEnhOrthoScale(Double.parseDouble(properties.getProperty(prefix+"enhortho_scale")));
// for compatibility with old settings // for compatibility with old settings
if (properties.getProperty(prefix+"max_corr_double")!=null) this.max_corr_double=Boolean.parseBoolean(properties.getProperty(prefix+"max_corr_double")); if (properties.getProperty(prefix+"max_corr_double")!=null) this.max_corr_double=Boolean.parseBoolean(properties.getProperty(prefix+"max_corr_double"));
......
...@@ -124,6 +124,18 @@ public class EyesisCorrections { ...@@ -124,6 +124,18 @@ public class EyesisCorrections {
false, false,
false); false);
} }
public void initPixelMapping(
int debugLevel) {
String [] sensorPaths=correctionsParameters.selectSensorFiles(this.debugLevel);
this.pixelMapping=new PixelMapping(
sensorPaths,
correctionsParameters.firstSubCameraConfig, // int first_channel, // 0 - old way
correctionsParameters.numSubCameras, // int num_channels, // 0 - any
true, // boolean update_channel, // false (replace file channel with effective channel (subtract first_channel)
debugLevel);
}
public void initSensorFiles( public void initSensorFiles(
int debugLevel, int debugLevel,
boolean missing_ok, boolean missing_ok,
...@@ -132,6 +144,10 @@ public class EyesisCorrections { ...@@ -132,6 +144,10 @@ public class EyesisCorrections {
){ ){
this.sharpKernelPaths=null; this.sharpKernelPaths=null;
this.smoothKernelPaths=null; this.smoothKernelPaths=null;
if (this.pixelMapping == null) { // NOTE: will not notice switching sensor files !
initPixelMapping(debugLevel);
}
/*
String [] sensorPaths=correctionsParameters.selectSensorFiles(this.debugLevel); String [] sensorPaths=correctionsParameters.selectSensorFiles(this.debugLevel);
this.pixelMapping=new PixelMapping( this.pixelMapping=new PixelMapping(
sensorPaths, sensorPaths,
...@@ -139,6 +155,7 @@ public class EyesisCorrections { ...@@ -139,6 +155,7 @@ public class EyesisCorrections {
correctionsParameters.numSubCameras, // int num_channels, // 0 - any correctionsParameters.numSubCameras, // int num_channels, // 0 - any
true, // boolean update_channel, // false (replace file channel with effective channel (subtract first_channel) true, // boolean update_channel, // false (replace file channel with effective channel (subtract first_channel)
debugLevel); debugLevel);
*/
if (all_sensors) { if (all_sensors) {
this.usedChannels = new boolean [this.pixelMapping.sensors.length]; this.usedChannels = new boolean [this.pixelMapping.sensors.length];
for (int i = 0; i < this.usedChannels.length; i++) { for (int i = 0; i < this.usedChannels.length; i++) {
......
...@@ -224,6 +224,11 @@ public class ImageDtt { ...@@ -224,6 +224,11 @@ public class ImageDtt {
public boolean isMonochrome() { public boolean isMonochrome() {
return monochrome; return monochrome;
} }
// maybe change in the future
public boolean isAux() {
return monochrome;
}
public double [][][][] mdctStack( public double [][][][] mdctStack(
final ImageStack imageStack, final ImageStack imageStack,
...@@ -1615,16 +1620,16 @@ public class ImageDtt { ...@@ -1615,16 +1620,16 @@ public class ImageDtt {
final double [] enh_ortho_scale = new double [corr_size]; final double [] enh_ortho_scale = new double [corr_size];
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
if ((i < (transform_size - imgdtt_params.enhortho_width)) || (i > (transform_size - 2 + imgdtt_params.enhortho_width))) { if ((i < (transform_size - imgdtt_params.getEnhOrthoWidth(isAux()))) || (i > (transform_size - 2 + imgdtt_params.getEnhOrthoWidth(isAux())))) {
enh_ortho_scale[i] = 1.0; enh_ortho_scale[i] = 1.0;
} else { } else {
enh_ortho_scale[i] = imgdtt_params.enhortho_scale; enh_ortho_scale[i] = imgdtt_params.getEnhOrthoScale(isAux());
} }
if (i == (transform_size-1)) enh_ortho_scale[i] = 0.0 ; // hardwired 0 in the center if (i == (transform_size-1)) enh_ortho_scale[i] = 0.0 ; // hardwired 0 in the center
enh_ortho_scale[i] *= Math.sin(Math.PI*(i+1.0)/(2*transform_size)); enh_ortho_scale[i] *= Math.sin(Math.PI*(i+1.0)/(2*transform_size));
} }
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("enhortho_width="+ imgdtt_params.enhortho_width+" enhortho_scale="+ imgdtt_params.enhortho_scale); System.out.println("getEnhOrthoWidth(isAux())="+ imgdtt_params.getEnhOrthoWidth(isAux())+" getEnhOrthoScale(isAux())="+ imgdtt_params.getEnhOrthoScale(isAux()));
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" enh_ortho_scale["+i+"]="+ enh_ortho_scale[i]); System.out.println(" enh_ortho_scale["+i+"]="+ enh_ortho_scale[i]);
...@@ -1782,8 +1787,8 @@ public class ImageDtt { ...@@ -1782,8 +1787,8 @@ public class ImageDtt {
isMonochrome(), // boolean monochrome, isMonochrome(), // boolean monochrome,
(globalDebugLevel > -1)); // boolean debug) (globalDebugLevel > -1)); // boolean debug)
corr2d.createOrtoNotch( corr2d.createOrtoNotch(
imgdtt_params.enhortho_width, // double enhortho_width, imgdtt_params.getEnhOrthoWidth(isAux()), // double getEnhOrthoWidth(isAux()),
imgdtt_params.enhortho_scale, //double enhortho_scale, imgdtt_params.getEnhOrthoScale(isAux()), //double getEnhOrthoScale(isAux()),
(imgdtt_params.lma_debug_level > 1)); // boolean debug); (imgdtt_params.lma_debug_level > 1)); // boolean debug);
for (int nTile = ai.getAndIncrement(); nTile < nTilesInChn; nTile = ai.getAndIncrement()) { for (int nTile = ai.getAndIncrement(); nTile < nTilesInChn; nTile = ai.getAndIncrement()) {
...@@ -6192,20 +6197,20 @@ public class ImageDtt { ...@@ -6192,20 +6197,20 @@ public class ImageDtt {
} }
// reducing weight of on-axis correlation values to enhance detection of vertical/horizontal lines // reducing weight of on-axis correlation values to enhance detection of vertical/horizontal lines
// multiply correlation results inside the horizontal center strip 2*enhortho_width - 1 wide by enhortho_scale // multiply correlation results inside the horizontal center strip 2*getEnhOrthoWidth(isAux()) - 1 wide by getEnhOrthoScale(isAux())
final double [] enh_ortho_scale = new double [corr_size]; final double [] enh_ortho_scale = new double [corr_size];
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
if ((i < (transform_size - imgdtt_params.enhortho_width)) || (i > (transform_size - 2 + imgdtt_params.enhortho_width))) { if ((i < (transform_size - imgdtt_params.getEnhOrthoWidth(isAux()))) || (i > (transform_size - 2 + imgdtt_params.getEnhOrthoWidth(isAux())))) {
enh_ortho_scale[i] = 1.0; enh_ortho_scale[i] = 1.0;
} else { } else {
enh_ortho_scale[i] = imgdtt_params.enhortho_scale; enh_ortho_scale[i] = imgdtt_params.getEnhOrthoScale(isAux());
} }
if (i == (transform_size-1)) enh_ortho_scale[i] = 0.0 ; // hardwired 0 in the center if (i == (transform_size-1)) enh_ortho_scale[i] = 0.0 ; // hardwired 0 in the center
enh_ortho_scale[i] *= Math.sin(Math.PI*(i+1.0)/(2*transform_size)); enh_ortho_scale[i] *= Math.sin(Math.PI*(i+1.0)/(2*transform_size));
} }
if (globalDebugLevel > 1){ if (globalDebugLevel > 1){
System.out.println("enhortho_width="+ imgdtt_params.enhortho_width+" enhortho_scale="+ imgdtt_params.enhortho_scale); System.out.println("getEnhOrthoWidth(isAux())="+ imgdtt_params.getEnhOrthoWidth(isAux())+" getEnhOrthoScale(isAux())="+ imgdtt_params.getEnhOrthoScale(isAux()));
for (int i = 0; i < corr_size; i++){ for (int i = 0; i < corr_size; i++){
System.out.println(" enh_ortho_scale["+i+"]="+ enh_ortho_scale[i]); System.out.println(" enh_ortho_scale["+i+"]="+ enh_ortho_scale[i]);
...@@ -6383,8 +6388,8 @@ public class ImageDtt { ...@@ -6383,8 +6388,8 @@ public class ImageDtt {
(globalDebugLevel > -1)); // boolean debug) (globalDebugLevel > -1)); // boolean debug)
corr2d.createOrtoNotch( corr2d.createOrtoNotch(
imgdtt_params.enhortho_width, // double enhortho_width, imgdtt_params.getEnhOrthoWidth(isAux()), // double enhortho_width,
imgdtt_params.enhortho_scale, //double enhortho_scale, imgdtt_params.getEnhOrthoScale(isAux()), //double enhortho_scale,
false); // true); // boolean debug); false); // true); // boolean debug);
// public int enhortho_width = 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) // public int enhortho_width = 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
// public double enhortho_scale = 0.0; // 0.2; // multiply center correlation pixels (inside enhortho_width) // public double enhortho_scale = 0.0; // 0.2; // multiply center correlation pixels (inside enhortho_width)
......
...@@ -45,8 +45,10 @@ public class ImageDttParameters { ...@@ -45,8 +45,10 @@ public class ImageDttParameters {
public int ortho_nsamples = 5; // number of samples to fit parabola public int ortho_nsamples = 5; // number of samples to fit parabola
public double ortho_vasw_pwr = 2.0; // use data as weights when fitting parabola (high value samples are more important (when false use 3 samples only) public double ortho_vasw_pwr = 2.0; // use data as weights when fitting parabola (high value samples are more important (when false use 3 samples only)
public int enhortho_width = 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) private int enhortho_width = 2; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
public double enhortho_scale = 0.0; // 0.2; // multiply center correlation pixels (inside enhortho_width) private int enhortho_width_aux = 1; // reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)
private double enhortho_scale = 0.0; // 0.2; // multiply center correlation pixels (inside enhortho_width)
private double enhortho_scale_aux = 0.0; // 0.2; // multiply center correlation pixels (inside enhortho_width)
public boolean ly_poly = false; // Use polynomial when measuring mismatch (false - use center of mass) public boolean ly_poly = false; // Use polynomial when measuring mismatch (false - use center of mass)
public double ly_crazy_poly = 1.0; // Maximal allowed mismatch difference calculated as polynomial maximum public double ly_crazy_poly = 1.0; // Maximal allowed mismatch difference calculated as polynomial maximum
public boolean ly_poly_backup = true; // Use CM offset measuremets if poly failed public boolean ly_poly_backup = true; // Use CM offset measuremets if poly failed
...@@ -111,6 +113,22 @@ public class ImageDttParameters { ...@@ -111,6 +113,22 @@ public class ImageDttParameters {
public boolean corr_var_cam = true; // New correlation mode compatible with 8 subcameras public boolean corr_var_cam = true; // New correlation mode compatible with 8 subcameras
public double cm_max_normalization = 0.55; // fraction of correlation maximum radius, being squared multiplied by maximum to have the same total mass public double cm_max_normalization = 0.55; // fraction of correlation maximum radius, being squared multiplied by maximum to have the same total mass
public int getEnhOrthoWidth(boolean aux) {
return aux ? enhortho_width_aux : enhortho_width;
}
public double getEnhOrthoScale(boolean aux) {
return aux ? enhortho_scale_aux : enhortho_scale;
}
// next 2 only used to read old config files
public void setEnhOrthoWidth (int w) {
enhortho_width = w;
}
public void setEnhOrthoScale (double s) {
enhortho_scale = s;
}
public void dialogQuestions(GenericJTabbedDialog gd) { public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addCheckbox ("Enable ImageDtt correlation debug layers", this.corr_mode_debug, gd.addCheckbox ("Enable ImageDtt correlation debug layers", this.corr_mode_debug,
...@@ -135,8 +153,10 @@ public class ImageDttParameters { ...@@ -135,8 +153,10 @@ public class ImageDttParameters {
gd.addNumericField("Use data as weights when fitting parabola for ortho mode", this.ortho_vasw_pwr,3,6,"", gd.addNumericField("Use data as weights when fitting parabola for ortho mode", this.ortho_vasw_pwr,3,6,"",
"Raise value to this power and apply as weight. Reduce width to 3 samples if false, 5 OK when true"); "Raise value to this power and apply as weight. Reduce width to 3 samples if false, 5 OK when true");
gd.addNumericField("Reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center)", this.enhortho_width, 0); gd.addNumericField("Reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) - main camera", this.enhortho_width, 0);
gd.addNumericField("Multiply center correlation pixels (inside enhortho_width) (1.0 - disables enh_ortho)", this.enhortho_scale, 3); gd.addNumericField("Reduce weight of center correlation pixels from center (0 - none, 1 - center, 2 +/-1 from center) - aux camera", this.enhortho_width_aux, 0);
gd.addNumericField("Multiply center correlation pixels (inside enhortho_width) (1.0 - disables enh_ortho) - main camera", this.enhortho_scale, 3);
gd.addNumericField("Multiply center correlation pixels (inside enhortho_width) (1.0 - disables enh_ortho) - aux camera", this.enhortho_scale_aux, 3);
gd.addCheckbox ("Use polynomial when measuring mismatch (false - use center of mass)", this.ly_poly); gd.addCheckbox ("Use polynomial when measuring mismatch (false - use center of mass)", this.ly_poly);
gd.addNumericField("Maximal allowed mismatch difference calculated as polynomial maximum", this.ly_crazy_poly,3,6,"px", gd.addNumericField("Maximal allowed mismatch difference calculated as polynomial maximum", this.ly_crazy_poly,3,6,"px",
...@@ -276,7 +296,9 @@ public class ImageDttParameters { ...@@ -276,7 +296,9 @@ public class ImageDttParameters {
this.ortho_vasw_pwr = gd.getNextNumber(); this.ortho_vasw_pwr = gd.getNextNumber();
this.enhortho_width= (int) gd.getNextNumber(); this.enhortho_width= (int) gd.getNextNumber();
this.enhortho_width_aux=(int)gd.getNextNumber();
this.enhortho_scale= gd.getNextNumber(); this.enhortho_scale= gd.getNextNumber();
this.enhortho_scale_aux= gd.getNextNumber();
this.ly_poly = gd.getNextBoolean(); this.ly_poly = gd.getNextBoolean();
this.ly_crazy_poly= gd.getNextNumber(); this.ly_crazy_poly= gd.getNextNumber();
...@@ -364,7 +386,9 @@ public class ImageDttParameters { ...@@ -364,7 +386,9 @@ public class ImageDttParameters {
properties.setProperty(prefix+"ortho_vasw", this.ortho_vasw_pwr+""); properties.setProperty(prefix+"ortho_vasw", this.ortho_vasw_pwr+"");
properties.setProperty(prefix+"enhortho_width", this.enhortho_width +""); properties.setProperty(prefix+"enhortho_width", this.enhortho_width +"");
properties.setProperty(prefix+"enhortho_width_aux", this.enhortho_width_aux +"");
properties.setProperty(prefix+"enhortho_scale", this.enhortho_scale +""); properties.setProperty(prefix+"enhortho_scale", this.enhortho_scale +"");
properties.setProperty(prefix+"enhortho_scale_aux", this.enhortho_scale_aux +"");
properties.setProperty(prefix+"corr_offset", this.corr_offset +""); properties.setProperty(prefix+"corr_offset", this.corr_offset +"");
properties.setProperty(prefix+"twice_diagonal", this.twice_diagonal +""); properties.setProperty(prefix+"twice_diagonal", this.twice_diagonal +"");
...@@ -451,7 +475,9 @@ public class ImageDttParameters { ...@@ -451,7 +475,9 @@ public class ImageDttParameters {
if (properties.getProperty(prefix+"ortho_vasw_pwr")!=null) this.ortho_vasw_pwr=Double.parseDouble(properties.getProperty(prefix+"ortho_vasw_pwr")); if (properties.getProperty(prefix+"ortho_vasw_pwr")!=null) this.ortho_vasw_pwr=Double.parseDouble(properties.getProperty(prefix+"ortho_vasw_pwr"));
if (properties.getProperty(prefix+"enhortho_width")!=null) this.enhortho_width=Integer.parseInt(properties.getProperty(prefix+"enhortho_width")); if (properties.getProperty(prefix+"enhortho_width")!=null) this.enhortho_width=Integer.parseInt(properties.getProperty(prefix+"enhortho_width"));
if (properties.getProperty(prefix+"enhortho_width_aux")!=null) this.enhortho_width_aux=Integer.parseInt(properties.getProperty(prefix+"enhortho_width_aux"));
if (properties.getProperty(prefix+"enhortho_scale")!=null) this.enhortho_scale=Double.parseDouble(properties.getProperty(prefix+"enhortho_scale")); if (properties.getProperty(prefix+"enhortho_scale")!=null) this.enhortho_scale=Double.parseDouble(properties.getProperty(prefix+"enhortho_scale"));
if (properties.getProperty(prefix+"enhortho_scale_aux")!=null) this.enhortho_scale_aux=Double.parseDouble(properties.getProperty(prefix+"enhortho_scale_aux"));
if (properties.getProperty(prefix+"fo_correct")!=null) this.fo_correct=Boolean.parseBoolean(properties.getProperty(prefix+"fo_correct")); if (properties.getProperty(prefix+"fo_correct")!=null) this.fo_correct=Boolean.parseBoolean(properties.getProperty(prefix+"fo_correct"));
...@@ -543,7 +569,9 @@ public class ImageDttParameters { ...@@ -543,7 +569,9 @@ public class ImageDttParameters {
idp.ortho_vasw_pwr = this.ortho_vasw_pwr; idp.ortho_vasw_pwr = this.ortho_vasw_pwr;
idp.enhortho_width = this.enhortho_width; idp.enhortho_width = this.enhortho_width;
idp.enhortho_width_aux = this.enhortho_width_aux;
idp.enhortho_scale = this.enhortho_scale; idp.enhortho_scale = this.enhortho_scale;
idp.enhortho_scale_aux = this.enhortho_scale_aux;
idp.ly_poly = this.ly_poly; idp.ly_poly = this.ly_poly;
idp.ly_crazy_poly = this.ly_crazy_poly; idp.ly_crazy_poly = this.ly_crazy_poly;
......
...@@ -4835,9 +4835,7 @@ public class TileProcessor { ...@@ -4835,9 +4835,7 @@ public class TileProcessor {
public CLTPass3d refinePassSetup( // prepare tile tasks for the second pass based on the previous one(s) public CLTPass3d refinePassSetup( // prepare tile tasks for the second pass based on the previous one(s)
// final double [][][] image_data, // first index - number of image in a quad
CLTParameters clt_parameters, CLTParameters clt_parameters,
// disparity range - differences from
boolean use_supertiles, // false (2018) boolean use_supertiles, // false (2018)
int bg_scan_index, // 0 int bg_scan_index, // 0
double disparity_far, // 0.3 double disparity_far, // 0.3
......
...@@ -27,12 +27,12 @@ import java.io.IOException; ...@@ -27,12 +27,12 @@ import java.io.IOException;
*/ */
import java.util.ArrayList; import java.util.ArrayList;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import com.elphel.imagej.cameras.CLTParameters; import com.elphel.imagej.cameras.CLTParameters;
import com.elphel.imagej.cameras.EyesisCorrectionParameters; import com.elphel.imagej.cameras.EyesisCorrectionParameters;
import com.elphel.imagej.cameras.EyesisCorrectionParameters.CorrectionParameters;
import com.elphel.imagej.tileprocessor.CLTPass3d; import com.elphel.imagej.tileprocessor.CLTPass3d;
import com.elphel.imagej.tileprocessor.GeometryCorrection; import com.elphel.imagej.tileprocessor.GeometryCorrection;
......
...@@ -46,7 +46,6 @@ import org.w3c.dom.Element; ...@@ -46,7 +46,6 @@ import org.w3c.dom.Element;
import com.elphel.imagej.cameras.CLTParameters; import com.elphel.imagej.cameras.CLTParameters;
import com.elphel.imagej.cameras.EyesisCorrectionParameters; import com.elphel.imagej.cameras.EyesisCorrectionParameters;
import com.elphel.imagej.cameras.EyesisCorrectionParameters.CorrectionParameters;
import com.elphel.imagej.tileprocessor.CLTPass3d; import com.elphel.imagej.tileprocessor.CLTPass3d;
import com.elphel.imagej.tileprocessor.GeometryCorrection; import com.elphel.imagej.tileprocessor.GeometryCorrection;
......
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