Commit 956905bd authored by Andrey Filippov's avatar Andrey Filippov

Extracting parameters

parent 5d8a3045
......@@ -4389,6 +4389,14 @@ public class CuasMotion {
int height = image.length/width;
int xl = xc - icon_width/2;
int yt = yc - icon_height/2;
int xr = xc + icon_width/2;
int yb = yc + icon_height/2;
if ((xl < 0) || (yt < 0) || (xr >= width) || (yb >= height)) {
System.out.println("imprintPixelIcon(): outside of the window: xc="+xc+", yc="+yc+", width="+width+", height="+height);
return;
}
for (int y = 0; y < icon_height; y++) {
int py = yt + y;
if ((py >= 0) && (py < height)) {
......@@ -4469,8 +4477,7 @@ public class CuasMotion {
final double ifov = scene.getGeometryCorrection().getIFOV();
final double radar_range = clt_parameters.imp.cuas_radar_range;
final String font_name = clt_parameters.imp.cuas_font_name;
// final int font_size_radar = clt_parameters.imp.cuas_font_size;
final int font_size_radar = 7; // clt_parameters.imp.cuas_font_size;
final int font_size_radar = clt_parameters.imp.cuas_font_size; // 7; //
final double font_ratio_radar = 1.2; // if 0 - will use default spacing ( ~=1.5)
final int font_type = clt_parameters.imp.cuas_font_type;
final Color text_color = clt_parameters.imp.cuas_text_color;
......@@ -4479,16 +4486,15 @@ public class CuasMotion {
final boolean transparent_uas = clt_parameters.imp.cuas_transparent_uas;
final int target_type = clt_parameters.imp.cuas_target_type; // 0; // 0 - unknown, 1 - known, 2 - friend, 3 - foe
final int uas_type = clt_parameters.imp.cuas_known_type; // 2; // Target location matching UAS flight log: 0; // 0 - unknown, 1 - known, 2 - friend, 3 - foe
final boolean reserve_missing_fields = false; // make a parameter.Reserve a line for requested but missing parameters
final boolean scale2x = true;
final int image_scale = 2; // here always 2
final int space_before_text = 2 * image_scale;
final int width = 540; // calculate
final int height = 1024; // calculate
final int radar_height = 950; // 970; // calculate
final int width = 540; // calculate
final int height = 1024; // calculate
final int radar_height = 950; // 970; // calculate
// move to configs:
final int bottom_gap = 10;
final int infinity_gap = 24; // 10; // add to radar_height
......@@ -4559,6 +4565,7 @@ public class CuasMotion {
final AtomicInteger ai = new AtomicInteger(0);
final AtomicInteger amax = new AtomicInteger(-1);
final int [] uas_tiles = new int[num_seq];
Arrays.fill(uas_tiles, -1);
final int [][] local_tiles = new int [num_seq][];
for (int ithread = 0; ithread < threads.length; ithread++) {
......@@ -4576,6 +4583,7 @@ public class CuasMotion {
if (target != null) {
if (!Double.isNaN(target[CuasMotionLMA.RSLT_FL_PX])) {
local_tiles_map.put(0, ntile); // flight log data
max_ltarg = Math.max(max_ltarg, 0);
}
if (!Double.isNaN(target[CuasMotionLMA.RSLT_GLOBAL])) {
int ltarg = (int) target[CuasMotionLMA.RSLT_GLOBAL];
......@@ -4596,10 +4604,9 @@ public class CuasMotion {
}
ImageDtt.startAndJoin(threads);
final int [][] ltargets_first_last = new int [amax.get()][]; // correct
for (int nseq = 0; nseq < num_seq; nseq++) {
for (int nseq = 0; nseq < num_seq; nseq++) if (local_tiles[nseq].length > 0){ // no if is not needed - bug fixed
uas_tiles[nseq] = local_tiles[nseq][0];
}
......@@ -5177,6 +5184,8 @@ public class CuasMotion {
double xc,
double yc,
double radius) {
int width = colorProcessor.getWidth();
int height = colorProcessor.getHeight();
double radius2 = radius*radius;
int icolor = color.getRGB() | 0xff000000; // needed?
if (color != null) colorProcessor.setColor(color);
......@@ -5184,7 +5193,11 @@ public class CuasMotion {
int y0 = (int) Math.floor(yc - radius);
int x1 = (int) Math.ceil (xc + radius);
int y1 = (int) Math.ceil (yc + radius);
int width = colorProcessor.getWidth();
if ((x0 < 0) || (y0 < 0) || (x1 >= width) || (y1 >= height)) {
System.out.println("drawCircle(): outside of the window: xc="+xc+", yc="+yc+", width="+width+", height="+height+
", color="+ color.toString());
return;
}
int [] pixels = (int[]) colorProcessor.getPixels();
for (int y = y0; y <= y1; y++) {
double dy = y-yc;
......@@ -5193,7 +5206,8 @@ public class CuasMotion {
double dx = x-xc;
double r2 = dx*dx + dy2;
if (r2 <= radius2) {
pixels[x+y*width] = icolor;
pixels[x+y*width] = icolor; // java.lang.ArrayIndexOutOfBoundsException: Index -144985 out of bounds for length 552960 at com.elphel.imagej.cuas.CuasMotion.drawCircle(CuasMotion.java:5197) at com.elphel.imagej.cuas.CuasMotion$33.run(CuasMotion.java:4662)
}
}
}
......@@ -6903,7 +6917,7 @@ public class CuasMotion {
*/
public static int [][][] calcMatchingTargetsLengths( // calculate number of consecutive keyframes connected to each target
final double [][][][] targets_multi,
final boolean calc_linked,
final boolean calc_linked, // needed to calculate indices in the order of lengths. But only when there are few targets
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
......@@ -9783,6 +9797,7 @@ public class CuasMotion {
}
final void recalcOmegas(
boolean recalc,
double [][][] target_single,
boolean batch_mode,
int debugLevel){
......@@ -9806,9 +9821,11 @@ public class CuasMotion {
targets_multi, // final double [][][][] targets_multi,
true, // final boolean good_only,
tilesX); // int tilesX) {
recalcOmegas(
targets_multi, // double [][][][] targets_multi,
debugLevel); // int debugLevel){
if (recalc) {
recalcOmegas(
targets_multi, // double [][][][] targets_multi,
debugLevel); // int debugLevel){
}
getHalfBeforeAfterPixXY(
targets_multi, // final double [][][][] targets_multi,
true, // final boolean good_only,
......
......@@ -69,6 +69,8 @@ public class CuasRanging {
boolean rng_img = clt_parameters.imp.cuas_rng_img;
boolean rng_glob = clt_parameters.imp.cuas_rng_glob;
boolean rng_disp = clt_parameters.imp.cuas_rng_disp;
boolean recalc_target_id = true; // temporalily bug fixing, may be removed later
boolean rng_vfy = clt_parameters.imp.cuas_rng_vfy; // Generate/save ranging verification images (per-sensor and combined rendering from the same data)
boolean reset_disparity = clt_parameters.imp.cuas_reset_disparity;
......@@ -282,13 +284,19 @@ public class CuasRanging {
System.out.println ("Recalculating omegas to better fit target positions in consecutive key frames.");
}
cuasMotion.recalcOmegas(
true, // boolean recalc,
targets, // final double [][][] target_single_in,
batch_mode, // boolean batch_mode,
debugLevel); // final int debugLevel){
} else {
cuasMotion.recalcOmegas(
false, // boolean recalc,
targets, // final double [][][] target_single_in,
batch_mode, // boolean batch_mode,
debugLevel); // final int debugLevel){
if (debugLevel > -4) {
System.out.println ("Skipping omegas recalculation omegas.");
System.out.println ("Skipping omegas recalculation omegas, still calculating local target index (called GLOBAL_INDEX).");
}
}
// String model_prefix = center_CLT.getImageName()+CuasMotion.getParametersSuffix(clt_parameters,null);
......@@ -318,6 +326,15 @@ public class CuasRanging {
cuasMotion.getTilesX()); // int tilesX) {
center_CLT.saveImagePlusInModelDirectory(imp_with_range); // ImagePlus imp)
}
} else if (recalc_target_id){// if (disparity_targets == null) {
cuasMotion.recalcOmegas(
false, // boolean recalc,
targets, // final double [][][] target_single_in,
batch_mode, // boolean batch_mode,
debugLevel); // final int debugLevel){
if (debugLevel > -4) {
System.out.println ("(Re)calculating local target index (called GLOBAL_INDEX). May be remolved later");
}
}
}
// calculate range from disparity
......
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