Commit cb607a02 authored by Andrey Filippov's avatar Andrey Filippov

prepared ers data for fitting

parent 2d7ac7b8
...@@ -708,6 +708,8 @@ private Panel panel1, ...@@ -708,6 +708,8 @@ private Panel panel1,
addButton("LWIR_TEST", panelClt_GPU, color_conf_process); addButton("LWIR_TEST", panelClt_GPU, color_conf_process);
addButton("LWIR_ACQUIRE", panelClt_GPU, color_conf_process); addButton("LWIR_ACQUIRE", panelClt_GPU, color_conf_process);
addButton("IMU main", panelClt_GPU, color_conf_process);
addButton("IMU aux", panelClt_GPU, color_conf_process_aux);
plugInFrame.add(panelClt_GPU); plugInFrame.add(panelClt_GPU);
} }
...@@ -4955,6 +4957,12 @@ private Panel panel1, ...@@ -4955,6 +4957,12 @@ private Panel panel1,
QuadCLT dbg_QUAD_CLT_AUX = QUAD_CLT_AUX; QuadCLT dbg_QUAD_CLT_AUX = QUAD_CLT_AUX;
return; return;
/* ======================================================================== */
} else if (label.equals("IMU main")) {
editIMU(false);
/* ======================================================================== */
} else if (label.equals("IMU aux")) {
editIMU(true);
/* ======================================================================== */ /* ======================================================================== */
} else if (label.equals("LIST extrinsics")) { } else if (label.equals("LIST extrinsics")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL; DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
...@@ -5145,6 +5153,38 @@ private Panel panel1, ...@@ -5145,6 +5153,38 @@ private Panel panel1,
} }
} }
/* ======================================================================== */ /* ======================================================================== */
public boolean editIMU(boolean aux) {
if (aux) {
if (QUAD_CLT_AUX == null){
if (EYESIS_CORRECTIONS_AUX == null) {
EYESIS_CORRECTIONS_AUX = new EyesisCorrections(SYNC_COMMAND.stopRequested,CORRECTION_PARAMETERS.getAux());
}
QUAD_CLT_AUX = new QuadCLT (
QuadCLT.PREFIX_AUX,
PROPERTIES,
EYESIS_CORRECTIONS_AUX,
CORRECTION_PARAMETERS.getAux());
if (DEBUG_LEVEL > 0){
System.out.println("Created new QuadCLT instance, will need to read CLT kernels for aux camera");
}
}
return QUAD_CLT_AUX.editExtrinsicCorr();
} else {
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");
}
}
return QUAD_CLT.editExtrinsicCorr();
}
}
public boolean mainToAux(boolean use_img) { public boolean mainToAux(boolean use_img) {
if (QUAD_CLT == null){ if (QUAD_CLT == null){
......
...@@ -1519,6 +1519,12 @@ public class Corr2dLMA { ...@@ -1519,6 +1519,12 @@ public class Corr2dLMA {
return stats; return stats;
} }
public double [] getStats(int num_good_tiles){
double [] stats = {total_weight/num_good_tiles, 1.0*total_tiles/num_good_tiles, last_rms[0]};
return stats;
}
//
public void getDdNd(double [][] ddnd){ // this.all_pars should be current public void getDdNd(double [][] ddnd){ // this.all_pars should be current
if (ddnd != null) { if (ddnd != null) {
......
...@@ -99,6 +99,7 @@ public class ImageDttParameters { ...@@ -99,6 +99,7 @@ public class ImageDttParameters {
public double corr_wndx_blur = 5.0; // 100% to 0 % vertical transition range public double corr_wndx_blur = 5.0; // 100% to 0 % vertical transition range
// LMA parameters // LMA parameters
public double lma_disp_range = 2.0; // disparity range to combine in one cluster (to mitigate ERS
// LMA single parameters // LMA single parameters
public boolean lmas_gaussian = false; // model correlation maximum as a Gaussian (false - as a parabola) public boolean lmas_gaussian = false; // model correlation maximum as a Gaussian (false - as a parabola)
public boolean lmas_adjust_wm = true; // used in new for width public boolean lmas_adjust_wm = true; // used in new for width
...@@ -312,6 +313,9 @@ public class ImageDttParameters { ...@@ -312,6 +313,9 @@ public class ImageDttParameters {
"Transition range, shifted sine is used"); "Transition range, shifted sine is used");
gd.addTab("Corr LMA","Parameters for LMA fitting of the correlation maximum parameters"); gd.addTab("Corr LMA","Parameters for LMA fitting of the correlation maximum parameters");
gd.addNumericField("Cluster disparity range", this.lma_disp_range, 3, 6, "pix",
"Disparity range to combine in one cluster (to mitigate ERS");
gd.addMessage("Single-tile (no lazy eye) only parameters (some are common"); gd.addMessage("Single-tile (no lazy eye) only parameters (some are common");
gd.addCheckbox ("Correlation maximum as gaussian", this.lmas_gaussian, gd.addCheckbox ("Correlation maximum as gaussian", this.lmas_gaussian,
...@@ -533,6 +537,7 @@ public class ImageDttParameters { ...@@ -533,6 +537,7 @@ public class ImageDttParameters {
this.corr_wndx_blur = gd.getNextNumber(); this.corr_wndx_blur = gd.getNextNumber();
//LMA tab //LMA tab
this.lma_disp_range = gd.getNextNumber();
this.lmas_gaussian= gd.getNextBoolean(); this.lmas_gaussian= gd.getNextBoolean();
this.lmas_adjust_wm= gd.getNextBoolean(); this.lmas_adjust_wm= gd.getNextBoolean();
this.lmas_adjust_wy= gd.getNextBoolean(); this.lmas_adjust_wy= gd.getNextBoolean();
...@@ -669,6 +674,8 @@ public class ImageDttParameters { ...@@ -669,6 +674,8 @@ public class ImageDttParameters {
properties.setProperty(prefix+"corr_wndx_hwidth", this.corr_wndx_hwidth +""); properties.setProperty(prefix+"corr_wndx_hwidth", this.corr_wndx_hwidth +"");
properties.setProperty(prefix+"corr_wndx_blur", this.corr_wndx_blur +""); properties.setProperty(prefix+"corr_wndx_blur", this.corr_wndx_blur +"");
properties.setProperty(prefix+"lma_disp_range", this.lma_disp_range +"");
properties.setProperty(prefix+"lmas_gaussian", this.lmas_gaussian +""); properties.setProperty(prefix+"lmas_gaussian", this.lmas_gaussian +"");
properties.setProperty(prefix+"lmas_adjust_wm", this.lmas_adjust_wm +""); properties.setProperty(prefix+"lmas_adjust_wm", this.lmas_adjust_wm +"");
properties.setProperty(prefix+"lmas_adjust_wy", this.lmas_adjust_wy +""); properties.setProperty(prefix+"lmas_adjust_wy", this.lmas_adjust_wy +"");
...@@ -811,6 +818,8 @@ public class ImageDttParameters { ...@@ -811,6 +818,8 @@ public class ImageDttParameters {
if (properties.getProperty(prefix+"corr_wndx_hwidth")!=null) this.corr_wndx_hwidth=Double.parseDouble(properties.getProperty(prefix+"corr_wndx_hwidth")); if (properties.getProperty(prefix+"corr_wndx_hwidth")!=null) this.corr_wndx_hwidth=Double.parseDouble(properties.getProperty(prefix+"corr_wndx_hwidth"));
if (properties.getProperty(prefix+"corr_wndx_blur")!=null) this.corr_wndx_blur=Double.parseDouble(properties.getProperty(prefix+"corr_wndx_blur")); if (properties.getProperty(prefix+"corr_wndx_blur")!=null) this.corr_wndx_blur=Double.parseDouble(properties.getProperty(prefix+"corr_wndx_blur"));
if (properties.getProperty(prefix+"lma_disp_range")!=null) this.lma_disp_range=Double.parseDouble(properties.getProperty(prefix+"lma_disp_range"));
if (properties.getProperty(prefix+"lmas_gaussian")!=null) this.lmas_gaussian=Boolean.parseBoolean(properties.getProperty(prefix+"lmas_gaussian")); if (properties.getProperty(prefix+"lmas_gaussian")!=null) this.lmas_gaussian=Boolean.parseBoolean(properties.getProperty(prefix+"lmas_gaussian"));
if (properties.getProperty(prefix+"lmas_adjust_wm")!=null) this.lmas_adjust_wm=Boolean.parseBoolean(properties.getProperty(prefix+"lmas_adjust_wm")); if (properties.getProperty(prefix+"lmas_adjust_wm")!=null) this.lmas_adjust_wm=Boolean.parseBoolean(properties.getProperty(prefix+"lmas_adjust_wm"));
if (properties.getProperty(prefix+"lmas_adjust_wy")!=null) this.lmas_adjust_wy=Boolean.parseBoolean(properties.getProperty(prefix+"lmas_adjust_wy")); if (properties.getProperty(prefix+"lmas_adjust_wy")!=null) this.lmas_adjust_wy=Boolean.parseBoolean(properties.getProperty(prefix+"lmas_adjust_wy"));
...@@ -948,6 +957,7 @@ public class ImageDttParameters { ...@@ -948,6 +957,7 @@ public class ImageDttParameters {
idp.corr_wndx_hwidth = this.corr_wndx_hwidth; idp.corr_wndx_hwidth = this.corr_wndx_hwidth;
idp.corr_wndx_blur = this.corr_wndx_blur; idp.corr_wndx_blur = this.corr_wndx_blur;
idp.lma_disp_range= this.lma_disp_range;
idp.lmas_gaussian = this.lmas_gaussian; idp.lmas_gaussian = this.lmas_gaussian;
idp.lmas_adjust_wm = this.lmas_adjust_wm; idp.lmas_adjust_wm = this.lmas_adjust_wm;
idp.lmas_adjust_wy = this.lmas_adjust_wy; idp.lmas_adjust_wy = this.lmas_adjust_wy;
......
...@@ -4723,7 +4723,8 @@ public class QuadCLT { ...@@ -4723,7 +4723,8 @@ public class QuadCLT {
z_correction +=clt_parameters.z_corr_map.get(name);// not used in lwir z_correction +=clt_parameters.z_corr_map.get(name);// not used in lwir
} }
final double disparity_corr = (z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/z_correction); final double disparity_corr = (z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/z_correction);
double [][][][][][] clt_data = image_dtt.clt_aberrations_quad_corr_min( // double [][][][][][] clt_data = image_dtt.clt_aberrations_quad_corr_min(
double [][] lazy_eye_data = image_dtt.cltMeasureLazyEye(
clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
// 1, // final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles // 1, // final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
tile_op, // per-tile operation bit codes tile_op, // per-tile operation bit codes
...@@ -4780,6 +4781,54 @@ public class QuadCLT { ...@@ -4780,6 +4781,54 @@ public class QuadCLT {
// (clt_parameters.dbg_mode & 256) != 0, // transpose convolve // (clt_parameters.dbg_mode & 256) != 0, // transpose convolve
threadsMax, threadsMax,
debugLevel); debugLevel);
if (lazy_eye_data != null) {
int ns = 0;
for (int n = 0; n < lazy_eye_data.length; n++) {
if (lazy_eye_data[n] != null) {
ns = lazy_eye_data[n].length;
break;
}
}
if (ns > 0) {
String [] titles = new String [ns];
titles [0] = "disparity";
titles [1] = "strength";
for (int i = 0; i < (ns - 2)/2; i++) {
titles [2*i + 2] = "dx-"+i;
titles [2*i + 3] = "dy-"+i;
}
int clustersX= (tilesX + clt_parameters.tileStep - 1) / clt_parameters.tileStep;
int clustersY= (tilesY + clt_parameters.tileStep - 1) / clt_parameters.tileStep;
double [][] dbg_cluster = new double [ns][clustersY * clustersX];
for (int n = 0; n < lazy_eye_data.length; n++) {
if ((lazy_eye_data[n] != null) && (lazy_eye_data[n][1] >= clt_parameters.img_dtt.lma_diff_minw)) {
dbg_cluster[0][n] = lazy_eye_data[n][0]; // disparity
dbg_cluster[1][n] = lazy_eye_data[n][1] - clt_parameters.img_dtt.lma_diff_minw; // strength
for (int i = 0; i < (ns - 2)/2; i++) {
dbg_cluster[2 * i + 2][n] = lazy_eye_data[n][2 * i + 2]; // x
dbg_cluster[2 * i + 3][n] = lazy_eye_data[n][2 * i + 3]; // y
}
} else {
dbg_cluster[0][n] = Double.NaN;
dbg_cluster[1][n] = 0.0;
for (int i = 0; i < (ns - 2)/2; i++) {
dbg_cluster[2 * i + 2][n] = Double.NaN; // x
dbg_cluster[2 * i + 3][n] = Double.NaN; // y
}
}
}
//clt_parameters.img_dtt.lma_diff_minw
sdfa_instance.showArrays(
dbg_cluster,
clustersX,
clustersY,
true,
name+sAux()+"-CLT_MISMATCH-D"+clt_parameters.disparity+"_"+clt_parameters.tileStep+"x"+clt_parameters.tileStep,
titles);
}
}
if (disparity_map != null){ if (disparity_map != null){
if (!batch_mode && clt_parameters.show_map && (debugLevel > -2)){ if (!batch_mode && clt_parameters.show_map && (debugLevel > -2)){
sdfa_instance.showArrays( sdfa_instance.showArrays(
...@@ -5435,6 +5484,18 @@ public class QuadCLT { ...@@ -5435,6 +5484,18 @@ public class QuadCLT {
} }
} }
public boolean editExtrinsicCorr() // not used in lwir
{
if (geometryCorrection == null){
System.out.println("are not set, will be:");
return new GeometryCorrection(this.extrinsic_vect).getCorrVector().editIMU();
} else {
return geometryCorrection.getCorrVector().editIMU();
}
}
public boolean editRig() // not used in lwir public boolean editRig() // not used in lwir
{ {
if (!is_aux) { if (!is_aux) {
......
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