for(indx_last=num_seq-1;(indx_last>=0)&&((local_tiles[indx_last].length<=ltarg)||(local_tiles[indx_last][ltarg]<0));indx_last--);// Index 5 out of bounds for length 5
// TODO: improve, get correct calculations with distortions
publicstaticdouble[][]getPixToAzElev(
CLTParametersclt_parameters,
GeometryCorrectiongc,
doubletarget_x,
doubletarget_y,
doubletarget_vx,
doubletarget_vy){
doubleifov=clt_parameters.imp.cuas_ifov;// 0.05; // degree per pixel
doubleifov=gc.getIFOVDegrees();// clt_parameters.imp.cuas_ifov; // 0.05; // degree per pixel
intpx0=clt_parameters.imp.cuas_px0;// 283; // pixel with known azimuth
intpy0=clt_parameters.imp.cuas_py0;// 386; // pixel with known elevation
doubleaz0=clt_parameters.imp.cuas_az0;// 201.5; // degrees for cuas_px0;
...
...
@@ -4532,11 +5202,13 @@ public class CuasMotion {
}
publicvoidgenerateExtractFilterMovingTargets(// move parameters to clt_parameters
finalbooleanradar_mode,
finalbooleanvideo_pass,// if clt_parameters.cuas_clean_video=true, video_pass=0 - output TIFFS, but no video. If video_pass==1 - only video with no debug
finalbooleanbatch_mode,
finalfloat[][]fpixels,
double[][][]target_sequence,// non-overlap only if consider marked stronger tiles
finalintdebugLevel){
/*
generateExtractFilterMovingTargets( // move parameters to clt_parameters
clt_parameters, // CLTParameters clt_parameters,
video_pass, // final boolean video_pass, // if clt_parameters.cuas_clean_video=true, video_pass=0 - output TIFFS, but no video. If video_pass==1 - only video with no debug
...
...
@@ -4549,10 +5221,8 @@ public class CuasMotion {
scene_titles, // String [] scene_titles, // recreate slice_titles from scene titles?
slice_titles, // String [] slice_titles,
debugLevel); // final int debugLevel)
}
public static void generateExtractFilterMovingTargets( // move parameters to clt_parameters
CLTParameters clt_parameters,
final boolean video_pass, // if clt_parameters.cuas_clean_video=true, video_pass=0 - output TIFFS, but no video. If video_pass==1 - only video with no debug
...
...
@@ -4565,7 +5235,7 @@ public class CuasMotion {
String [] scene_titles, // recreate slice_titles from scene titles?
booleanclean_video=clt_parameters.imp.cuas_clean_video;//true;// save video without any debug information for targets, output in TIFF files. False - same output for video and TIFFs
...
...
@@ -4604,15 +5274,9 @@ public class CuasMotion {
booleanshow_rng=clt_parameters.imp.cuas_show_rng;// true; // Show distance to target (range) in meters
booleanshow_inf=clt_parameters.imp.cuas_show_inf;// true; // Show distance greater than max (or negativce) as infinity
booleanshow_inf_gt=clt_parameters.imp.cuas_show_inf_gt;// false; // Use ">max" instead of infinity symbol
booleanshow_true_rng=clt_parameters.imp.cuas_show_true_rng;// show true range (from the flight log)
doubleradar_range=clt_parameters.imp.cuas_radar_range;// maximal radar range in meters
Stringclean_suffix="";
if(clean_video){
if(video_pass){
...
...
@@ -4640,7 +5304,7 @@ public class CuasMotion {
double[][][]extended_targets=extendMotionScan(
target_sequence,// final double [][][] motion_scan,
null,// filter5, // final boolean [][] filtered, // centers, should be non-overlapped
publicstaticfinalintRSLT_FL_RANGE=57;// flight log range (meters)
publicstaticfinalintRSLT_INFINITY=58;// disparity at infinity used for range calculation
publicstaticfinalintRSLT_TARGET_ID=59;// unique target id for the whole sequence of segments. 1 is reserved for the UAS
publicstaticfinalintRSLT_VEL_AXIAL=60;// axial velocity (positive - away), range derivative (m/s), calculated from the difference to the previous/next series range
publicstaticfinalintRSLT_VEL_LATERAL=61;// lateral velocity ( calculated from angular and RSLT_GRANGE
publicstaticfinalintRSLT_RANGE_LIN=62;// range linear interpolated using previous/next series if the same target is present there
publicstaticfinalintRSLT_VEL_AWAY=60;// axial velocity (positive - away), range derivative (m/s), calculated from the difference to the previous/next series range
publicstaticfinalintRSLT_VEL_RIGHT=61;// lateral velocity, right ( calculated from angular and RSLT_GRANGE
publicstaticfinalintRSLT_VEL_UP=62;// lateral velocity, up ( calculated from angular and RSLT_GRANGE
publicstaticfinalintRSLT_RANGE_LIN=63;// range linear interpolated using previous/next series if the same target is present there
Stringdisparity_path=center_CLT.getImageName()+CuasMotion.getParametersSuffixRanging(clt_parameters,TARGET_GLOBALS_SUFFIX);// may later be directly provided (e.g. select specific version)
if(disparity_path.indexOf(Prefs.getFileSeparator())<0){// now always
System.out.println("processMovingTargetsMulti(): FAILED TO READ TARGET DATA FROM "+disparity_path);
returnnull;
}else{
targets=disparity_targets;
System.out.println("processMovingTargetsMulti(): re-using target disparities from "+disparity_path+", generating radar mode images");
}
}else{
cuasMotion.processMovingTargetsMulti(// will remove rendering
batch_mode,// final boolean batch_mode,
fpixels,// final float [][] fpixels,
debugLevel);// final int debugLevel) {
// double[][][]
targets=cuasMotion.getTargets();
if(rng_disp||rng_glob){
double[][][]disparity_targets=null;
if(reuse_disparity){
// String disparity_path = model_prefix+TARGET_DISPARITIES_SUFFIX; // may later be directly provided (e.g. select specific version)
// String disparity_path = model_prefix+TARGET_DISPARITIES_SUFFIX; // may later be directly provided (e.g. select specific version)
Stringdisparity_path=center_CLT.getImageName()+CuasMotion.getParametersSuffixRanging(clt_parameters,TARGET_DISPARITIES_SUFFIX);// may later be directly provided (e.g. select specific version)
if(disparity_path.indexOf(Prefs.getFileSeparator())<0){// now always
Stringx3d_path=center_CLT.getX3dDirectory();
...
...
@@ -239,7 +264,7 @@ public class CuasRanging {
System.out.println("processMovingTargetsMulti(): re-using target disparities from "+disparity_path);
}
}
// if ((disparity_targets == null) || rng_glob) { // for now - always recalculate if
// if ((disparity_targets == null) || rng_glob) { // for now - always recalculate if
saveTargetStats(targets);// final double [][][] targets_single) {
}
}
if(generate_output){
cuasMotion.generateExtractFilterMovingTargets(// move parameters to clt_parameters
radar_mode,// final boolean radar_mode,
false,// final boolean video_pass, // if clt_parameters.cuas_clean_video=true, video_pass=0 - output TIFFS, but no video. If video_pass==1 - only video with no debug
batch_mode,// final boolean batch_mode,
fpixels,// final float [][] fpixels,
...
...
@@ -323,6 +350,7 @@ public class CuasRanging {
debugLevel);// final int debugLevel)
if(clean_video){
cuasMotion.generateExtractFilterMovingTargets(// move parameters to clt_parameters
radar_mode,// final boolean radar_mode,
true,// final boolean video_pass, // if clt_parameters.cuas_clean_video=true, video_pass=0 - output TIFFS, but no video. If video_pass==1 - only video with no debug
"Read previously calculated non-conflict (one per tile) targets with disparities (recalculate ranges).");
gd.addCheckbox("Reuse combined series (Radar mode)",this.cuas_reuse_globals,
"Read target data updated after global processing of scene series \"CUAS Combine\" command. If successful, go directly to output generation with 16:9 and a radar image.");
@@ -6236,10 +6236,14 @@ public class OpticalFlow {
CuasMotioncuasMotion=cuasRanging.detectTargets(
uasLogReader,// UasLogReader uasLogReader,
batch_mode);// boolean batch_mode)
if(cuasMotion==null){
System.out.println("Failed target detection. Probably, radar mode was selected but target file does not exist (created with \"CUAS Combine\" command)");