Commit cee97f1b authored by Andrey Filippov's avatar Andrey Filippov

more debugging planes merging

parent 86cdc8a0
......@@ -515,6 +515,10 @@ public class CLTPass3d{
return weakOutlayers;
}
public SuperTiles getSuperTiles()
{
return this.superTiles;
}
public SuperTiles setSuperTiles(
double step_near,
......
......@@ -1921,7 +1921,7 @@ public class EyesisCorrectionParameters {
public int ishift_x = 0; // debug feature - shift source image by this pixels left
public int ishift_y = 0; // debug feature - shift source image by this pixels down
public double fat_zero = 0.0; // modify phase correlation to prevent division by very small numbers
public double corr_sigma = 0.8; // LPF correlarion sigma
public double corr_sigma = 0.8; // LPF correlation sigma
public boolean norm_kern = true; // normalize kernels
public boolean gain_equalize = false;// equalize green channel gain
public boolean colors_equalize = true; // equalize R/G, B/G of the individual channels
......@@ -2150,6 +2150,9 @@ public class EyesisCorrectionParameters {
public double plMinStrength = 0.1; // Minimal total strength of a plane
public double plMaxEigen = 0.3; // Maximal eigenvalue of a plane
public boolean plDbgMerge = true; // Combine 'other' plane with current
public double plWorstWorsening = 2.0; // Worst case worsening after merge
public boolean plMutualOnly = true; // keep only mutual links, remove weakest if conflict
// other debug images
public boolean show_ortho_combine = false; // Show 'ortho_combine'
......@@ -2391,6 +2394,8 @@ public class EyesisCorrectionParameters {
properties.setProperty(prefix+"plMinStrength", this.plMinStrength +"");
properties.setProperty(prefix+"plMaxEigen", this.plMaxEigen +"");
properties.setProperty(prefix+"plDbgMerge", this.plDbgMerge+"");
properties.setProperty(prefix+"plWorstWorsening", this.plWorstWorsening +"");
properties.setProperty(prefix+"plMutualOnly", this.plMutualOnly+"");
properties.setProperty(prefix+"show_ortho_combine", this.show_ortho_combine+"");
properties.setProperty(prefix+"show_refine_supertiles", this.show_refine_supertiles+"");
......@@ -2623,6 +2628,8 @@ public class EyesisCorrectionParameters {
if (properties.getProperty(prefix+"plMinStrength")!=null) this.plMinStrength=Double.parseDouble(properties.getProperty(prefix+"plMinStrength"));
if (properties.getProperty(prefix+"plMaxEigen")!=null) this.plMaxEigen=Double.parseDouble(properties.getProperty(prefix+"plMaxEigen"));
if (properties.getProperty(prefix+"plDbgMerge")!=null) this.plDbgMerge=Boolean.parseBoolean(properties.getProperty(prefix+"plDbgMerge"));
if (properties.getProperty(prefix+"plWorstWorsening")!=null) this.plWorstWorsening=Double.parseDouble(properties.getProperty(prefix+"plWorstWorsening"));
if (properties.getProperty(prefix+"plMutualOnly")!=null) this.plMutualOnly=Boolean.parseBoolean(properties.getProperty(prefix+"plMutualOnly"));
if (properties.getProperty(prefix+"show_ortho_combine")!=null) this.show_ortho_combine=Boolean.parseBoolean(properties.getProperty(prefix+"show_ortho_combine"));
if (properties.getProperty(prefix+"show_refine_supertiles")!=null) this.show_refine_supertiles=Boolean.parseBoolean(properties.getProperty(prefix+"show_refine_supertiles"));
......@@ -2877,6 +2884,8 @@ public class EyesisCorrectionParameters {
gd.addNumericField("Minimal total strength of a plane", this.plMinStrength, 6);
gd.addNumericField("Maximal eigenvalue of a plane", this.plMaxEigen, 6);
gd.addCheckbox ("Combine 'other' plane with the current", this.plDbgMerge);
gd.addNumericField("Worst case worsening after merge", this.plWorstWorsening, 6);
gd.addCheckbox ("Keep only mutual links, remove weakest if conflict", this.plMutualOnly);
gd.addMessage ("--- Other debug images ---");
gd.addCheckbox ("Show 'ortho_combine'", this.show_ortho_combine);
......@@ -3118,6 +3127,8 @@ public class EyesisCorrectionParameters {
this.plMinStrength= gd.getNextNumber();
this.plMaxEigen= gd.getNextNumber();
this.plDbgMerge= gd.getNextBoolean();
this.plWorstWorsening= gd.getNextNumber();
this.plMutualOnly= gd.getNextBoolean();
this.show_ortho_combine= gd.getNextBoolean();
this.show_refine_supertiles= gd.getNextBoolean();
......
......@@ -506,6 +506,7 @@ private Panel panel1,
addButton("CLT apply fine corr", panelClt1, color_process);
addButton("CLT reset 3D", panelClt1, color_stop);
addButton("CLT 3D", panelClt1, color_conf_process);
addButton("CLT planes", panelClt1, color_conf_process);
add(panelClt1);
}
......@@ -4764,13 +4765,22 @@ private Panel panel1,
}
return;
} else if (label.equals("CLT planes")) {
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
if (QUAD_CLT == null){
System.out.println("QUAD_CLT is null, nothing to show");
return;
}
//"CLT planes"
QUAD_CLT.showCLTPlanes(
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
THREADS_MAX, //final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, //final boolean updateStatus,
DEBUG_LEVEL); //final int debugLevel);
return;
//
// End of buttons code
}
DEBUG_LEVEL=MASTER_DEBUG_LEVEL;
......
......@@ -4458,6 +4458,30 @@ public class QuadCLT {
return rslt;
}
// public ImagePlus [] cltDisparityScan(
public void showCLTPlanes(
EyesisCorrectionParameters.CLTParameters clt_parameters,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final int debugLevel)
{
if (tp == null){
System.out.println("showCLTPlanes(): tp is null");
return;
}
if (tp.clt_3d_passes == null){
System.out.println("showCLTPlanes(): tp.clt_3d_passes is null");
return;
}
tp.showPlanes(
clt_parameters,
threadsMax,
updateStatus,
debugLevel);
// CLTPass3d last_scan = tp.clt_3d_passes.get(tp.clt_3d_passes.size() -1); // get last one
}
public void processCLTQuads3d(
EyesisCorrectionParameters.CLTParameters clt_parameters,
......@@ -5062,6 +5086,14 @@ public class QuadCLT {
2); // debugLevel);
// get images for predefined regions and disparities. First - with just fixed scans 1 .. list.size()
// TEMPORARY EXIT
if (tp.clt_3d_passes.size() > 0) {
System.out.println("-------- temporary exit after secondPassSetup() ------- ");
return null; // just to fool compiler
}
tp.showScan(
tp.clt_3d_passes.get(next_pass-1), // CLTPass3d scan,
"after_pass2-"+(next_pass-1)); //String title)
......
This diff is collapsed.
......@@ -58,6 +58,14 @@ public class TilePlanes {
double [] world_v2 = null; // world in-plane vector, corresponding to vectors[1]
// double [] daxy = null; // disparity and 2 relative angles (ax and ay) corresponding to fisheye view, near (0,0) scale is pixel size
double [][] neib_match = null; // for each of the directions (N, NE, .. NW) quality match for each layer
int [] neib_best = new int [8]; // for each of the directions (N, NE, .. NW) index of best match, -1 if none
// stores "worsening" of merging 2 planes. if L1,L2,L = values[0] of plane1, plane2 plane composite: w1, w2 - weights for plane1, plane2
// Lav = Math.sqrt((L1 * L1 * w1 + L2 * L2 * w2)/(w1 + w2))
// worsening_12 = (L - Lav) * (w1 + w2) * (w1 + w2) / (Lav * x1 * w2)
int tileSize;
int superTileSize;
int [] sTileXY = null; // X and Y indices of this superTile in the image
......@@ -84,6 +92,15 @@ public class TilePlanes {
pd.vectors[1] = this.vectors[1].clone();
pd.vectors[2] = this.vectors[2].clone();
}
if (this.neib_match != null){
pd.neib_match = this.neib_match.clone();
for (int i = 0; i<this.neib_match.length; i++){
if (this.neib_match[i] != null){
pd.neib_match[i] = this.neib_match[i].clone();
}
}
}
if (this.neib_best != null) pd.neib_best = this.neib_best.clone();
return pd;
}
......@@ -99,6 +116,71 @@ public class TilePlanes {
this.superTileSize = superTileSize;
this.sTileXY = sTileXY.clone();
}
public double [][] initNeibMatch()
{
this.neib_match = new double[8][];
return this.neib_match;
}
public double [][] getNeibMatch()
{
return this.neib_match;
}
public double [] initNeibMatch(int dir, int leng)
{
this.neib_match[dir] = new double[leng];
for (int i = 0; i < leng; i++) this.neib_match[dir][i] = Double.NaN;
return getNeibMatch(dir);
}
public double [] getNeibMatch(int dir)
{
if (this.neib_match == null) {
return null;
}
return this.neib_match[dir];
}
public double getNeibMatch(int dir, int plane)
{
if ((this.neib_match == null) ||(this.neib_match[dir] == null)){
return Double.NaN;
}
return this.neib_match[dir][plane];
}
public void setNeibMatch(int dir, int plane, double value)
{
this.neib_match[dir][plane] = value;
}
public int [] initNeibBest()
{
this.neib_best = new int[8];
for (int i = 0; i < 8; i++) this.neib_best[i] = -1;
return this.neib_best;
}
public int [] getNeibBest()
{
return this.neib_best;
}
public int getNeibBest(int dir)
{
if (this.neib_best == null) {
return -1;
}
return this.neib_best[dir];
}
public void setNeibBest(int dir, int val)
{
this.neib_best[dir] = val;
}
public void setCorrectDistortions(
boolean correctDistortions)
{
......
......@@ -2808,6 +2808,107 @@ public class TileProcessor {
//======================
public void showPlanes(
EyesisCorrectionParameters.CLTParameters clt_parameters,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final int debugLevel)
{
CLTPass3d scan_prev = clt_3d_passes.get(clt_3d_passes.size() -1); // get last one
SuperTiles st = scan_prev.getSuperTiles();
showDoubleFloatArrays sdfa_instance = null;
if (debugLevel > -1) sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
st.matchPlanes(
clt_parameters.tileX,
clt_parameters.tileY);
if (clt_parameters.plMutualOnly) {
st.selectNeighborPlanesMutual(
clt_parameters.plWorstWorsening, // final double worst_worsening,
clt_parameters.plMaxEigen,
clt_parameters.plMinStrength,
0, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
} else {
st.selectNeighborPlanes(
clt_parameters.plWorstWorsening, // final double worst_worsening,
clt_parameters.plMutualOnly, // final boolean mutual_only,
0); // final int debugLevel)
}
if (clt_parameters.show_planes){
int [] wh = st.getShowPlanesWidthHeight();
double [][] plane_data_nonan = st.getShowPlanes(
st.getPlanes(),
clt_parameters.plMinStrength, // minWeight,
clt_parameters.plMaxEigen, // maxEigen,
clt_parameters.plDispNorm,
false, //boolean use_NaN)
0.0,
10.0);
double [][] plane_data_nan = st.getShowPlanes(
st.getPlanes(),
clt_parameters.plMinStrength, // minWeight,
clt_parameters.plMaxEigen, // maxEigen,
clt_parameters.plDispNorm,
true, //boolean use_NaN)
0.0,
10.0);
double [][] plane_data = new double [plane_data_nonan.length + plane_data_nan.length][];
int indx = 0;
for (int i = 0; i < plane_data_nonan.length; i++){
plane_data[indx++] = plane_data_nonan[i];
}
for (int i = 0; i < plane_data_nan.length; i++){
plane_data[indx++] = plane_data_nan[i];
}
// sdfa_instance.showArrays(plane_data_nonan, wh[0], wh[1], true, "plane_data_noNaN");
// sdfa_instance.showArrays(plane_data_nan, wh[0], wh[1], true, "plane_data_NaN");
sdfa_instance.showArrays(plane_data, wh[0], wh[1], true, "plane_data");
// show plane data
/*
for (int dr = 0; dr < 8; dr++){
TilePlanes.PlaneData [][] planes = st.getNeibPlanes(
dr,
clt_parameters.plDbgMerge);
plane_data_nonan = st.getShowPlanes(
planes,
clt_parameters.plMinStrength, // minWeight,
clt_parameters.plMaxEigen, // maxEigen,
clt_parameters.plDispNorm,
false, //boolean use_NaN)
0.0,
10.0);
plane_data_nan = st.getShowPlanes(
planes,
clt_parameters.plMinStrength, // minWeight,
clt_parameters.plMaxEigen, // maxEigen,
clt_parameters.plDispNorm,
true, //boolean use_NaN)
0.0,
10.0);
plane_data = new double [plane_data_nonan.length + plane_data_nan.length][];
indx = 0;
for (int i = 0; i < plane_data_nonan.length; i++){
plane_data[indx++] = plane_data_nonan[i];
}
for (int i = 0; i < plane_data_nan.length; i++){
plane_data[indx++] = plane_data_nan[i];
}
sdfa_instance.showArrays(plane_data, wh[0], wh[1], true, "plane_data_"+dr);
}
*/
}
}
//
public void secondPassSetup( // 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
......@@ -2972,7 +3073,13 @@ public class TileProcessor {
clt_parameters.plMaxOutliers, // = 20; // Maximal number of outliers to remove
geometryCorrection,
clt_parameters.correct_distortions,
debugLevel); // final int debugLevel)
-1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
/*
if (clt_parameters.show_planes){
int [] wh = st.getShowPlanesWidthHeight();
double [][] plane_data_nonan = st.getShowPlanes(
......@@ -3026,6 +3133,10 @@ public class TileProcessor {
sdfa_instance.showArrays(plane_data, wh[0], wh[1], true, "plane_data_"+dr);
}
}
*/
/*
st.processPlanes1(
......@@ -3043,6 +3154,13 @@ public class TileProcessor {
*/
if (debugLevel < 100) {
return; // just temporarily
}
if (use_supertiles) {
scan_prev.getBgDispStrength( // calculate (check non-null)?
clt_parameters.stMinBgDisparity, // final double minBgDisparity,
......
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