Commit ca22efc3 authored by Andrey Filippov's avatar Andrey Filippov

Implementing OpticalFlow

parent b1c9139f
This diff is collapsed.
......@@ -214,7 +214,7 @@ public class QuadCLT extends QuadCLTCPU {
@Deprecated
public double [][] getOpticalFlow(
double disparity_min,
double disparity_max,
......@@ -283,6 +283,7 @@ public class QuadCLT extends QuadCLTCPU {
return null;
}
@Deprecated
public double[] fillNaNGapsOld(
double [] data,
int n,
......@@ -305,6 +306,7 @@ public class QuadCLT extends QuadCLTCPU {
}
return d;
}
@Deprecated
public double[] fillNaNGaps(
double [] data,
int n,
......@@ -322,6 +324,7 @@ public class QuadCLT extends QuadCLTCPU {
threadsMax); // final int threadsMax) // maximal number of threads to launch
}
@Deprecated
public double[][][] get_pair(
double k_prev,
QuadCLT qprev,
......@@ -409,6 +412,7 @@ public class QuadCLT extends QuadCLTCPU {
return pair;
}
@Deprecated
public double [][] transformCameraVew(
QuadCLT camera_QuadClt,
double [] camera_xyz, // camera center in world coordinates
......
......@@ -141,6 +141,9 @@ public class QuadCLTCPU {
public double [][] ds_from_main = null;
public double [][] dsrbg = null; // D, S, R,B,G
public TileProcessor getTileProcessor() {
return tp;
}
public QuadCLTCPU(
QuadCLTCPU qParent,
......@@ -225,6 +228,9 @@ public class QuadCLTCPU {
public double getTimeStamp() {
return Double.parseDouble(image_name.replace("_", "."));
}
public String getImageName() {
return image_name;
}
public int restoreDSI(String suffix) // "-DSI_COMBO", "-DSI_MAIN" (DSI_COMBO_SUFFIX, DSI_MAIN_SUFFIX)
{
......
......@@ -8259,39 +8259,46 @@ if (debugLevel > -100) return true; // temporarily !
double corr_scale = 0.75;
/// for (int i = 0; i < quadCLTs.length; i++) {
OpticalFlow opticalFlow = new OpticalFlow(
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus); // boolean updateStatus);
int margin = 4; // extra margins over 16x16 tiles to accommodate distorted destination tiles
double tolerance_absolute = 0.25; // absolute disparity half-range in each tile
double tolerance_relative = 0.2; // relative disparity half-range in each tile
double center_occupancy = 0.25; // fraction of remaining tiles in the center 8x8 area (<1.0)
int num_passes = 100;
double max_change = 0.005 ;
for (int i = 1; i < quadCLTs.length; i++) {
QuadCLT qPrev = (i > 0) ? quadCLTs[i - 1] : null;
double [][][] pair_sets = quadCLTs[i].get_pair(
k_prev,
qPrev,
corr_scale,
1); // -1); // int debug_level);
double [][][] source_tiles = opticalFlow.prepareReferenceTiles(
quadCLTs[i], // final QuadCLT qthis,
// margin, // final int margin, // extra margins over 16x16 tiles to accommodate distorted destination tiles
tolerance_absolute, // final double tolerance_absolute, // absolute disparity half-range in each tile
tolerance_relative, // final double tolerance_relative, // relative disparity half-range in each tile
center_occupancy, // final double center_occupancy, // fraction of remaining tiles in the center 8x8 area (<1.0)
2); // final int debug_level)
// old code
/*
double [][] dbg_img = quadCLTs[i].test_back_forth_debug(
opticalFlow.fillTilesNans(
source_tiles, // final double [][][] nan_tiles,
quadCLTs[i], // final QuadCLT qthis,
// margin, // final int margin, // extra margins over 16x16 tiles to accommodate distorted destination tiles
// 0.5 * Math.sqrt(2.0), // double diagonal_weight, // relative to ortho
num_passes, // final int num_passes,
max_change, // final double max_change,
2); // final int debug_level)
double [][][] pair_sets =
opticalFlow.get_pair(
k_prev,
quadCLTs[i],
qPrev,
corr_scale,
1); // -1); // int debug_level);
double [][] ds0 = {dbg_img[6],dbg_img[2]};
double [][] ds1 = {dbg_img[7],dbg_img[3]};
double [] disparity = quadCLTs[i].dsi[TwoQuadCLT.DSI_DISPARITY_MAIN];
double [] strength = quadCLTs[i].dsi[TwoQuadCLT.DSI_STRENGTH_MAIN];
double disparity_min = -1.0;
double disparity_max = 1.0;
quadCLTs[i].getOpticalFlow(
disparity_min,
disparity_max,
ds0,
ds1,
1); // int debugLevel)
*/
}
/*
......
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