* @param reference_center_occupancy Fraction of non-null tiles in the center 8x8 area of the reference macrotiles after disparity
* @param reference_center_occupancy Fraction of non-null tiles in the center 8x8 area of the reference macrotiles after disparity
* filtering (see tolerance_absolute, tolerance_relative). Below this threshold - skip that macrotile.
* filtering (see tolerance_absolute, tolerance_relative). Below this threshold - skip that macrotile.
* @param flowXY0 Initial offset of scene tiles (in image pixels) in x (right) and y (down) directions or null (to use all zeros)
* @param flowXY0 Initial offset of scene tiles (in image pixels) in x (right) and y (down) directions or null (to use all zeros)
...
@@ -442,6 +503,7 @@ public class OpticalFlow {
...
@@ -442,6 +503,7 @@ public class OpticalFlow {
finaldouble[]scene_atr,// camera orientation relative to world frame
finaldouble[]scene_atr,// camera orientation relative to world frame
finalQuadCLTscene_QuadClt,
finalQuadCLTscene_QuadClt,
finalQuadCLTreference_QuadClt,
finalQuadCLTreference_QuadClt,
finaldouble[][]reference_tiles_macro,
finaldoublereference_center_occupancy,// fraction of remaining tiles in the center 8x8 area (<1.0)
finaldoublereference_center_occupancy,// fraction of remaining tiles in the center 8x8 area (<1.0)
// final double [][][] reference_tiles, // prepared with prepareReferenceTiles() + fillTilesNans();
// final double [][][] reference_tiles, // prepared with prepareReferenceTiles() + fillTilesNans();
// flowXY should be initialized to all pairs of zeros (or deliberate pixel offset pairs if initial error is too high, will be modified with each iteration
// flowXY should be initialized to all pairs of zeros (or deliberate pixel offset pairs if initial error is too high, will be modified with each iteration
...
@@ -488,6 +550,15 @@ public class OpticalFlow {
...
@@ -488,6 +550,15 @@ public class OpticalFlow {
num_laplassian,// final int num_passes,
num_laplassian,// final int num_passes,
change_laplassian,// final double max_change,
change_laplassian,// final double max_change,
-1);//-1); // 2); // final int debug_level)
-1);//-1); // 2); // final int debug_level)
if(reference_tiles_macro!=null){
double[][]macro_centers=getMacroPxPyDisp(
reference_QuadClt,// final QuadCLT reference_QuadClt,
reference_tiles//final double [][][] reference_tiles // prepared with prepareReferenceTiles() + fillTilesNans();
double[][]vector_XYS=correlate2DIterate(// returns optical flow and confidence
// for prepareSceneTiles()
camera_xyz0,// final double [] scene_xyz, // camera center in world coordinates
camera_atr0,// final double [] scene_atr, // camera orientation relative to world frame
scene_QuadCLT,// final QuadCLT scene_QuadClt,
reference_QuadCLT,// final QuadCLT reference_QuadClt,
reference_tiles_macro,// final double [][] reference_tiles_macro,
clt_parameters.ofp.center_occupancy_ref,// final double reference_center_occupancy, // fraction of remaining tiles in the center 8x8 area (<1.0)
// flowXY should be initialized to all pairs of zeros (or deliberate pixel offset pairs if initial error is too high, will be modified with each iteration
flowXY,// final double [][] flowXY, // per macro tile {mismatch in image pixels in X and Y directions // initialize to [reference_tiles.length][2]
clt_parameters.ofp.tolerance_absolute_inter,// final double tolerance_absolute, // absolute disparity half-range in each tile
clt_parameters.ofp.tolerance_relative_inter,// final double tolerance_relative, // relative disparity half-range in each tile
clt_parameters.ofp.occupancy_inter,// final double occupancy, // fraction of remaining tiles (<1.0)
clt_parameters.ofp.num_laplassian,// final int num_passes,
clt_parameters.ofp.change_laplassian,// final double max_change,
// for correlate2DSceneToReference ()
clt_parameters.ofp.chn_weights,// final double [] chn_weights, // absolute, starting from strength (strength,r,b,g)
clt_parameters.ofp.corr_sigma,// final double corr_sigma,
clt_parameters.ofp.fat_zero,// final double fat_zero,
clt_parameters.ofp.late_normalize_iterate,// final boolean late_normalize,
// for correlation2DToVectors_CM()
clt_parameters.ofp.iradius_cm,// final int iradius, // half-size of the square to process
clt_parameters.ofp.dradius_cm,// final double dradius, // weight calculation (1/(r/dradius)^2 + 1)
clt_parameters.ofp.refine_num_cm,// final int refine_num, // number of iterations to apply weights around new center
clt_parameters.ofp.num_refine_all,// final int num_run_all, // run all tiles for few iterations before filtering
clt_parameters.ofp.max_refines,// final int max_tries,
// for recalculateFlowXY()
clt_parameters.ofp.magic_scale,// final double magic_scale, // 0.85 for CM
clt_parameters.ofp.min_change,// final double min_change,
clt_parameters.ofp.best_neibs_num,// final int best_num,
clt_parameters.ofp.ref_stdev,// final double ref_stdev,
clt_parameters.ofp.debug_level_iterate);// final int debug_level)
clt_parameters.ilp.ilma_num_iter,// int num_iter, // 20
clt_parameters.ilp.ilma_debug_level);// int debug_level)
if(!lmaOK){
System.out.println("LMA failed");
break;
}
camera_xyz0=intersceneLma.getSceneXYZ();
camera_atr0=intersceneLma.getSceneATR();
}
returnnull;//pair;
}
/**
/**
...
@@ -2256,6 +2613,7 @@ public class OpticalFlow {
...
@@ -2256,6 +2613,7 @@ public class OpticalFlow {
camera_atr0,// final double [] scene_atr, // camera orientation relative to world frame
camera_atr0,// final double [] scene_atr, // camera orientation relative to world frame
scene_QuadCLT,// final QuadCLT scene_QuadClt,
scene_QuadCLT,// final QuadCLT scene_QuadClt,
reference_QuadCLT,// final QuadCLT reference_QuadClt,
reference_QuadCLT,// final QuadCLT reference_QuadClt,
null,// final double [][] reference_tiles_macro,
clt_parameters.ofp.center_occupancy_ref,// final double reference_center_occupancy, // fraction of remaining tiles in the center 8x8 area (<1.0)
clt_parameters.ofp.center_occupancy_ref,// final double reference_center_occupancy, // fraction of remaining tiles in the center 8x8 area (<1.0)
// flowXY should be initialized to all pairs of zeros (or deliberate pixel offset pairs if initial error is too high, will be modified with each iteration
// flowXY should be initialized to all pairs of zeros (or deliberate pixel offset pairs if initial error is too high, will be modified with each iteration
flowXY,// final double [][] flowXY, // per macro tile {mismatch in image pixels in X and Y directions // initialize to [reference_tiles.length][2]
flowXY,// final double [][] flowXY, // per macro tile {mismatch in image pixels in X and Y directions // initialize to [reference_tiles.length][2]