Commit c475ffe4 authored by Andrey Filippov's avatar Andrey Filippov

debugging histograms for tilted disparity

parent 3b27965b
This diff is collapsed.
...@@ -90,8 +90,9 @@ public class TilePlanes { ...@@ -90,8 +90,9 @@ public class TilePlanes {
this.sTileXY, this.sTileXY,
this.tileSize, this.tileSize,
this.superTileSize, this.superTileSize,
this.geometryCorrection); this.geometryCorrection,
pd.correctDistortions = this.correctDistortions; this.correctDistortions);
// pd.correctDistortions = this.correctDistortions;
pd.num_points = this.num_points; pd.num_points = this.num_points;
pd.weight = this.weight; pd.weight = this.weight;
if (this.plane_sel != null) pd.plane_sel = this.plane_sel.clone(); if (this.plane_sel != null) pd.plane_sel = this.plane_sel.clone();
...@@ -204,9 +205,11 @@ public class TilePlanes { ...@@ -204,9 +205,11 @@ public class TilePlanes {
int [] sTileXY, int [] sTileXY,
int tileSize, int tileSize,
int superTileSize, int superTileSize,
GeometryCorrection geometryCorrection) GeometryCorrection geometryCorrection,
boolean correctDistortions)
{ {
this.geometryCorrection = geometryCorrection; this.geometryCorrection = geometryCorrection;
this.correctDistortions = correctDistortions;
this.tileSize = tileSize; this.tileSize = tileSize;
this.superTileSize = superTileSize; this.superTileSize = superTileSize;
this.sTileXY = sTileXY.clone(); this.sTileXY = sTileXY.clone();
...@@ -216,10 +219,12 @@ public class TilePlanes { ...@@ -216,10 +219,12 @@ public class TilePlanes {
int [] sTileXY, int [] sTileXY,
int tileSize, int tileSize,
GeometryCorrection geometryCorrection, GeometryCorrection geometryCorrection,
boolean correctDistortions,
MeasuredLayers measuredLayers, MeasuredLayers measuredLayers,
boolean preferDisparity) boolean preferDisparity)
{ {
this.geometryCorrection = geometryCorrection; this.geometryCorrection = geometryCorrection;
this.correctDistortions = correctDistortions;
this.tileSize = tileSize; this.tileSize = tileSize;
this.superTileSize = measuredLayers.getSuperTileSize(); this.superTileSize = measuredLayers.getSuperTileSize();
this.sTileXY = sTileXY.clone(); this.sTileXY = sTileXY.clone();
...@@ -591,7 +596,9 @@ public class TilePlanes { ...@@ -591,7 +596,9 @@ public class TilePlanes {
} }
} }
double n_by_w = normal_row.times(st_xyz).get(0, 0); double n_by_w = normal_row.times(st_xyz).get(0, 0);
System.out.println("st_xyz = {"+st_xyz.get(0, 0)+","+st_xyz.get(1, 0)+","+st_xyz.get(2, 0)+"}"+" ="+n_by_w); if (debugLevel > 1) {
System.out.println("st_xyz = {"+st_xyz.get(0, 0)+","+st_xyz.get(1, 0)+","+st_xyz.get(2, 0)+"}"+" ="+n_by_w);
}
for (int ml = 0; ml < disp_str.length; ml++) if (disp_str[ml] != null){ for (int ml = 0; ml < disp_str.length; ml++) if (disp_str[ml] != null){
for (int dy = 0; dy < stSize2; dy ++ ){ for (int dy = 0; dy < stSize2; dy ++ ){
double y = (dy - stSize + 0.5) * tileSize; double y = (dy - stSize + 0.5) * tileSize;
...@@ -611,8 +618,10 @@ public class TilePlanes { ...@@ -611,8 +618,10 @@ public class TilePlanes {
double n_by_p = normal_row.times(w_xyz).get(0, 0); double n_by_p = normal_row.times(w_xyz).get(0, 0);
double z = st_xyz.get(2, 0)*n_by_p / n_by_w; double z = st_xyz.get(2, 0)*n_by_p / n_by_w;
if (disp_str[ml][1][indx] > 0){ // do not bother with zero-strength if (disp_str[ml][1][indx] > 0){ // do not bother with zero-strength
System.out.println("dy = "+dy+", dx=" + dx+ " {"+w_xyz.get(0, 0)+","+w_xyz.get(1, 0)+","+w_xyz.get(2, 0)+"}"+" z="+z+" n_by_p = "+n_by_p if (debugLevel > 1) {
+" disp = "+disp_str[ml][0][indx]+" px = "+(px_py[0] + x)+" py = "+(px_py[1] + y)); System.out.println("dy = "+dy+", dx=" + dx+ " {"+w_xyz.get(0, 0)+","+w_xyz.get(1, 0)+","+w_xyz.get(2, 0)+"}"+" z="+z+" n_by_p = "+n_by_p
+" disp = "+disp_str[ml][0][indx]+" px = "+(px_py[0] + x)+" py = "+(px_py[1] + y));
}
} }
// convert z to disparity // convert z to disparity
eff_disp_str[ml][0][indx] = geometryCorrection.getDisparityFromZ (-z); eff_disp_str[ml][0][indx] = geometryCorrection.getDisparityFromZ (-z);
...@@ -1972,12 +1981,13 @@ public class TilePlanes { ...@@ -1972,12 +1981,13 @@ public class TilePlanes {
{swz, swx, swy}}}; {swz, swx, swy}}};
return rslt; return rslt;
} }
// TODO: obsolete - remove
public PlaneData getPlane( public PlaneData getPlane(
int [] sTileXY, int [] sTileXY,
double [] data, double [] data,
double [] weight, double [] weight,
boolean [] select, // null OK, will enable all tiles boolean [] select, // null OK, will enable all tiles
boolean correctDistortions,
boolean preferDisparity, // Always start with disparity-most axis (false - lowest eigenvalue) boolean preferDisparity, // Always start with disparity-most axis (false - lowest eigenvalue)
int debugLevel){ int debugLevel){
if (select == null) { if (select == null) {
...@@ -2042,7 +2052,8 @@ public class TilePlanes { ...@@ -2042,7 +2052,8 @@ public class TilePlanes {
sTileXY, sTileXY,
this.tileSize, this.tileSize,
this.stSize, this.stSize,
this.geometryCorrection); this.geometryCorrection,
correctDistortions);
pd.setZxy(szxy); pd.setZxy(szxy);
// pd.setValues(eig_val[oindx][oindx],eig_val[hindx][hindx],eig_val[vindx][vindx]); // eigenvalues [0] - thickness, 2 other to detect skinny (poles) // pd.setValues(eig_val[oindx][oindx],eig_val[hindx][hindx],eig_val[vindx][vindx]); // eigenvalues [0] - thickness, 2 other to detect skinny (poles)
...@@ -2081,6 +2092,7 @@ public class TilePlanes { ...@@ -2081,6 +2092,7 @@ public class TilePlanes {
double [] data, double [] data,
double [] weight, double [] weight,
boolean [] select, // will be modified boolean [] select, // will be modified
boolean correctDistortions,
double targetEigen, // target eigenvalue for primary axis (is disparity-dependent, so is non-constant) double targetEigen, // target eigenvalue for primary axis (is disparity-dependent, so is non-constant)
int maxRemoved, // maximal number of tiles to remove (not a constant) int maxRemoved, // maximal number of tiles to remove (not a constant)
int minLeft, // minimal number of tiles to keep int minLeft, // minimal number of tiles to keep
...@@ -2093,6 +2105,7 @@ public class TilePlanes { ...@@ -2093,6 +2105,7 @@ public class TilePlanes {
data, data,
weight, weight,
select, // null OK select, // null OK
correctDistortions,
preferDisparity, preferDisparity,
debugLevel); debugLevel);
} else if (select != null){ } else if (select != null){
...@@ -2142,6 +2155,7 @@ public class TilePlanes { ...@@ -2142,6 +2155,7 @@ public class TilePlanes {
data, data,
weight, weight,
select, select,
correctDistortions,
preferDisparity, preferDisparity,
debugLevel); debugLevel);
if (pd == null) { if (pd == null) {
......
...@@ -3043,8 +3043,8 @@ public class TileProcessor { ...@@ -3043,8 +3043,8 @@ public class TileProcessor {
// moved here // moved here
if (clt_parameters.dbg_migrate) { if (clt_parameters.dbg_migrate) {
st.processPlanes4( st.processPlanes4(
null, // final boolean [] selected, // or null // null, // final boolean [] selected, // or null
0.3, // final double min_disp, // 0.3, // final double min_disp,
clt_parameters.stMeasSel, // = 1 //Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert clt_parameters.stMeasSel, // = 1 //Select measurements for supertiles : +1 - combo, +2 - quad +4 - hor +8 - vert
clt_parameters.plDispNorm, // = 2.0; // Normalize disparities to the average if above clt_parameters.plDispNorm, // = 2.0; // Normalize disparities to the average if above
clt_parameters.plMinPoints, // = 5; // Minimal number of points for plane detection clt_parameters.plMinPoints, // = 5; // Minimal number of points for plane detection
...@@ -3086,23 +3086,6 @@ public class TileProcessor { ...@@ -3086,23 +3086,6 @@ public class TileProcessor {
0, // -1, // debugLevel, // final int debugLevel) 0, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX, clt_parameters.tileX,
clt_parameters.tileY); clt_parameters.tileY);
/*
st.processPlanes2(
null, // final boolean [] selected, // or null
0.3, // final double min_disp,
false, // final boolean invert_disp, // use 1/disparity
clt_parameters.plDispNorm, // = 2.0; // Normalize disparities to the average if above
clt_parameters.plMinPoints, // = 5; // Minimal number of points for plane detection
clt_parameters.plTargetEigen, // = 0.1; // Remove outliers until main axis eigenvalue (possibly scaled by plDispNorm) gets below
clt_parameters.plFractOutliers, // = 0.3; // Maximal fraction of outliers to remove
clt_parameters.plMaxOutliers, // = 20; // Maximal number of outliers to remove\
clt_parameters.plPreferDisparity,
geometryCorrection,
clt_parameters.correct_distortions,
0, // -1, // debugLevel, // final int debugLevel)
clt_parameters.tileX,
clt_parameters.tileY);
*/
} }
showDoubleFloatArrays sdfa_instance = null; showDoubleFloatArrays sdfa_instance = null;
...@@ -3317,6 +3300,10 @@ public class TileProcessor { ...@@ -3317,6 +3300,10 @@ public class TileProcessor {
plane_data[indx++] = plane_data_nan[i]; plane_data[indx++] = plane_data_nan[i];
} }
plane_data[indx++] = split_lines; plane_data[indx++] = split_lines;
if (indx <2) { // out of bound
System.out.println("BUG: insufficient data");
return;
}
plane_data[indx] = plane_data[indx-2].clone(); // java.lang.ArrayIndexOutOfBoundsException: -1 plane_data[indx] = plane_data[indx-2].clone(); // java.lang.ArrayIndexOutOfBoundsException: -1
for (int i = 0; i < plane_data[indx].length;i++){ for (int i = 0; i < plane_data[indx].length;i++){
if (Double.isNaN(plane_data[indx][i])) plane_data[indx][i] = 0.0; if (Double.isNaN(plane_data[indx][i])) plane_data[indx][i] = 0.0;
......
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