Commit dffd9fb5 authored by Andrey Filippov's avatar Andrey Filippov

Output target statistics

parent 9ca65083
......@@ -122,6 +122,10 @@ public class CuasMotion {
private double [][][] targets = null;
private int start_frame = 0;
public UasLogReader getUasLogReader() {
return uasLogReader;
}
private boolean slow_targets = false;
public int getSeqLength() {
......@@ -4168,7 +4172,7 @@ public class CuasMotion {
}
public static String getTargetText(
public static String getTargetTextOld(
CLTParameters clt_parameters,
double [] target) {
double target_x = target[TARGET_X];
......@@ -4214,6 +4218,59 @@ public class CuasMotion {
String s = (d > 0)? "+" : ( (d <0)? "-":" ");
return s+ String.format(format, Math.abs(d));
}
public static String getTargetText(
CLTParameters clt_parameters,
double [] target) {
double [][] az_el_oaz_oel= getPixToAzElev(
clt_parameters, // CLTParameters clt_parameters,
target[TARGET_X], // double target_x,
target[TARGET_Y], // double target_y,
target[TARGET_VX], // double target_vx,
target[TARGET_VY]); // double target_vy);
String number_format = "%3.0f";
String omega_format = "%3.1f";
String omega = "\u03A9";
String txt = "";
txt += " AZ "+String.format(number_format,az_el_oaz_oel[0][0])+"\n";
txt += " EL "+ getSignedDouble(az_el_oaz_oel[0][1],number_format)+"\n";
txt += omega+"AZ "+getSignedDouble(az_el_oaz_oel[1][0],omega_format)+"\n";
txt += omega+"EL "+getSignedDouble(az_el_oaz_oel[1][1],omega_format);
return txt;
}
// TODO: improve, get correct calculations with distortions
public static double [][] getPixToAzElev(
CLTParameters clt_parameters,
double target_x,
double target_y,
double target_vx,
double target_vy) {
double ifov = clt_parameters.imp.cuas_ifov; // 0.05; // degree per pixel
int px0 = clt_parameters.imp.cuas_px0; // 283; // pixel with known azimuth
int py0 = clt_parameters.imp.cuas_py0; // 386; // pixel with known elevation
double az0 = clt_parameters.imp.cuas_az0; // 201.5; // degrees for cuas_px0;
double el0 = clt_parameters.imp.cuas_el0; // 0.0; // degrees for cuas_px0;
double fps = 60.0;
double az = (target_x - px0)*ifov+az0;
double el = -(target_y - py0)*ifov+el0;
double omega_az = target_vx * ifov * fps;
double omega_el = -target_vy * ifov * fps;
while (az < 0) {
az += 360;
}
while (az >= 360) {
az -= 360;
}
while (el < -180) {
el += 360;
}
while (el > 180) {
el -= 360;
}
return new double [][] {{az,el},{omega_az, omega_el}};
}
public static String saveAsVideo(
......@@ -5611,8 +5668,9 @@ public class CuasMotion {
/*
* Needs RSLT_BX, RSLT_BY, RSLT_AX, RSLT_AY to be known
*/
public static void calcMatchingTargetsLengths( // calculate number of consecutive keyframes connected to each target
public static int [][][] calcMatchingTargetsLengths( // calculate number of consecutive keyframes connected to each target
final double [][][][] targets_multi,
final boolean calc_linked,
final double max_mismatch, // if <=0, do not calculate mismatch_ba and filter
final double slow_fast_mismatch,
final double match_len_pwr, // 0.5; // raise matching length to this power for calculating score
......@@ -5775,12 +5833,8 @@ public class CuasMotion {
*/
final int len_grp_before = num_grp_before;
final int len_grp_after = agrp.get()-len_grp_before;
final boolean [] pairs = new boolean [(len_grp_before -1) * len_grp_after];
final boolean [][] ba_pairs = new boolean [len_grp_before -1][len_grp_after];
ai.set(0);
// combine before/after into a single value
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
......@@ -5821,14 +5875,7 @@ public class CuasMotion {
}
int grp_before = target_grp[0][nSeq][ntile][ntarg]-1;
int grp_after = target_grp[1][nSeq][ntile][ntarg] - len_grp_before;
int indx = grp_after + grp_before * len_grp_after;
pairs[indx] = true;
/*
ConcurrentLinkedQueue<Integer> cqueue = cqueue_list.get(grp_before-1);
if (!cqueue.contains(grp_after)) {
cqueue.add(grp_after);
}
*/
ba_pairs[grp_before][grp_after] = true;
if (ntile == dbg_tile) {
System.out.println("calcMathingTargetsLengths().4 nSeq = "+nSeq+", targets["+ntarg+"][CuasMotionLMA.RSLT_MATCH_LENGTH]="+
target[CuasMotionLMA.RSLT_MATCH_LENGTH]+", travel="+target[CuasMotionLMA.RSLT_SEQ_TRAVEL]);
......@@ -5842,29 +5889,189 @@ public class CuasMotion {
};
}
ImageDtt.startAndJoin(threads);
return;
if (!calc_linked) {
return null;
}
/*
private static double getDiagonal2 (
double x,
double y,
double [] bbox) {
double min_x = Math.min(bbox[0], x);
double min_y = Math.min(bbox[1], y);
double max_x = Math.max(bbox[2], x);
double max_y = Math.max(bbox[3], y);
double w = max_x - min_x;
double h = max_y - min_y;
return w*w + h*h;
// final int [][][][] linked_targets = new int [len_grp_before -1][len_grp_after][][]; // [nseq]{ntile,ntarg}
final int [][] pair_indices = new int [len_grp_before -1][len_grp_after];
int indx = 0;
for (int nb = 0; nb < pair_indices.length; nb++) {
Arrays.fill(pair_indices[nb], -1);
for (int na = 0; na < pair_indices[nb].length; na++) {
if (ba_pairs[nb][na]) {
// linked_targets[nb][na] = new int [num_seq][];
pair_indices[nb][na] = indx++;
}
}
}
final int [][][] linked_targets = new int [indx][num_seq][]; // [nseq]{ntile,ntarg}
private static double [] getBbox (
double x,
double y,
double [] bbox) {
return new double[] {Math.min(bbox[0], x),Math.min(bbox[1], y),Math.max(bbox[2], x),Math.max(bbox[3], y)};
ai.set(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nSeq = ai.getAndIncrement(); nSeq < num_seq; nSeq = ai.getAndIncrement()) {
for (int ntile = 0; ntile < num_tiles; ntile++) {
double [][] targets =targets_multi[nSeq][ntile];
if (targets != null){
for (int ntarg = 0; ntarg < targets.length; ntarg++) {
double [] target = targets[ntarg];
if (target != null) {
int grp_before = target_grp[0][nSeq][ntile][ntarg]-1;
int grp_after = target_grp[1][nSeq][ntile][ntarg] - len_grp_before;
if ((grp_before >= 0) && (grp_after >= 0)) {
int pair_index = pair_indices[grp_before][grp_after]; // should be >=0
if (pair_index <0) {
throw new IllegalArgumentException("calcMatchingTargetsLengths(): BUG: pair_indices["+grp_before+"]["+grp_after+
"] <0 for nSeq="+ nSeq+", ntile="+ntile+", ntarg="+ntarg);
}
linked_targets[pair_index][nSeq] = new int [] {ntile, ntarg}; // null pointer
target[CuasMotionLMA.RSLT_GLOBAL] = pair_index + 1; // starting with 1
}
}
}
}
}
}
}
};
}
ImageDtt.startAndJoin(threads);
return linked_targets;
}
/**
* Calculate tiles/alts for each moving target using unique index in CuasMotionLMA.RSLT_GLOBAL field
* Creates array of such targets, each having the length of the input targets_multi array. Each element
* is either null (this target is not present in this scene sequence) or a pair of {tile, alternative}
* if it does.
* @param targets_multi [num_sequences][num_tiles][num_alternatives][CuasMotionLMA.RSLT_LEN] source targets array
* @return variable-length (may be empty) arrays following targets
*/
public static int [][][] getLinkedTargets(
final double [][][][] targets_multi){
final int num_seq = targets_multi.length;
final int num_tiles = targets_multi[0].length;
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
final AtomicInteger amax = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nSeq = ai.getAndIncrement(); nSeq < num_seq; nSeq = ai.getAndIncrement()) {
for (int ntile = 0; ntile < num_tiles; ntile++) {
double [][] targets =targets_multi[nSeq][ntile];
if (targets != null){
for (int ntarg = 0; ntarg < targets.length; ntarg++) {
double [] target = targets[ntarg];
if (target != null) {
double dindx = target[CuasMotionLMA.RSLT_GLOBAL];
if (!Double.isNaN(dindx) && (dindx > 0)) {
int indx = (int) dindx;
amax.getAndAccumulate(indx, Math::max);
}
}
}
}
}
}
}
};
}
ImageDtt.startAndJoin(threads);
final int num_targets = amax.get();
final int [][][] linked_targets = new int [num_targets][][]; // [nseq]{ntile,ntarg}
ai.set(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nSeq = ai.getAndIncrement(); nSeq < num_seq; nSeq = ai.getAndIncrement()) {
for (int ntile = 0; ntile < num_tiles; ntile++) {
double [][] targets =targets_multi[nSeq][ntile];
if (targets != null){
for (int ntarg = 0; ntarg < targets.length; ntarg++) {
double [] target = targets[ntarg];
if (target != null) {
double dindx = target[CuasMotionLMA.RSLT_GLOBAL];
if (!Double.isNaN(dindx) && (dindx > 0)) {
int pair_index = (int) dindx - 1;
linked_targets[pair_index][nSeq] = new int [] {ntile, ntarg};
}
}
}
}
}
}
}
};
}
ImageDtt.startAndJoin(threads);
return linked_targets;
}
/**
* Same for singl-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
*/
public static int [][][] getLinkedTargets(
final double [][][] targets_single){
final int num_seq = targets_single.length;
final int num_tiles = targets_single[0].length;
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
final AtomicInteger amax = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nSeq = ai.getAndIncrement(); nSeq < num_seq; nSeq = ai.getAndIncrement()) {
for (int ntile = 0; ntile < num_tiles; ntile++) {
double [] target = targets_single[nSeq][ntile];
if (target != null) {
double dindx = target[CuasMotionLMA.RSLT_GLOBAL];
if (!Double.isNaN(dindx) && (dindx > 0)) {
int indx = (int) dindx;
amax.getAndAccumulate(indx, Math::max);
}
}
}
}
}
};
}
ImageDtt.startAndJoin(threads);
final int num_targets = amax.get();
final int [][][] linked_targets = new int [num_targets][num_seq][]; // [nseq]{ntile,ntarg}
ai.set(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nSeq = ai.getAndIncrement(); nSeq < num_seq; nSeq = ai.getAndIncrement()) {
for (int ntile = 0; ntile < num_tiles; ntile++) {
double [] target =targets_single[nSeq][ntile];
if (target != null) {
double dindx = target[CuasMotionLMA.RSLT_GLOBAL];
if (!Double.isNaN(dindx) && (dindx > 0)) {
int pair_index = (int) dindx - 1;
linked_targets[pair_index][nSeq] = new int [] {ntile, 0}; // ntarg}; // null
}
}
}
}
}
};
}
ImageDtt.startAndJoin(threads);
return linked_targets;
}
private static double getDiagonal2 (
double [] bbox) {
double w = bbox[2] - bbox[0];
......@@ -5872,8 +6079,6 @@ public class CuasMotion {
return w*w + h*h;
}
private static double [] getBbox (
double [] bbox1,
double [] bbox2) {
......@@ -8004,6 +8209,7 @@ public class CuasMotion {
calcMatchingTargetsLengths( // calculate number of consecutive keyframes connected to each target
targets_multi, // final double [][][][] targets_multi,
false, // final boolean calc_linked,
// which is better here?
good_mismatch, // max_mismatch, // final double max_mismatch, // if <=0, do not calculate mismatch_ba and filter
slow_fast_mismatch, // final double slow_fast_mismatch,
......@@ -8145,6 +8351,7 @@ public class CuasMotion {
calcMatchingTargetsLengths( // calculate number of consecutive keyframes connected to each target
targets_multi2, // final double [][][][] targets_multi,
true, // final boolean calc_linked,
// which is better here?
good_mismatch, // max_mismatch, // final double max_mismatch, // if <=0, do not calculate mismatch_ba and filter
slow_fast_mismatch, // final double slow_fast_mismatch,
......@@ -8371,6 +8578,7 @@ public class CuasMotion {
tilesX); // int tilesX) {
calcMatchingTargetsLengths( // calculate number of consecutive keyframes connected to each target
targets_multi, // final double [][][][] targets_multi,
true, // final boolean calc_linked,
// which is better here?
good_mismatch, // max_mismatch, // final double max_mismatch, // if <=0, do not calculate mismatch_ba and filter
slow_fast_mismatch, // final double slow_fast_mismatch,
......@@ -8407,6 +8615,9 @@ public class CuasMotion {
return;
}
final void recalcOmegas(
double [][][][] targets_multi,
int debugLevel){
......
......@@ -7,6 +7,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.cameras.CLTParameters;
import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.gpu.GPUTileProcessor;
import com.elphel.imagej.gpu.GpuQuad;
import com.elphel.imagej.gpu.TpTask;
import com.elphel.imagej.ims.UasLogReader;
......@@ -25,6 +26,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_STATS_SUFFIX = "-TARGETS.csv";
final QuadCLT center_CLT;
......@@ -73,6 +75,7 @@ public class CuasRanging {
/// double rng_limit = clt_parameters.imp.cuas_rng_limit;
boolean generate_output = clt_parameters.imp.cuas_generate; // generate and save targets Tiff and/or video files
boolean generate_csv = clt_parameters.imp.cuas_generate_csv; // generate and save targets as csv file
boolean clean_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
......@@ -275,6 +278,10 @@ public class CuasRanging {
getRangeFromDisparity(targets);
// generate results video (move from earlier)
if (generate_csv) {
saveTargetStats(targets); // final double [][][] targets_single) {
}
if (generate_output) {
cuasMotion.generateExtractFilterMovingTargets( // move parameters to clt_parameters
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
......@@ -290,6 +297,7 @@ public class CuasRanging {
targets, // _nonconflict, // final double [][][] vf_sequence, // center tiles (not extended), null /non-null only
debugLevel); // final int debugLevel)
}
} else {
System.out.println("Output images/videos with detected targets is disabled by \"Generate and save detected targets\" parameter, skipping it.");
......@@ -627,6 +635,7 @@ public class CuasRanging {
if (log_ranging) {
String log_head = getRangingLogParameters();
log_head +="target\tnseq\tframe_center\tnrefine\ttileX\ttileY\ttile\tdisparity\tdisp_diff\tstrength\tlast_str\tmax_diff\n";
center_CLT.appendStringInModelDirectory(log_head, TARGET_RANGING_LOGS_SUFFIX);
center_CLT.appendStringInModelDirectory(log_head, TARGET_RANGING_LOGS_FULL_SUFFIX);
}
......@@ -681,7 +690,7 @@ public class CuasRanging {
sb.append("cuas_min_disp_str = " + clt_parameters.imp.cuas_min_disp_str + "\n"); // Minimal disparity strength to consider disparity valid
sb.append("cuas_rng_limit = " + clt_parameters.imp.cuas_rng_limit + "\n"); // Maximal displayed distance to target
sb.append("nseq\tframe_center\tnrefine\ttileX\ttileY\ttile\tdisparity\tdisp_diff\tstrength\tlast_str\tmax_diff\n");
// sb.append("nseq\tframe_center\tnrefine\ttileX\ttileY\ttile\tdisparity\tdisp_diff\tstrength\tlast_str\tmax_diff\n");
return sb.toString();
}
......@@ -702,6 +711,9 @@ public class CuasRanging {
final int rng_niterate = clt_parameters.imp.cuas_rng_niterate;
final double rng_diff = clt_parameters.imp.cuas_rng_diff;
double cuas_initial_disparity=clt_parameters.imp.cuas_initial_disparity; // 1.0; // Start correlation with this disparity (in addition to infinity) after reset
double cuas_infinity = clt_parameters.imp.cuas_infinity ; // 0.63; // disparity at infinity for targets
final int tilesX = center_CLT.getTilesX();
final int tilesY = center_CLT.getTilesY();
final int frame_center = cuasMotion.getFrameCenter(nseq); // for debug only
......@@ -726,7 +738,7 @@ public class CuasRanging {
if (reset_disp) {
for (int dbg_nseq = 0; dbg_nseq < targets.length; dbg_nseq++) {
for (int dbg_ntile = 0; dbg_ntile < targets[nseq].length; dbg_ntile++) if (targets[dbg_nseq][dbg_ntile] != null) {
targets[dbg_nseq][dbg_ntile][CuasMotionLMA.RSLT_DISPARITY] = 0;
targets[dbg_nseq][dbg_ntile][CuasMotionLMA.RSLT_DISPARITY] = cuas_initial_disparity + cuas_infinity; // 0;;
targets[dbg_nseq][dbg_ntile][CuasMotionLMA.RSLT_DISP_STR] = 0;
}
}
......@@ -820,6 +832,8 @@ public class CuasRanging {
(disparity_map[ImageDtt.DISPARITY_INDEX_POLY] != null)) {
double disp_diff = disparity_map[ImageDtt.DISPARITY_INDEX_POLY][ntile]; // null
double str = disparity_map[ImageDtt.DISPARITY_INDEX_POLY+1][ntile];
int itarget = (int) targets[nseq][ntile][CuasMotionLMA.RSLT_GLOBAL];
if (Double.isNaN(disp_diff)) {
if (!use_non_lma) {
continue;
......@@ -847,7 +861,7 @@ public class CuasRanging {
int dbg_tilex = ntile % tilesX;
int dbg_tiley = ntile / tilesX;
sb_last.append(nseq+"\t"+frame_center+"\t"+nrefine+"\t"+dbg_tilex+"\t"+dbg_tiley+"\t"+ntile+"\t"+
sb_last.append(itarget+"\t"+nseq+"\t"+frame_center+"\t"+nrefine+"\t"+dbg_tilex+"\t"+dbg_tiley+"\t"+ntile+"\t"+
targets[nseq][ntile][CuasMotionLMA.RSLT_DISPARITY]+"\t"+
disp_diff+"\t"+
targets[nseq][ntile][CuasMotionLMA.RSLT_DISP_STR]+"\t"+
......@@ -858,8 +872,8 @@ public class CuasRanging {
if (debugLevel > -4) {
int dbg_tilex = ntile % tilesX;
int dbg_tiley = ntile / tilesX;
System.out.println(String.format("rangeTargets(), nseq=%3d (%3d), nrefine=%2d, %3d:%3d (%4d), disparity=%7.4f (%7.4f), strength=%7.5f (%7.5f) max_diff=%7.5f",
nseq,frame_center,nrefine,dbg_tilex,dbg_tiley,ntile,
System.out.println(String.format("rangeTargets(), target=%2d, nseq=%3d (%3d), nrefine=%2d, %3d:%3d (%4d), disparity=%7.4f (%7.4f), strength=%7.5f (%7.5f) max_diff=%7.5f",
itarget, nseq,frame_center,nrefine,dbg_tilex,dbg_tiley,ntile,
targets[nseq][ntile][CuasMotionLMA.RSLT_DISPARITY],
disp_diff,targets[nseq][ntile][CuasMotionLMA.RSLT_DISP_STR],str,max_diff));
......@@ -874,6 +888,12 @@ public class CuasRanging {
break;
}
}
// if never was set - make it NaN
for (int ntile = 0; ntile < targets[nseq].length; ntile++) if ((targets[nseq][ntile] != null) && !(targets[nseq][ntile][CuasMotionLMA.RSLT_DISP_STR] > 0)) {
targets[nseq][ntile][CuasMotionLMA.RSLT_DISP_STR] = 0;
targets[nseq][ntile][CuasMotionLMA.RSLT_DISPARITY] = Double.NaN;
}
if (sb != null) {
sb.append(sb_last);
......@@ -1669,4 +1689,90 @@ public class CuasRanging {
}
// relies on calcMatchingTargetsLengths(.., true,...) called from recalcOmegas() to set [RSLT_GLOBAL]
public void saveTargetStats(
final double [][][] targets_single) {
final int tilesX = cuasMotion.getTilesX();
final int tileSize = GPUTileProcessor.DTT_SIZE;
double cuas_infinity = clt_parameters.imp.cuas_infinity ; // 0.63; // disparity at infinity for targets
int num_seq = targets_single.length;
int [][][] linked_targets = CuasMotion.getLinkedTargets(targets_single);
int num_targets = linked_targets.length;
StringBuffer sb = new StringBuffer();
sb.append(getRangingLogParameters());
String [] fields = {"pX", "pY"," azimuth", "elevation","disparity","range"};
// First header line
sb.append("scene\t\tFlight log"); for (int i = 0; i < fields.length; i++) sb.append("\t");
for (int ntarg = 0; ntarg < num_targets; ntarg++) {
sb.append("Target "+(ntarg+1));for (int i = 0; i < fields.length; i++) sb.append("\t"); // there will be 1 extra blank column
}
sb.append("\n"); // there will be 1 extra blank column
// Second header line
sb.append("index\ttimestamp\t");
for (int ntarg = -1; ntarg < num_targets; ntarg++) {
String suffix = (ntarg < 0) ? "-fl_log":("-"+(ntarg+1));
for (int i = 0; i < fields.length; i++) {
sb.append(fields[i]+suffix+"\t");
}
}
sb.append("\n"); // there will be 1 extra blank column
String [] slice_titles = cuasMotion.getSliceTitles(); // timestamps
UasLogReader uasLogReader = cuasMotion.getUasLogReader();
for (int nseq = 0; nseq < num_seq; nseq++) {
String timestamp = slice_titles[nseq];
sb.append(nseq+"\t"+timestamp+"\t");
// get azimuth, elevation, target disparity from the log plus infinity, log range
double [] uas_pXpYDRange = uasLogReader.getUasPxPyDRange(timestamp); // px, py, d, range + cuas_infinity
double [][] az_el_oaz_oel= CuasMotion.getPixToAzElev(
clt_parameters, // CLTParameters clt_parameters,
uas_pXpYDRange[0], // double target_x,
uas_pXpYDRange[1], // double target_y,
0, // double target_vx,
0); // double target_vy);
sb.append(uas_pXpYDRange[0]+"\t"+uas_pXpYDRange[1]+"\t"+az_el_oaz_oel[0][0]+"\t"+az_el_oaz_oel[0][1]+"\t"+(uas_pXpYDRange[2]+cuas_infinity)+"\t"+uas_pXpYDRange[3]+"\t");
for (int ntarg = 0; ntarg < num_targets; ntarg++) {
if (linked_targets[ntarg][nseq] != null) {
int ntile = linked_targets[ntarg][nseq][0]; // [1] - ntarg not used here, it is always 0
double [] target = targets_single[nseq][ntile];
if (target == null) {
System.out.println("saveTargetStats() BUG, (target == null). ntarg = "+ntarg+", nseq="+nseq+
", linked_targets["+ntarg+"]["+nseq+"][0]="+linked_targets[ntarg][nseq][0]);
System.out.println();
for (int i = 0; i < fields.length; i++) {
sb.append("\t");
}
} else {
int tileX = ntile % tilesX;
int tileY = ntile / tilesX;
double xc = tileSize * tileX + tileSize/2 + target[CuasMotionLMA.RSLT_X];
double yc = tileSize * tileY + tileSize/2 + target[CuasMotionLMA.RSLT_Y];
double vx = target[CuasMotionLMA.RSLT_VX];
double vy = target[CuasMotionLMA.RSLT_VY];
// calculate and output target azimuth, elevation, disparity (full) and range
az_el_oaz_oel= CuasMotion.getPixToAzElev(
clt_parameters, // CLTParameters clt_parameters,
xc, // double target_x, // null
yc, // double target_y,
vx, // double target_vx,
vy); // double target_vy);
sb.append(xc+"\t"+yc+"\t"+az_el_oaz_oel[0][0]+"\t"+az_el_oaz_oel[0][1]+"\t"+
target[CuasMotionLMA.RSLT_DISPARITY]+"\t"+target[CuasMotionLMA.RSLT_RANGE]+"\t");
}
} else {
for (int i = 0; i < fields.length; i++) {
sb.append("\t");
}
}
}
sb.append("\n"); // there will be 1 extra blank column
}
String suffix = CuasMotion.getParametersSuffixRslt(clt_parameters, null)+TARGET_STATS_SUFFIX;
center_CLT.saveStringInModelDirectory(sb.toString(), suffix, false);
return;
}
}
......@@ -837,6 +837,7 @@ min_str_neib_fpn 0.35
public boolean cuas_intermed_giga = false;// save huge (gigabyte) intermediate files
public boolean cuas_debug_more = true;// save/show more images
public boolean cuas_generate = true; // generate and save targets Tiff and/or video files
public boolean cuas_generate_csv = true; // generate and save targets as csv file
public boolean cuas_save_mono = false; // save 32-bit monochrome target+backgrounds Tiffs (before optional scaling)
public boolean cuas_save_color = true; // save color rendered images (same as videos)
public boolean cuas_save_video = true; // save color rendered images (same as videos)
......@@ -2577,6 +2578,8 @@ min_str_neib_fpn 0.35
gd.addCheckbox ("Generate and save detected targets", this.cuas_generate,
"Generate and save targets Tiff and/or video files (all images and videos).");
gd.addCheckbox ("Save target data as a CSV file", this.cuas_generate_csv,
"Generate and save targets as a spreadsheet data (.csv).");
gd.addCheckbox ("Save monochrome targets+background", this.cuas_save_mono,
"Save 32-bit monochrome targets+background Tiffs (before optional scaling).");
......@@ -3814,6 +3817,7 @@ min_str_neib_fpn 0.35
this.cuas_debug_more = gd.getNextBoolean();
this.cuas_generate = gd.getNextBoolean();
this.cuas_generate_csv = gd.getNextBoolean();
this.cuas_save_mono = gd.getNextBoolean();
this.cuas_save_color = gd.getNextBoolean();
......@@ -4914,6 +4918,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_debug_more", this.cuas_debug_more+""); // boolean
properties.setProperty(prefix+"cuas_generate", this.cuas_generate+""); // boolean
properties.setProperty(prefix+"cuas_generate_csv", this.cuas_generate_csv+""); // boolean
properties.setProperty(prefix+"cuas_save_mono", this.cuas_save_mono+""); // boolean
properties.setProperty(prefix+"cuas_save_color", this.cuas_save_color+""); // boolean
properties.setProperty(prefix+"cuas_save_video", this.cuas_save_video+""); // boolean
......@@ -5974,6 +5979,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_debug_more")!=null) this.cuas_debug_more=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_debug_more"));
if (properties.getProperty(prefix+"cuas_generate")!=null) this.cuas_generate=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_generate"));
if (properties.getProperty(prefix+"cuas_generate_csv")!=null) this.cuas_generate_csv=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_generate_csv"));
if (properties.getProperty(prefix+"cuas_save_mono")!=null) this.cuas_save_mono=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_save_mono"));
if (properties.getProperty(prefix+"cuas_save_color")!=null) this.cuas_save_color=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_save_color"));
if (properties.getProperty(prefix+"cuas_save_video")!=null) this.cuas_save_video=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_save_video"));
......@@ -7034,6 +7040,7 @@ min_str_neib_fpn 0.35
imp.cuas_debug_more = this.cuas_debug_more;
imp.cuas_generate = this.cuas_generate;
imp.cuas_generate_csv = this.cuas_generate_csv;
imp.cuas_save_mono = this.cuas_save_mono;
imp.cuas_save_color = this.cuas_save_color;
imp.cuas_save_video = this.cuas_save_video;
......
......@@ -5929,6 +5929,9 @@ public class QuadCLTCPU {
new FileWriter(file_path, append));
out.write(string);
out.close();
if (!append) { // may be too many in append mode
System.out.println("saveStringInModelDirectory(): saved "+file_path);
}
return true;
} catch (IOException e) {
// Display message when exception occurs
......
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