Commit 9c02927a authored by Andrey Filippov's avatar Andrey Filippov

refactoring, fighting small bugs

parent 204eba2c
...@@ -650,6 +650,9 @@ public class BiScan { ...@@ -650,6 +650,9 @@ public class BiScan {
double [] smpl_w = new double [smpl_len]; double [] smpl_w = new double [smpl_len];
double [] smpl_w_narrow = new double [smpl_len]; double [] smpl_w_narrow = new double [smpl_len];
double [] smpl_p = new double [smpl_len]; // plane disparity, double [] smpl_p = new double [smpl_len]; // plane disparity,
double [] smpl_wsw= smpl_w_narrow;
double [][] weights_sw = weights_narrow;
int nall = 0; int nall = 0;
double sw = 0, swd = 0; double sw = 0, swd = 0;
for (int dy = -smpl_radius; dy <= smpl_radius; dy++) { for (int dy = -smpl_radius; dy <= smpl_radius; dy++) {
...@@ -796,6 +799,8 @@ public class BiScan { ...@@ -796,6 +799,8 @@ public class BiScan {
fourq_min, // int fourq_min, // each of the 4 corners should have at least this number of tiles. fourq_min, // int fourq_min, // each of the 4 corners should have at least this number of tiles.
fourq_corner, // int [] fourq_corner, // array specifying corner number (0..3), -1 - gap. null when not used fourq_corner, // int [] fourq_corner, // array specifying corner number (0..3), -1 - gap. null when not used
debugLevel); // int debugLevel) debugLevel); // int debugLevel)
smpl_wsw = smpl_w;
weights_sw = weights;
// if ( (fit_rslt == null) || (fit_rslt[0] > (smpl_arms + smpl_rrms * fit_rslt[1]))){ // if ( (fit_rslt == null) || (fit_rslt[0] > (smpl_arms + smpl_rrms * fit_rslt[1]))){
if ( (fit_rslt == null) || (fit_rslt[0] > max_rms)){ if ( (fit_rslt == null) || (fit_rslt[0] > max_rms)){
continue; // narrow selection - too high rms continue; // narrow selection - too high rms
...@@ -845,17 +850,18 @@ public class BiScan { ...@@ -845,17 +850,18 @@ public class BiScan {
for (int dx = -smpl_radius; dx <= smpl_radius; dx++) { // if ((dx != 0) || (dy != 0)){ for (int dx = -smpl_radius; dx <= smpl_radius; dx++) { // if ((dx != 0) || (dy != 0)){
int adx = (dx > 0)? dx:(-dx); int adx = (dx > 0)? dx:(-dx);
int smpl_indx = smpl_center + dy*smpl_side + dx; int smpl_indx = smpl_center + dy*smpl_side + dx;
if (smpl_w[smpl_indx] > 0.0) { if (smpl_wsw[smpl_indx] > 0.0) { // either smpl_w_narrow or smpl_w
s0+= weights[ady][adx]; s0+= weights_sw[ady][adx];
s1+= weights[ady][adx] * smpl_w[smpl_indx]; // s1+= weights[ady][adx] * smpl_w[smpl_indx];
s1+= smpl_wsw[smpl_indx]; // already was multiplied by weights[ady][adx]
} }
} }
} }
//boost_low_density, // false weight of low density tiles is reduced, true - boosted //boost_low_density, // false weight of low density tiles is reduced, true - boosted
double w = s1; double w = s1/s0;
if (boost_low_density > 0.0) { // if (boost_low_density > 0.0) {
w/= Math.pow(s0, boost_low_density); // w/= Math.pow(s0, boost_low_density);
} // }
if (strength_pow != 1.0) { if (strength_pow != 1.0) {
w = Math.pow(w, 1.0 / strength_pow); w = Math.pow(w, 1.0 / strength_pow);
} }
...@@ -865,6 +871,11 @@ public class BiScan { ...@@ -865,6 +871,11 @@ public class BiScan {
System.out.println("suggestNewScan(): nTile="+nTile+" w="+w); System.out.println("suggestNewScan(): nTile="+nTile+" w="+w);
System.out.println("suggestNewScan(): nTile="+nTile+" w="+w); System.out.println("suggestNewScan(): nTile="+nTile+" w="+w);
} }
if (nTile == 66945) {
System.out.println("suggestNewScan(): nTile="+nTile+" w="+w);
System.out.println("suggestNewScan(): nTile="+nTile+" w="+w);
}
} }
} }
} }
...@@ -2206,7 +2217,17 @@ public class BiScan { ...@@ -2206,7 +2217,17 @@ public class BiScan {
double [][] ds = {disparity,strength}; // strength may be null double [][] ds = {disparity,strength}; // strength may be null
return ds; return ds;
} }
/**
* Extend low texture areas horizontally if both ends are OK: either belong to the low texture areas selection (lt_sel)
* or are trusted and closer or the same (to the provided tolerance)
* @param tolerance strong limit should not have disparity lower by more than tolerance than low textured area
* @param ds_lt disparity/strength for the low textured area
* @param d_single disparity measured for the single-tile correlation
* @param lt_sel low -textured selection
* @param exp_sel expanded selection (does not intersect with lt_sel
* @param trusted trusted tiles selection
* @return extended disparity/strength data
*/
public double [][] getLTExpanded( public double [][] getLTExpanded(
final double tolerance, final double tolerance,
final double [][] ds_lt, final double [][] ds_lt,
......
This diff is collapsed.
...@@ -94,7 +94,8 @@ public class PoleProcessorParameters { ...@@ -94,7 +94,8 @@ public class PoleProcessorParameters {
public void dialogQuestions(GenericJTabbedDialog gd) { public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addCheckbox ("Enable poles detection and usage", this.poles_en,"Enable poles detection and usege to improve DSI"); gd.addCheckbox ("Enable poles detection and usage", this.poles_en,
"Run automatically when creating ground truth data. If disable you may run it with \"Poles GT\" command button");
gd.addMessage("Creating initial pole seeds (tops need to be detected and available in the available DSI"); gd.addMessage("Creating initial pole seeds (tops need to be detected and available in the available DSI");
gd.addNumericField("Pole relative (to trusted tiles strength) to qualify for the pole seed", this.seed_rsrength, 3,6,"", gd.addNumericField("Pole relative (to trusted tiles strength) to qualify for the pole seed", this.seed_rsrength, 3,6,"",
"Pole top seed relative strength (fraction of the strong trusted value that may change with correlation fat zero or other parameters"); "Pole top seed relative strength (fraction of the strong trusted value that may change with correlation fat zero or other parameters");
......
...@@ -32,6 +32,11 @@ import java.util.concurrent.atomic.AtomicInteger; ...@@ -32,6 +32,11 @@ import java.util.concurrent.atomic.AtomicInteger;
public class TileProcessor { public class TileProcessor {
public ArrayList <CLTPass3d> clt_3d_passes = null; public ArrayList <CLTPass3d> clt_3d_passes = null;
public double [][] rig_disparity_strength = null; // Disparity and strength created by a two-camera rig, with disparity scale and distortions of the main camera public double [][] rig_disparity_strength = null; // Disparity and strength created by a two-camera rig, with disparity scale and distortions of the main camera
public double [][] rig_pre_poles_ds = null; // Rig disparity and strength before processing poles
public double [][] rig_post_poles_ds = null; // Rig disparity and strength after processing poles
public boolean [] rig_pre_poles_sel = null; // Rig tile selection before processing poles
public boolean [] rig_post_poles_sel = null; // Rig tile selection after processing poles
public int clt_3d_passes_size = 0; //clt_3d_passes size after initial processing public int clt_3d_passes_size = 0; //clt_3d_passes size after initial processing
public int clt_3d_passes_rig_size = 0; //clt_3d_passes size after initial processing and rig processing public int clt_3d_passes_rig_size = 0; //clt_3d_passes size after initial processing and rig processing
private int tilesX; private int tilesX;
...@@ -114,6 +119,11 @@ public class TileProcessor { ...@@ -114,6 +119,11 @@ public class TileProcessor {
if (rig) clt_3d_passes_rig_size = clt_3d_passes.size(); if (rig) clt_3d_passes_rig_size = clt_3d_passes.size();
else { else {
rig_disparity_strength = null; // invalidate rig_disparity_strength = null; // invalidate
rig_pre_poles_ds = null;
rig_post_poles_ds = null;
rig_pre_poles_sel = null;
rig_post_poles_sel = null;
clt_3d_passes_rig_size = 0; clt_3d_passes_rig_size = 0;
clt_3d_passes_size = clt_3d_passes.size(); clt_3d_passes_size = clt_3d_passes.size();
} }
...@@ -122,6 +132,10 @@ public class TileProcessor { ...@@ -122,6 +132,10 @@ public class TileProcessor {
public void trimCLTPasses(int keep){ public void trimCLTPasses(int keep){
if (keep < clt_3d_passes_size) { // keep rig data if only rig scan is removed if (keep < clt_3d_passes_size) { // keep rig data if only rig scan is removed
rig_disparity_strength = null; // invalidate rig_disparity_strength = null; // invalidate
rig_pre_poles_ds = null;
rig_post_poles_ds = null;
rig_pre_poles_sel = null;
rig_post_poles_sel = null;
clt_3d_passes_rig_size = 0; clt_3d_passes_rig_size = 0;
} }
clt_3d_passes_size = keep; clt_3d_passes_size = keep;
...@@ -162,6 +176,11 @@ public class TileProcessor { ...@@ -162,6 +176,11 @@ public class TileProcessor {
} }
// just in case - invalidate (should be done anyway) // just in case - invalidate (should be done anyway)
rig_disparity_strength = null; // invalidate rig_disparity_strength = null; // invalidate
rig_pre_poles_ds = null;
rig_post_poles_ds = null;
rig_pre_poles_sel = null;
rig_post_poles_sel = null;
clt_3d_passes_rig_size = 0; clt_3d_passes_rig_size = 0;
} }
......
This diff is collapsed.
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