"Do not count offenders closer than this to the center tile");
gd.addCheckbox("Only strong trusted far tiles make this FG \"hanging\"",this.pf_strong_only_far,
"When false, any BG tile without this plane strong tiles will trigger trimming, true - only strong trusted tiles");
gd.addNumericField("Number strong trusted far tiles make this FG \"hanging\"",this.pf_num_strong_far,0,3,"",
"Number of strong trusted far tiles to make this plane hanging");
gd.addNumericField("Number weak trusted far tiles make this FG \"hanging\"",this.pf_num_weak_far,0,3,"",
"Number of weak trusted far tiles to make this plane hanging");
gd.addCheckbox("Suggest new disparity over any but confirmed trusted tiles, false - only over empty",this.pf_discard_cond,
"When checked - disregard any conditionally trusted tiles that were not confirmed trusted by neighbors, false - only suggest for yet empty tiles");
gd.addCheckbox("Suggest new disparity over any but strong trusted tiles",this.pf_discard_weak,
"When checked - disregard any weak trusted tiles, even confirmed.Only keep strong ones");
gd.addCheckbox("Suggest new disparity over any tile, even strong trusted",this.pf_discard_strong,
"When checked - try new disparity even for strong tiles");
gd.addNumericField("Minimal diasparity difference between the new suggested and existing one",this.pf_new_diff,4,6,"pix",
"Minimal diasparity (in master camera pixels) difference between the new suggested and the already tried (set for measurement) or measured (refined) one");
gd.addNumericField("Minimal refined tiles during plane filter",this.pf_min_new,0,3,"",
"Repeat refine antill less tiles are updated");
gd.addTab("Rig Far","Parameters related to the ML files generation for the dual-quad camera rig");
gd.addCheckbox("Enable recovering far objects over infinity area",this.ltfar_en,
"Try to use tiles that were treated as infinity by a single quad camera");
...
...
@@ -310,6 +431,10 @@ public class BiQuadParameters {
"Add strong tiles over infinity areas that have both strenth and disparity above respective thersholds (re-add them after filtering)");
gd.addNumericField("Add even single tiles over infinity if DISPARITY (and strength too) is sufficient",this.ltfar_trusted_d,4,6,"pix",
"Add strong tiles over infinity areas that have both strenth and disparity above respective thersholds (re-add them after filtering)");
for(intnTile=ai.getAndIncrement();nTile<num_tiles;nTile=ai.getAndIncrement())if(strength_measured[nTile]<=0.0){// keep last measurement for a while, even if it is not the best
intbest_indx=-1;
booleanlatest=true;
doublebest_strength=0.0;
for(intindx=list_index-1;indx>=0;indx--){// no need to try the latest - it is empty (strength_measured[nTile] <= 0.0 )
BiScanscan=biCamDSI.getBiScan(indx);
if(scan.disabled_measurement[nTile]||(scan.src_index[nTile]!=indx)){// skip all but enabled sources
continue;
}
if(scan.strength_measured[nTile]>best_strength){
best_strength=scan.strength_measured[nTile];
best_indx=indx;
}
if(last_priority&&latest){
break;// best_indx should be set correctly, as strength > 0.0
}
latest=false;// first not disabled with strength>0 gets here
}
if(best_indx>=0){
src_index[nTile]=best_indx;
}
}
}
};
}
ImageDtt.startAndJoin(threads);
}
publicvoidshowScans(Stringtitle){
}
/**
* Suggest disparities to try for the tiles in poorly textured areas by fitting planes in DSI
* calcTrusted should be called before to set up trusted/cond_trusted tiles
* suggested tiles will be compared against and made sure they differ by more than a specified margin
* 1) current measured (refined) disparity value
* 2) target disaprity that lead to the current measurement after refinement
* 3) any other disable measurement
* 4) any target disparity that lead to the disabled measurement
* @param trusted_strength strength to trust unconditionally
* @param strength_rfloor strength floor to subrtact as a fraction of the trusted strength
* @param discard_cond if true may suggest new disparities for conditionally trusted tiles
* @param discard_weak if true may suggest new disparities over trusted weak tiles
* @param discard_stron if true may suggest new disparities over any tile
* @param strength_pow raise strength to thyis power (normally just 1.0)
* @param smpl_radius sample "radius", square side is 2 * smpl_radius + 1
* @param smpl_num minimal absolute number of samples required to try fit a plane and validate a tile
* @param smpl_fract minimal fraction number of the neighbor samples that fit the rms filter required to try fit a plane and validate a tile
* @param smpl_num_narrow minimal absolute number of samples for preliminary fitting plane to trhe center area
* @param max_adiff maximal absolute difference from the center tile for initial neighbors selection
* @param max_rdiff maximal (additional) relative (to tile disparity) difference from the center tile for initial neighbors selection
* @param max_atilt maximal absolute tilt (pix/tile) for the tilted planes to fit
* @param max_rtilt maximal relative tilt (pix/tile per disparity pixel). min(max_rtilt*disparity, max_atilt) will be used
* @param smpl_arms maximal absolute rms of the weighted remaining samples for the successful plane fitting
* @param smpl_rrms maximal relative (additional)rms of the weighted remaining samples for the successful plane fitting
* @param damp_tilt regularization value to handle planes if the remaining samples are co-linear (or just a single tile)
* @param rwsigma weight Gaussian sigma to reduce influence of far tiles relative to smpl_radius
* @param rwsigma_narrow Gaussian sigma for the preliminary plain fitting using the closesttiles ~= 1/smpl_radius
* @param new_diff minimal difference between the new suggested and the already tried/measured one
* @param remove_all_tried remove from suggested - not only disabled, but all tried
* @param dbg_x tileX to debug
* @param dbg_y tileY to debug
* @param debugLevel debug level
* @return number of new tiles to measure in the array of suggested disparities - Double.NaN - nothing suggested
* for the tile. May need additional filtering to avoid suggested already tried disparities
doubleprevious_target=(previous_indx>=0)?biCamDSI.getBiScan(previous_indx).target_disparity[nTile]:Double.NaN;// Nothing is known about the target of the 0-scan
if(Math.abs(fit_rslt[1]-previous_target)<new_diff){// suggested is too close to already suggested and result - disabled
continue;// already measured for this tile
}
// see if close one was already disabled
// do not compare with the scans that were not disabled - re-try them?remove_all_tried
if(Math.abs(fit_rslt[1]-other_disparity)<new_diff){// suggested is too close to already measured and disabled
valid_suggestion=false;
break;// already measured for this tile
}
intother_indx=other_scan.list_index;
doubleother_target=(other_indx>0)?biCamDSI.getBiScan(other_indx-1).target_disparity[nTile]:Double.NaN;// Nothing is known about the target of the 0-scan
if(Math.abs(fit_rslt[1]-other_target)<new_diff){// suggested is too close to already suggested and result - disabled
valid_suggestion=false;
break;// already measured for this tile
}
}
if(valid_suggestion){
target_disparity[nTile]=fit_rslt[1];
num_new.getAndIncrement();
}
}
}
};
}
ImageDtt.startAndJoin(threads);
// remove duplicates from what was suggested or measured before
returnnum_new.get();
}
// Simple version for non-flat strong areas - try duplicating neighbor
intsuggestNewScan(
finalint[]dxy,//up,down,right,left
finalbooleandiscard_cond,// consider conditionally trusted tiles (not promoted to trusted) as empty
finalbooleandiscard_weak,// consider weak trusted tiles (not promoted to trusted) as empty
finalbooleandiscard_strong,// suggest new disparitieas even for strong tiles
finaldoublenew_diff,// minimal difference between the new suggested and the already tried/measured one
finalbooleanremove_all_tried,// remove from suggested - not only disabled, but all tried
doubleprevious_target=(previous_indx>=0)?biCamDSI.getBiScan(previous_indx).target_disparity[nTile]:Double.NaN;// Nothing is known about the target of the 0-scan
if(Math.abs(new_disp-previous_target)<new_diff){// suggested is too close to already suggested and result - disabled
if(Math.abs(new_disp-other_disparity)<new_diff){// suggested is too close to already measured and disabled
valid_suggestion=false;
break;// already measured for this tile
}
intother_indx=other_scan.list_index;
doubleother_target=(other_indx>0)?biCamDSI.getBiScan(other_indx-1).target_disparity[nTile]:Double.NaN;// Nothing is known about the target of the 0-scan
if(Math.abs(new_disp-other_target)<new_diff){// suggested is too close to already suggested and result - disabled
valid_suggestion=false;
break;// already measured for this tile
}
}
if(valid_suggestion){
target_disparity[nTile]=new_disp;
num_new.getAndIncrement();
}
}
}
}
};
}
ImageDtt.startAndJoin(threads);
returnnum_new.get();
}
/**
* Calculate trusted tiles from the strength and disparity. Trusted are tiles that are really strong
* (then they are trusted regardless of neighbors) or are somewhat strong and have sufficient neighbors
* that (together with this tile) make a good (tilted) plane
* @param trusted_strength strength to trust unconditionally
* @param strength_rfloor strength floor to subrtact as a fraction of the trusted strength
* @param cond_rtrusted fraction of the trusted strength (after subtracting str4ength_floor) that is sufficient
* to participate in plane fitting, if successful - make a tile trusted
* @param strength_pow raise strength to thyis power (normally just 1.0)
* @param smpl_radius sample "radius", square side is 2 * smpl_radius + 1
* @param smpl_num minimal absolute number of samples required to try fit a plane and validate a tile
* @param smpl_fract minimal fraction number of the neighbor samples that fit the rms filter required to try fit a plane and validate a tile
* @param max_adiff maximal absolute difference from the center tile for initial neighbors selection
* @param max_rdiff maximal (additional) relative (to tile disparity) difference from the center tile for initial neighbors selection
* @param max_atilt maximal absolute tilt (pix/tile) for the tilted planes to fit
* @param max_rtilt maximal relative tilt (pix/tile per disparity pixel). min(max_rtilt*disparity, max_atilt) will be used
* @param smpl_arms maximal absolute rms of the weighted remaining samples for the successful plane fitting
* @param smpl_rrms maximal relative (additional)rms of the weighted remaining samples for the successful plane fitting
* @param damp_tilt regularization value to handle planes if the remaining samples are co-linear (or just a single tile)
* @param rwsigma weight Gaussina sigma to reduce influence of far tiles relative to smpl_radius
* @param dbg_x tileX to debug
* @param dbg_y tileY to debug
* @param debugLevel debug level
* @return array of 3 numers: number of trusted strong tiles, number of additional trusted by plane fitting, and number of all
System.out.println("No files for the auxiliary camera match series "+image_name);
returnfalse;
}
double[]referenceExposures_aux=eyesisCorrections.calcReferenceExposures(debugLevel);// multiply each image by this and divide by individual (if not NaN)
afloor,// final double str_floor, // absolute strength floor
clt_parameters.rig.pf_disp_afloor,// final double pf_disp_afloor, // = 0.1; // When selecting the best fit from the alternative disparities, divide by difference increased by this
clt_parameters.rig.pf_disp_rfloor);// final double pf_disp_rfloor) // = 0.02; // Increase pf_disp_afloor for large disparities
quadCLT_main,// QuadCLT quadCLT_main, // tiles should be set
quadCLT_aux,// QuadCLT quadCLT_aux,
tile_op,// int [][] tile_op, // common for both amin and aux
disparity_array,// double [][] disparity_array,
null,// double [][] ml_data, // data for ML - 10 layers - 4 center areas (3x3, 5x5,..) per camera-per direction, 1 - composite, and 1 with just 1 data (target disparity)