Commit 2c6707fb authored by Andrey Filippov's avatar Andrey Filippov

Matching and processing series

parent d0c338fe
......@@ -876,6 +876,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
jpanelLWIRWorld = new JPanel();
jpanelLWIRWorld.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap
addJButton("Aux Build Series", jpanelLWIRWorld, color_stop);
addJButton("CUAS Combine", jpanelLWIRWorld, color_stop);
addJButton("Build World", jpanelLWIRWorld, color_process);
addJButton("Test IMX5", jpanelLWIRWorld, color_process);
addJButton("Show mice", jpanelLWIRWorld, color_process);
......@@ -1283,6 +1284,7 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
panelLWIRWorld = new Panel();
panelLWIRWorld.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap
addButton("Aux Build Series", panelLWIRWorld, color_stop);
addButton("CUAS Combine", panelLWIRWorld, color_stop);
addButton("Build World", panelLWIRWorld, color_process);
addButton("Test IMX5", panelLWIRWorld, color_process);
addButton("Show mice", panelLWIRWorld, color_process);
......@@ -5688,9 +5690,21 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
DEBUG_LEVEL = MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true;
buildSeries(true);
buildSeries(
true,
0); // int cuas_proc_mode); // 0 - old, 1 combine scene series) {);
return;
/* ======================================================================== */
} else if (label.equals("CUAS Combine")) {
DEBUG_LEVEL = MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
CLT_PARAMETERS.batch_run = true;
buildSeries(
true,
1); // int cuas_proc_mode); // 0 - old, 1 combine scene series) {);
return;
//"CUAS Combine"
/* ======================================================================== */
} else if (label.equals("Aux Inter Test")) {
DEBUG_LEVEL = MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
......@@ -7832,7 +7846,9 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
public boolean buildSeries(boolean use_aux) {
public boolean buildSeries(
boolean use_aux,
int cuas_proc_mode) { // 0 - old, 1 combine scene series) {
long startTime = System.nanoTime();
// load needed sensor and kernels files
if (!prepareRigImages())
......@@ -7893,15 +7909,13 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
try {
TwoQuadCLT.buildSeriesTQ(
0, // int cuas_proc_mode, // 0 - old, 1 combine scene series
cuas_proc_mode, // int cuas_proc_mode, // 0 - old, 1 combine scene series
quadCLT, // QUAD_CLT, // QuadCLT quadCLT_main,
-1, // int ref_index,
0, // int ref_step,
// QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS, // EyesisCorrectionParameters.DebayerParameters debayerParameters,
colorProcParameters, // COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters
// colorProcParameters,
CHANNEL_GAINS_PARAMETERS, // CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS, // EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters
......
......@@ -131,9 +131,16 @@ public class CuasMotion {
public int getSeqLength() {
return clt_parameters.imp.cuas_corr_offset + clt_parameters.imp.cuas_corr_pairs;
}
public int getCorrInc() { // == frame_step;
public static int getCorrInc(
CLTParameters clt_parameters) {
return clt_parameters.imp.cuas_half_step ? (clt_parameters.imp.cuas_corr_offset/2) : clt_parameters.imp.cuas_corr_offset;
}
public int getCorrInc() { // == frame_step;
return getCorrInc(clt_parameters);
// return clt_parameters.imp.cuas_half_step ? (clt_parameters.imp.cuas_corr_offset/2) : clt_parameters.imp.cuas_corr_offset;
}
public int getNumCorrSamples() {
return slice_titles.length;
}
......@@ -148,6 +155,26 @@ public class CuasMotion {
return 0.5* getCorrInc()/corr_offset;
}
/**
* Multiply RESULT_VX,RESULT_VX to get pixel offset per scene (at ~60Hz)
* @param clt_parameters
* @return coefficient for VX, VY
*/
public static double getFrameVelocityScale(CLTParameters clt_parameters) {
return 1.0/clt_parameters.imp.cuas_corr_offset;
}
/**
* Multiply RESULT_VX,RESULT_VX to get pixel offset per key frame (now ~6Hz)
* @param clt_parameters
* @return coefficient for VX, VY
*/
public static double getKeyFrameVelocityScale(CLTParameters clt_parameters) {
return getCorrInc(clt_parameters)/clt_parameters.imp.cuas_corr_offset;
}
public String [] getSceneTitles() {
return scene_titles;
}
......@@ -1914,7 +1941,7 @@ public class CuasMotion {
return vf;
}
public static double [][][] getTargetsFromHyperAugment(
public static double [][][] getTargetsFromHyperAugment_old(
String path){ // add empty fields to the end of each target if shorter than CuasMotionLMA.RSLT_LEN
int [] wh = new int [2];
String [][] pvf_top_titles = new String[1][];
......@@ -1952,6 +1979,56 @@ public class CuasMotion {
return target_sequence;
}
public static double [][][] getTargetsFromHyperAugment(
String path) {
return getTargetsFromHyperAugment(
null, // String [][] pvf_top_titles,
null, // String [][] pvf_titles,
path); //String path)
}
public static double [][][] getTargetsFromHyperAugment(
String [][] pvf_top_titles,
String [][] pvf_titles,
String path){ // add empty fields to the end of each target if shorter than CuasMotionLMA.RSLT_LEN
int [] wh = new int [2];
if (pvf_top_titles == null) pvf_top_titles = new String[1][];
if (pvf_titles == null) pvf_titles = new String[1][];
double [][][] targets_file = ShowDoubleFloatArrays.readDoubleHyperstack(
path, // String path,
wh, // int [] wh, // should be null or int[2]
pvf_top_titles, // String [][] ptop_titles, // should be null or String [1][]
pvf_titles); // String [][] pslice_titles){// should be null or String [1][]
if (targets_file == null) {
return null;
}
int num_fields = targets_file.length;
// fix - discarding last slice if it is called CuasMotionLMA.EXTRA_SLICE_DISCARD_ON_LOAD ("Targets")
if (pvf_top_titles[0][pvf_top_titles[0].length-1].equals(CuasMotionLMA.EXTRA_SLICE_DISCARD_ON_LOAD)) {
System.out.println("getTargetsFromHyperAugment(): removing last slice called "+ pvf_top_titles[0][pvf_top_titles[0].length-1]);
num_fields--;
String [] ss = new String[num_fields];
System.arraycopy(pvf_top_titles[0], 0, ss, 0, num_fields);
pvf_top_titles[0] = ss;
}
int num_fields_augmented = Math.max(num_fields, CuasMotionLMA.RSLT_LEN);
int num_seq = targets_file[0].length;
int num_tiles = targets_file[0][0].length;
double [][][] target_sequence = new double [num_seq][num_tiles][];
for (int nseq=0; nseq < num_seq; nseq++) {
for (int ntile = 0; ntile < num_tiles; ntile++) if (!Double.isNaN(targets_file[0][nseq][ntile])){
double [] v = new double[num_fields_augmented]; // cut to originally calculated fields
for (int i = 0; i < num_fields; i++) {
v[i] = targets_file[i][nseq][ntile];
}
for (int i = num_fields; i < num_fields_augmented; i++) {
v[i] = Double.NaN;
}
target_sequence[nseq][ntile] = v;
}
}
return target_sequence;
}
......@@ -6101,7 +6178,7 @@ public class CuasMotion {
}
/**
* Same for singl-layer targets (one target per tile)
* Same for single-layer targets (one target per tile)
* @param targets_single [num_sequences][num_tiles][CuasMotionLMA.RSLT_LEN] source targets array
* @return variable-length (may be empty) arrays following targets
*/
......
......@@ -98,8 +98,8 @@ public class CuasMotionLMA {
public static final int RSLT_FL_DISP = 56; // flight log true disparity
public static final int RSLT_FL_RANGE = 57; // flight log range (meters)
public static final int RSLT_INFINITY = 58; // disparity at infinity used for range calculation
public static final int RSLT_LEN = RSLT_INFINITY + 1;
public static final int RSLT_TARGET_ID = 59; // unique target id for the whole sequence of segments. 1 is reserved for the UAS
public static final int RSLT_LEN = RSLT_TARGET_ID + 1;
public static final String [] LMA_TITLES =
{"X-OFFS","Y-OFFS", "AMPLITUDE", "RADIUS","RAD_POS", "OVERSHOOT","OFFSET","RMSE","RMSE/A","MAX2A","ITERATIONS",
......@@ -117,7 +117,8 @@ public class CuasMotionLMA {
"WHEN", "FAILURE",
"Disparity","Disparity-Diff","Strength","Range","Global-index",
"segment-length","segment-disparity","segment_disp-diff", "segment-strength", "segment-range",
"FLOG-px","FLOG-pY","FLOG-DISP","FLOG-range","infinity"};
"FLOG-px","FLOG-pY","FLOG-DISP","FLOG-range","infinity",
"GTarget-ID"};
public static final String EXTRA_SLICE_DISCARD_ON_LOAD = "Targets";
public static final int FAIL_NONE = 0;
public static final int FAIL_MOTION = 1; // motion strength/fraction too low
......
This diff is collapsed.
......@@ -27,6 +27,7 @@ public class CuasRanging {
public static final String TARGET_RANGING_LOGS_SUFFIX = "-TARGET_RANGING.log";
public static final String TARGET_RANGING_LOGS_FULL_SUFFIX = "-TARGET_RANGING_FULL.log";
public static final String TARGET_DISPARITIES_SUFFIX = "-TARGET_DISPARITIES";
public static final String TARGET_GLOBALS_SUFFIX = "-TARGET_GLOBALS";
public static final String TARGET_STATS_SUFFIX = "-TARGETS"; // *.csv
......
......@@ -72,6 +72,7 @@ import com.elphel.imagej.correction.Eyesis_Correction;
import com.elphel.imagej.cuas.CorrectionFPN;
import com.elphel.imagej.cuas.Cuas;
import com.elphel.imagej.cuas.CuasData;
import com.elphel.imagej.gpu.GPUTileProcessor;
import com.elphel.imagej.gpu.GpuQuad;
import com.elphel.imagej.gpu.TpTask;
import com.elphel.imagej.ims.Did_gps_pos;
......@@ -3125,13 +3126,30 @@ public class QuadCLTCPU {
*/
public int getTileSize() {
if (tp == null) {
return GPUTileProcessor.DTT_SIZE;
}
return tp.getTileSize();
}
public int getTilesX() {
if (tp == null) {
// if (geometryCorrection == null) {
// if QuadCLT use gpuQuad
// } else {
return geometryCorrection.getSensorWH()[0]/GPUTileProcessor.DTT_SIZE;
// }
}
return tp.getTilesX();
}
public int getTilesY() {
if (tp == null) {
// if (geometryCorrection == null) {
// if QuadCLT use gpuQuad
// } else {
return geometryCorrection.getSensorWH()[1]/GPUTileProcessor.DTT_SIZE;
// }
}
return tp.getTilesY();
}
public int getNumColors(){
......
......@@ -54,6 +54,7 @@ import com.elphel.imagej.common.GenericJTabbedDialog;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.correction.CorrectionColorProc;
import com.elphel.imagej.correction.EyesisCorrections;
import com.elphel.imagej.cuas.CuasMultiSeries;
import com.elphel.imagej.gpu.ExportForGPUDevelopment;
import com.elphel.imagej.gpu.GPUTileProcessor;
import com.elphel.imagej.gpu.GpuQuad;
......@@ -8646,9 +8647,9 @@ if (debugLevel > -100) return true; // temporarily !
cuas_centers = new String [] {quadCLT_main.correctionsParameters.getCuasDir(),""};
}
*/
switch (cuas_proc_mode) {
case 0 :
String uas_sky_mask_path = quadCLT_main.correctionsParameters.getUasSkyMask();
for (int nseq = 0; nseq < num_seq; nseq++) {
long start_time_seq = System.nanoTime();
System.out.println("\nSTARTED PROCESSING SCENE SEQUENCE "+nseq+" (last is "+(num_seq-1)+")\n");
......@@ -8741,9 +8742,9 @@ if (debugLevel > -100) return true; // temporarily !
}
first_in_series = false; // at least once success in this series
System.out.println("adding to video_sets_list start="+start_ref_pointers[0]+", end="+ref_index); // start_ref_pointers[1]);
// if ((video_list != null) && (video_list.length>0) && (video_list[0] == null)) {
// video_list[0]= new String[0];
// }
// if ((video_list != null) && (video_list.length>0) && (video_list[0] == null)) {
// video_list[0]= new String[0];
// }
for (int i= 0; i < video_list[0].length; i++) {
System.out.println(i+": "+video_list[0][i]+", "+widths_list[0][i]);
}
......@@ -8781,7 +8782,7 @@ if (debugLevel > -100) return true; // temporarily !
// will open dialog if does not exist
String linkedCentersDirectory = quadCLT_main.correctionsParameters.selectLinkedCentersDirectory(true,true);
if ((linkedCentersDirectory != null) && (linkedCentersDirectory.length() > 0)) {
// Path pathAbsolute = Paths.get(model_directory);
// Path pathAbsolute = Paths.get(model_directory);
Path pathAbsolute = Paths.get(parent_top_dir); // cuas_centers[1]);
Path pathBase = Paths.get(linkedCentersDirectory);
Path pathRelative = pathBase.relativize(pathAbsolute);
......@@ -8797,8 +8798,8 @@ if (debugLevel > -100) return true; // temporarily !
}
}
// cuas_centers[0] = cuas_centers[1];
// cuas_centers[1] = "";
// cuas_centers[0] = cuas_centers[1];
// cuas_centers[1] = "";
}
......@@ -8833,7 +8834,7 @@ if (debugLevel > -100) return true; // temporarily !
return lhs.getVideoPaths()[0].compareTo(rhs.getVideoPaths()[0]);
}
});
// if ((video_lists.length > 1) && (video_lists[0] != null) && (video_lists[0].length > 1)) { // do not combine if single sequence or no videos
// if ((video_lists.length > 1) && (video_lists[0] != null) && (video_lists[0].length > 1)) { // do not combine if single sequence or no videos
concat_videos: {
System.out.println("Generating "+(video_sets_list.get(0).getVideoPaths().length)+" combined video files.");
String videoDirectory = quadCLT_main.correctionsParameters.selectVideoDirectory(true,true);
......@@ -8937,7 +8938,17 @@ if (debugLevel > -100) return true; // temporarily !
} else {
System.out.println("No combined videos are generated (<2 videos).");
}
break; // case 0 :
case 1:
CuasMultiSeries cuasMultiSeries = new CuasMultiSeries(
clt_parameters, // CLTParameters clt_parameters,
quadCLT_main, // QuadCLT quadCLT_main,
quadCLT_main.correctionsParameters.linkedCenters,
quadCLT_main.correctionsParameters.x3dModelVersion);
// CuasMultiSeries (String path)
cuasMultiSeries.processGlobals();
break;
} // switch (cuas_proc_mode) {
System.out.println("\n\n\nPROCESSING OF "+num_seq+" SCENE SEQUENCES is FINISHED in "+
IJ.d2s(0.000000001*(System.nanoTime()-start_time_all),3)+" sec.");
......
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