Commit 4c92ae27 authored by Andrey Filippov's avatar Andrey Filippov

Documented OpticalFlow, cleaned up, added configurable

OpticalFlowParameters
parent 0a156a26
......@@ -14,6 +14,7 @@ import com.elphel.imagej.tileprocessor.BiQuadParameters;
import com.elphel.imagej.tileprocessor.ImageDtt;
import com.elphel.imagej.tileprocessor.ImageDttParameters;
import com.elphel.imagej.tileprocessor.MeasuredLayersFilterParameters;
import com.elphel.imagej.tileprocessor.OpticalFlowParameters;
import com.elphel.imagej.tileprocessor.PoleProcessorParameters;
import ij.gui.GenericDialog;
......@@ -869,6 +870,7 @@ public class CLTParameters {
public PoleProcessorParameters poles = new PoleProcessorParameters();
public MeasuredLayersFilterParameters mlfp = new MeasuredLayersFilterParameters();
public LwirReaderParameters lwir = new LwirReaderParameters();
public OpticalFlowParameters ofp = new OpticalFlowParameters();
public HashMap<String,Double> z_corr_map = new HashMap<String,Double>(); //old one
......@@ -1715,6 +1717,8 @@ public class CLTParameters {
rig.setProperties (prefix+"_rig", properties);
poles.setProperties (prefix+"_poles", properties);
lwir.setProperties (prefix+"_lwir", properties);
ofp.setProperties (prefix+"_ofp_", properties);
}
public void setPropertiesInfinityDistance(String prefix,Properties properties){
......@@ -2535,6 +2539,7 @@ public class CLTParameters {
rig.getProperties (prefix+"_rig", properties);
poles.getProperties (prefix+"_poles", properties);
lwir.getProperties (prefix+"_lwir", properties);
ofp.getProperties (prefix+"_ofp_", properties);
}
public boolean showJDialog() {
......@@ -3498,6 +3503,12 @@ public class CLTParameters {
gd.addTab ("LWIR", "parameters for LWIR/EO 8-camera rig");
this.lwir.dialogQuestions(gd);
gd.addTab ("O-Flow", "parameters for the interscene Optical FLow calculations");
this.ofp.dialogQuestions(gd);
gd.addTab ("Debug", "Other debug images");
gd.addMessage ("--- Other debug images ---");
// clt_parameters.debug_initial_discriminate, // final boolean debug_initial_discriminate,
......@@ -4292,6 +4303,7 @@ public class CLTParameters {
this.gpu_debug_accum= gd.getNextBoolean();
this.lwir.dialogAnswers(gd);
this.ofp.dialogAnswers(gd);
this.debug_initial_discriminate= gd.getNextBoolean();
this.dbg_migrate= gd.getNextBoolean();
......
......@@ -166,6 +166,23 @@ public class Correlation2d {
wndx_scale); // double scale);
}
public Correlation2d ( // USED in lwir
int transform_size,
boolean monochrome,
boolean debug) {
this.monochrome = monochrome;
this.dtt = new DttRad2(transform_size);
this.transform_size = transform_size;
this.transform_len = transform_size * transform_size;
this.corr_size = transform_size * 2 -1;
// not initialized until needed
this.transpose_all_ortho = new int [corr_size*corr_size];
this.transpose_all_diagonal = new int [corr_size*corr_size];
this.ortho_notch_filter = new double [corr_size];
this.corr_wndy = null; // will not be used
this.corr_wndx = null; // will not be used
this.corr_wndy_notch = null; // will not be used
}
public int [] getTransposeAll(boolean diagonal){ // USED in lwir
if (diagonal) return getTransposeAllDiagonal();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8255,75 +8255,31 @@ if (debugLevel > -100) return true; // temporarily !
}
double k_prev = 0.75;
double corr_scale = 0.75;
/// for (int i = 0; i < quadCLTs.length; i++) {
/// double k_prev = 0.75;
/// double corr_scale = 0.75;
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 [][][] 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 =
// double [][][] pair_sets =
opticalFlow.get_pair(
clt_parameters, // CLTParameters clt_parameters,
k_prev,
clt_parameters.ofp.k_prev, // k_prev,
quadCLTs[i],
qPrev,
corr_scale,
1); // -1); // int debug_level);
clt_parameters.ofp.ers_to_pose_scale, // corr_scale,
clt_parameters.ofp.debug_level_optical); // 1); // -1); // int debug_level);
}
/*
for (int i = 0; i < quadCLTs.length; i++) {
quadCLTs[i].saveInterProperties(// save properties for interscene processing (extrinsics, ers, ...)
null, // String path, // full name with extension or w/o path to use x3d directory
debugLevel);
}
*/
System.out.println("End of test");
}
/*
* public double [][] getDSRBG (){
return dsrbg;
}
*/
public void batchLwirRig(
QuadCLT quadCLT_main, // tiles should be set
......
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