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 { ...@@ -214,7 +214,7 @@ public class QuadCLT extends QuadCLTCPU {
@Deprecated
public double [][] getOpticalFlow( public double [][] getOpticalFlow(
double disparity_min, double disparity_min,
double disparity_max, double disparity_max,
...@@ -282,7 +282,8 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -282,7 +282,8 @@ public class QuadCLT extends QuadCLTCPU {
return null; return null;
} }
@Deprecated
public double[] fillNaNGapsOld( public double[] fillNaNGapsOld(
double [] data, double [] data,
int n, int n,
...@@ -305,6 +306,7 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -305,6 +306,7 @@ public class QuadCLT extends QuadCLTCPU {
} }
return d; return d;
} }
@Deprecated
public double[] fillNaNGaps( public double[] fillNaNGaps(
double [] data, double [] data,
int n, int n,
...@@ -322,6 +324,7 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -322,6 +324,7 @@ public class QuadCLT extends QuadCLTCPU {
threadsMax); // final int threadsMax) // maximal number of threads to launch threadsMax); // final int threadsMax) // maximal number of threads to launch
} }
@Deprecated
public double[][][] get_pair( public double[][][] get_pair(
double k_prev, double k_prev,
QuadCLT qprev, QuadCLT qprev,
...@@ -408,7 +411,8 @@ public class QuadCLT extends QuadCLTCPU { ...@@ -408,7 +411,8 @@ public class QuadCLT extends QuadCLTCPU {
} }
return pair; return pair;
} }
@Deprecated
public double [][] transformCameraVew( public double [][] transformCameraVew(
QuadCLT camera_QuadClt, QuadCLT camera_QuadClt,
double [] camera_xyz, // camera center in world coordinates double [] camera_xyz, // camera center in world coordinates
......
...@@ -141,6 +141,9 @@ public class QuadCLTCPU { ...@@ -141,6 +141,9 @@ public class QuadCLTCPU {
public double [][] ds_from_main = null; public double [][] ds_from_main = null;
public double [][] dsrbg = null; // D, S, R,B,G public double [][] dsrbg = null; // D, S, R,B,G
public TileProcessor getTileProcessor() {
return tp;
}
public QuadCLTCPU( public QuadCLTCPU(
QuadCLTCPU qParent, QuadCLTCPU qParent,
...@@ -225,6 +228,9 @@ public class QuadCLTCPU { ...@@ -225,6 +228,9 @@ public class QuadCLTCPU {
public double getTimeStamp() { public double getTimeStamp() {
return Double.parseDouble(image_name.replace("_", ".")); 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) 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 ! ...@@ -8259,39 +8259,46 @@ if (debugLevel > -100) return true; // temporarily !
double corr_scale = 0.75; double corr_scale = 0.75;
/// for (int i = 0; i < quadCLTs.length; i++) { /// 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++) { for (int i = 1; i < quadCLTs.length; i++) {
QuadCLT qPrev = (i > 0) ? quadCLTs[i - 1] : null; QuadCLT qPrev = (i > 0) ? quadCLTs[i - 1] : null;
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)
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 = quadCLTs[i].get_pair( double [][][] pair_sets =
k_prev, opticalFlow.get_pair(
qPrev,
corr_scale,
1); // -1); // int debug_level);
// old code
/*
double [][] dbg_img = quadCLTs[i].test_back_forth_debug(
k_prev, k_prev,
quadCLTs[i],
qPrev, qPrev,
corr_scale, corr_scale,
1); // -1); // int debug_level); 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