Commit 89dfef44 authored by Andrey Filippov's avatar Andrey Filippov

second expand pass, over possible background

parent 88e3bc5d
...@@ -274,10 +274,10 @@ public class DisparityProcessor { ...@@ -274,10 +274,10 @@ public class DisparityProcessor {
{ {
final int dbg_tile = -1; // 28643; // x=131, y=88 final int dbg_tile = -1; // 28643; // x=131, y=88
showDoubleFloatArrays sdfa_instance = null; showDoubleFloatArrays sdfa_instance = null;
if (debugLevel > -1) sdfa_instance = new showDoubleFloatArrays(); // just for debugging? if (debugLevel > 0) sdfa_instance = new showDoubleFloatArrays(); // just for debugging?
final Thread[] threads = ImageDtt.newThreadArray(threadsMax); final Thread[] threads = ImageDtt.newThreadArray(threadsMax);
final int numThreads = threads.length; final int numThreads = threads.length;
if (debugLevel > -1) System.out.println("smoothDisparity(): using "+numThreads+" threads"); if (debugLevel > 0) System.out.println("smoothDisparity(): using "+numThreads+" threads");
final int len = disparity.length; final int len = disparity.length;
int numBorder = 0, numInternal = 0; int numBorder = 0, numInternal = 0;
for (int i = 0; i < len; i++){ for (int i = 0; i < len; i++){
...@@ -428,7 +428,7 @@ public class DisparityProcessor { ...@@ -428,7 +428,7 @@ public class DisparityProcessor {
double diff = 0.0; double diff = 0.0;
for (int i = 0; (i < numThreads) && (diff <= maxDiff) ; i++) if (diff < rslt_diffs[i]) diff = rslt_diffs[i]; for (int i = 0; (i < numThreads) && (diff <= maxDiff) ; i++) if (diff < rslt_diffs[i]) diff = rslt_diffs[i];
if (diff <= maxDiff) { if (diff <= maxDiff) {
if (debugLevel > -1) System.out.println("smoothDisparity(): pass = "+pass+", diff = "+diff+" <= "+maxDiff); if (debugLevel > 0) System.out.println("smoothDisparity(): pass = "+pass+", diff = "+diff+" <= "+maxDiff);
break; break;
} }
} }
......
...@@ -339,6 +339,9 @@ public class LinkPlanes { ...@@ -339,6 +339,9 @@ public class LinkPlanes {
true, // boolean sum_weights, true, // boolean sum_weights,
plPreferDisparity, plPreferDisparity,
debugLevel - 2); // int debugLevel) debugLevel - 2); // int debugLevel)
if (merged_pd == null){
return false;
}
// merged_ev = merged_pd.getValue(); // merged_ev = merged_pd.getValue();
merged_ev = merged_pd.getNormValue(); merged_ev = merged_pd.getNormValue();
merged_wev = merged_pd.getWValue(); merged_wev = merged_pd.getWValue();
...@@ -352,6 +355,10 @@ public class LinkPlanes { ...@@ -352,6 +355,10 @@ public class LinkPlanes {
true, // boolean sum_weights, true, // boolean sum_weights,
plPreferDisparity, plPreferDisparity,
debugLevel - 2); // int debugLevel) debugLevel - 2); // int debugLevel)
if (merged_pd_eq == null){
return false;
}
// merged_ev_eq = merged_pd_eq.getValue(); // merged_ev_eq = merged_pd_eq.getValue();
merged_ev_eq = merged_pd_eq.getNormValue(); merged_ev_eq = merged_pd_eq.getNormValue();
merged_wev_eq = merged_pd_eq.getWValue(); merged_wev_eq = merged_pd_eq.getWValue();
......
...@@ -5702,7 +5702,7 @@ public class QuadCLT { ...@@ -5702,7 +5702,7 @@ public class QuadCLT {
final boolean updateStatus, final boolean updateStatus,
final int debugLevel) final int debugLevel)
{ {
final int max_expand = 100; // 30; final int max_expand = 300; // 150; // 30;
// Temporary assign here // Temporary assign here
final int disp_index = ImageDtt.DISPARITY_INDEX_CM; final int disp_index = ImageDtt.DISPARITY_INDEX_CM;
final int str_index = ImageDtt.DISPARITY_STRENGTH_INDEX; final int str_index = ImageDtt.DISPARITY_STRENGTH_INDEX;
...@@ -5901,6 +5901,7 @@ public class QuadCLT { ...@@ -5901,6 +5901,7 @@ public class QuadCLT {
image_data, // first index - number of image in a quad image_data, // first index - number of image in a quad
clt_parameters, clt_parameters,
refine_pass, refine_pass,
true, // final boolean save_textures,
threadsMax, // maximal number of threads to launch threadsMax, // maximal number of threads to launch
updateStatus, updateStatus,
debugLevel); debugLevel);
...@@ -5946,6 +5947,7 @@ public class QuadCLT { ...@@ -5946,6 +5947,7 @@ public class QuadCLT {
// process once more to try combining of processed // process once more to try combining of processed
boolean last_pass = false; boolean last_pass = false;
// for (int num_expand = 0; (num_expand < 4) && (num_extended != 0); num_expand++) { // for (int num_expand = 0; (num_expand < 4) && (num_extended != 0); num_expand++) {
boolean over_infinity = false;
for (int num_expand = 0; num_expand < max_expand; num_expand++) { for (int num_expand = 0; num_expand < max_expand; num_expand++) {
Runtime runtime = Runtime.getRuntime(); Runtime runtime = Runtime.getRuntime();
...@@ -6078,7 +6080,7 @@ public class QuadCLT { ...@@ -6078,7 +6080,7 @@ public class QuadCLT {
num_extended = tp.setupExtendDisparity( num_extended = tp.setupExtendDisparity(
extended_pass, // final CLTPass3d scan, // combined scan with max_tried_disparity, will be modified to re-scan extended_pass, // final CLTPass3d scan, // combined scan with max_tried_disparity, will be modified to re-scan
tp.clt_3d_passes.get(refine_pass), // final CLTPass3d last_scan, // last prepared tile - can use last_scan.disparity, .border_tiles and .selected tp.clt_3d_passes.get(refine_pass), // final CLTPass3d last_scan, // last prepared tile - can use last_scan.disparity, .border_tiles and .selected
tp.clt_3d_passes.get(bg_pass), // final CLTPass3d bg_scan, // background scan data over_infinity? null: tp.clt_3d_passes.get(bg_pass), // final CLTPass3d bg_scan, // background scan data
clt_parameters.grow_sweep, // 8; // Try these number of tiles around known ones clt_parameters.grow_sweep, // 8; // Try these number of tiles around known ones
clt_parameters.grow_disp_max, // = 50.0; // Maximal disparity to try clt_parameters.grow_disp_max, // = 50.0; // Maximal disparity to try
0.5 * clt_parameters.grow_disp_trust, // = 4.0; // Trust measured disparity within +/- this value 0.5 * clt_parameters.grow_disp_trust, // = 4.0; // Trust measured disparity within +/- this value
...@@ -6127,6 +6129,7 @@ public class QuadCLT { ...@@ -6127,6 +6129,7 @@ public class QuadCLT {
image_data, // first index - number of image in a quad image_data, // first index - number of image in a quad
clt_parameters, clt_parameters,
refine_pass, refine_pass,
false, // final boolean save_textures,
threadsMax, // maximal number of threads to launch threadsMax, // maximal number of threads to launch
updateStatus, updateStatus,
debugLevel); debugLevel);
...@@ -6177,7 +6180,8 @@ public class QuadCLT { ...@@ -6177,7 +6180,8 @@ public class QuadCLT {
if (last_pass) { if (last_pass) {
break; break;
} else if (numLeftRemoved[0] == 0){ } else if (numLeftRemoved[0] == 0){
last_pass = true; if (over_infinity) last_pass = true;
else over_infinity = true;
} }
} }
...@@ -6241,6 +6245,7 @@ public class QuadCLT { ...@@ -6241,6 +6245,7 @@ public class QuadCLT {
image_data, // first index - number of image in a quad image_data, // first index - number of image in a quad
clt_parameters, clt_parameters,
scanIndex, scanIndex,
true, // final boolean save_textures,
threadsMax, // maximal number of threads to launch threadsMax, // maximal number of threads to launch
updateStatus, updateStatus,
debugLevel); debugLevel);
...@@ -6404,6 +6409,7 @@ public class QuadCLT { ...@@ -6404,6 +6409,7 @@ public class QuadCLT {
image_data, // first index - number of image in a quad image_data, // first index - number of image in a quad
clt_parameters, clt_parameters,
scanIndex, scanIndex,
true, // final boolean save_textures,
threadsMax, // maximal number of threads to launch threadsMax, // maximal number of threads to launch
updateStatus, updateStatus,
debugLevel); debugLevel);
...@@ -7077,6 +7083,7 @@ public class QuadCLT { ...@@ -7077,6 +7083,7 @@ public class QuadCLT {
final double [][][] image_data, // first index - number of image in a quad final double [][][] image_data, // first index - number of image in a quad
EyesisCorrectionParameters.CLTParameters clt_parameters, EyesisCorrectionParameters.CLTParameters clt_parameters,
final int scanIndex, final int scanIndex,
final boolean save_textures,
final int threadsMax, // maximal number of threads to launch final int threadsMax, // maximal number of threads to launch
final boolean updateStatus, final boolean updateStatus,
final int debugLevel) final int debugLevel)
...@@ -7107,7 +7114,7 @@ public class QuadCLT { ...@@ -7107,7 +7114,7 @@ public class QuadCLT {
{clt_parameters.fine_corr_x_2,clt_parameters.fine_corr_y_2}, {clt_parameters.fine_corr_x_2,clt_parameters.fine_corr_y_2},
{clt_parameters.fine_corr_x_3,clt_parameters.fine_corr_y_3}}; {clt_parameters.fine_corr_x_3,clt_parameters.fine_corr_y_3}};
double [][][][] texture_tiles = new double [tilesY][tilesX][][]; // ["RGBA".length()][]; double [][][][] texture_tiles = save_textures ? new double [tilesY][tilesX][][] : null; // ["RGBA".length()][];
ImageDtt image_dtt = new ImageDtt(); ImageDtt image_dtt = new ImageDtt();
image_dtt.clt_aberrations_quad_corr( image_dtt.clt_aberrations_quad_corr(
tile_op, // per-tile operation bit codes tile_op, // per-tile operation bit codes
......
...@@ -2315,6 +2315,10 @@ public class SuperTiles{ ...@@ -2315,6 +2315,10 @@ public class SuperTiles{
dl-2); // int debugLevel) dl-2); // int debugLevel)
// combine tile selection - if next time pd0.reDiscriminateTiles() will fail, it will // combine tile selection - if next time pd0.reDiscriminateTiles() will fail, it will
// use old selections, we need to provide them (otherwise will use selection from the first plane) // use old selections, we need to provide them (otherwise will use selection from the first plane)
if (plane1 == null){
System.out.println("refineDiscriminateTiles() nsTile="+nsTile+" plane1 = null");
break;
}
plane1.orMeasSelection(these_planes[merge_planes[1]].getMeasSelection()); plane1.orMeasSelection(these_planes[merge_planes[1]].getMeasSelection());
// separately merge corresponding nonexclusiveStar and nonexclusiveStarEq of these planes - kit is not exact, // separately merge corresponding nonexclusiveStar and nonexclusiveStarEq of these planes - kit is not exact,
......
...@@ -1071,7 +1071,7 @@ public class TileProcessor { ...@@ -1071,7 +1071,7 @@ public class TileProcessor {
public int setupExtendDisparity( // returns number of new tiles to try public int setupExtendDisparity( // returns number of new tiles to try
final CLTPass3d scan, // combined scan with max_tried_disparity, will be modified to re-scan final CLTPass3d scan, // combined scan with max_tried_disparity, will be modified to re-scan
final CLTPass3d last_scan, // last prepared tile - can use last_scan.disparity, .border_tiles and .selected final CLTPass3d last_scan, // last prepared tile - can use last_scan.disparity, .border_tiles and .selected
final CLTPass3d bg_scan, // background scan data final CLTPass3d bg_scan, // background scan data, null - ignore background
final int grow_sweep, // 8; // Try these number of tiles around known ones final int grow_sweep, // 8; // Try these number of tiles around known ones
final double grow_disp_max, // = 50.0; // Maximal disparity to try final double grow_disp_max, // = 50.0; // Maximal disparity to try
final double tried_margin, // = 4.0; // consider already tried if within this margin from already tried final double tried_margin, // = 4.0; // consider already tried if within this margin from already tried
...@@ -1089,7 +1089,7 @@ public class TileProcessor { ...@@ -1089,7 +1089,7 @@ public class TileProcessor {
final boolean updateStatus, final boolean updateStatus,
final int debugLevel) final int debugLevel)
{ {
final int dbg_tile = 39379; // 54627; // ty=159, tx = 249 final int dbg_tile = -1; // 39379; // 54627; // ty=159, tx = 249
final int tlen = tilesY * tilesX; final int tlen = tilesY * tilesX;
final boolean retryTwoSteps = true; // false; // true; final boolean retryTwoSteps = true; // false; // true;
...@@ -1109,8 +1109,10 @@ public class TileProcessor { ...@@ -1109,8 +1109,10 @@ public class TileProcessor {
boolean [] known_tiles = these_no_border.clone(); boolean [] known_tiles = these_no_border.clone();
// known are background or these tiles // known are background or these tiles
for (int i = 0; i < known_tiles.length; i++) { if (bg_scan != null) {
known_tiles[i] |= bg_scan.selected[i]; for (int i = 0; i < known_tiles.length; i++) {
known_tiles[i] |= bg_scan.selected[i];
}
} }
// set combo disparity from last prepared // set combo disparity from last prepared
for (int nt = 0; nt < known_tiles.length; nt++){ for (int nt = 0; nt < known_tiles.length; nt++){
...@@ -1136,7 +1138,7 @@ public class TileProcessor { ...@@ -1136,7 +1138,7 @@ public class TileProcessor {
debugLevel); // final int debugLevel) debugLevel); // final int debugLevel)
} }
if (!grow_retry_inf){ if (!grow_retry_inf && (bg_scan == null)){
for (int i = 0; i < untested_bgnd.length; i++) if (bg_scan.selected[i]) untested_bgnd[i] = false; for (int i = 0; i < untested_bgnd.length; i++) if (bg_scan.selected[i]) untested_bgnd[i] = false;
} }
// turn these tiles as if they are not known (really known or belong to bgnd) // turn these tiles as if they are not known (really known or belong to bgnd)
...@@ -1333,7 +1335,7 @@ public class TileProcessor { ...@@ -1333,7 +1335,7 @@ public class TileProcessor {
dbg_img[0][i] = scan.max_tried_disparity[ty][tx]; dbg_img[0][i] = scan.max_tried_disparity[ty][tx];
dbg_img[2][i] = scan.disparity[ty][tx]; dbg_img[2][i] = scan.disparity[ty][tx];
dbg_img[3][i] = strength[i]; dbg_img[3][i] = strength[i];
dbg_img[4][i] = ((bg_scan.selected != null) && (bg_scan.selected[i]))? boolean_val:0.0 ; if (bg_scan != null) dbg_img[4][i] = ((bg_scan.selected != null) && (bg_scan.selected[i]))? boolean_val:0.0 ;
dbg_img[5][i] = ((last_scan.selected != null) && (last_scan.selected[i]))? boolean_val:0.0 ; dbg_img[5][i] = ((last_scan.selected != null) && (last_scan.selected[i]))? boolean_val:0.0 ;
dbg_img[6][i] = 0.05 * (dbg_img[4][i] + dbg_img[5][i]); dbg_img[6][i] = 0.05 * (dbg_img[4][i] + dbg_img[5][i]);
dbg_img[7][i] = (scan.selected[i]?4:0)+ (scan.border_tiles[i]?8:0); dbg_img[7][i] = (scan.selected[i]?4:0)+ (scan.border_tiles[i]?8: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