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,
......
......@@ -78,12 +78,17 @@ public class CuasMultiSeries {
model_dirs = new File[num_series];
model_names = new String[num_series];
this.uasLogReader = uasLogReader;
int dbg_nser = 45;
for (int nser = 0; nser < num_series; nser++) {
model_names[nser] = scene_dirs[nser].getName(); // 1747803230_276111-CENTER
model_dirs[nser] = new File(scene_dirs[nser], version);
String target_file_name = model_names[nser]+ CuasMotion.getParametersSuffixRanging(clt_parameters,CuasRanging.TARGET_DISPARITIES_SUFFIX)+".tiff";
File target_file=new File(model_dirs[nser], target_file_name);
String [][] scen_titles_w = new String[1][];
if (nser==dbg_nser) {
System.out.println("-nser="+nser);
}
targets_multi_series[nser] = CuasMotion.getTargetsFromHyperAugment(
null, // String [][] pvf_top_titles,
scen_titles_w, // String [][] pvf_titles,
......@@ -102,17 +107,26 @@ public class CuasMultiSeries {
int i = 0;
for (; i < linked_targets_multi[nser][ntarg].length; i++) {
if (linked_targets_multi[nser][ntarg][i] != null) {
targets_start_end[nser][ntarg][0] = i;
targets_start_end[nser][ntarg][0] = i;
break;
}
}
for ( i++; i < linked_targets_multi[nser][ntarg].length; i++) {
if (linked_targets_multi[nser][ntarg][i] == null) {
break;
if (i >= linked_targets_multi[nser][ntarg].length) {
targets_start_end[nser][ntarg] = new int[0];
} else {
for ( i++; i < linked_targets_multi[nser][ntarg].length; i++) {
if (linked_targets_multi[nser][ntarg][i] == null) {
break;
}
}
targets_start_end[nser][ntarg][1] = i-1;
// targets_start_end[nser][ntarg][1] = i-1;
// p.y = i-1;
// tlist.add(p);
}
targets_start_end[nser][ntarg][1] = i-1;
}
}
recalculateAllRanges(
targets_multi_series, // final double [][][][] targets_multi_series, // [nser][nseq][ntile][nfield]
......@@ -209,14 +223,17 @@ public class CuasMultiSeries {
double pts_scale = clt_parameters.imp.video_fps/clt_parameters.imp.sensor_fps;
pts_scale = 1.0;
String shellCommand;
//ffmpeg -i input_file.mkv -c copy -metadata:s:v:0 stereo_mode=1 output_file.mkv
//https://ffmpeg.org/ffmpeg-formats.html
//ffmpeg -i sample_left_right_clip.mpg -an -c:v libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
//anaglyph_cyan_red
shellCommand = String.format("ffmpeg -y -f concat -safe 0 -i %s -r 60 -vf setpts=%f*PTS -b:v %fM -crf %d -c %s %s",
list_to_concat.toString(), pts_scale, video_bitrate_m, video_crf_combo, video_codec_combo, video_out.toString());
/*
when called from java, ffmpeg terminated in ~5min and 848MB, but java continued to wait
For now - just run command manually by copying the shellCommand
*/
shellCommand = String.format("ffmpeg -y -f concat -safe 0 -i %s -r 60 -vf setpts=%f*PTS -b:v %fM -crf %d -c %s %s",
list_to_concat.toString(), pts_scale, video_bitrate_m, video_crf_combo, video_codec_combo, video_out.toString());
Process p = null;
int exit_code = -1;
System.out.println("Will run shell command: \""+shellCommand+"\"");
......@@ -280,7 +297,7 @@ public class CuasMultiSeries {
//
ImagePlus imp_radar = testGenerateRadarImage(
clt_parameters, // CLTParameters clt_parameters,
3, // 15, // int nser,
45, // 3, // 15, // int nser,
uasLogReader, // UasLogReader uasLogReader, // contains camera orientation (getCameraATR())
debugLevel); // int debugLevel) {
return;
......@@ -403,10 +420,15 @@ public class CuasMultiSeries {
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
final AtomicInteger amiss = new AtomicInteger(0);
final int dbg_nser = 45;
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nSer = ai.getAndIncrement(); nSer < targets_multi_series.length; nSer = ai.getAndIncrement()) {
if (nSer==dbg_nser) {
System.out.println("-nser="+nSer);
}
for (int nseq = 0; nseq < targets_multi_series[nSer].length; nseq++) {
for (int ntile = 0; ntile < targets_multi_series[nSer][nseq].length; ntile++) {
double [] target = targets_multi_series[nSer][nseq][ntile];
......@@ -441,10 +463,14 @@ public class CuasMultiSeries {
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
final AtomicInteger aglob = new AtomicInteger(0);
final int dbg_nser = 45;
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nSer = ai.getAndIncrement(); nSer < targets_multi_series.length; nSer = ai.getAndIncrement()) {
if (nSer==dbg_nser) {
System.out.println("-nser="+nSer);
}
int [][][] ltargets = linked_targets_multi[nSer];
double [][][] mtargets = targets_multi_series[nSer];
int [] utiles = uas_tiles[nSer];
......@@ -557,17 +583,21 @@ public class CuasMultiSeries {
}
// skip pairs that have global target_id >0 (at least skip UAS
for (int ntarg = 0; ntarg < num_targ; ntarg++) if (!skip_assigned ||(target_map[nSer][ntarg] <= 0)) { // no globally assigned
for (int ntarg1 = ntarg+1; ntarg1 < num_targ; ntarg1++) if (!skip_assigned || (target_map[nSer][ntarg1] <= 0)) { // no globally assigned
if (targets_start_end[nSer][ntarg][1] < targets_start_end[nSer][ntarg1][0]) {
if ((targets_start_end[nSer][ntarg1][0] - targets_start_end[nSer][ntarg][1]) <= tmtch_gaps) {
after[ntarg][ntarg1] = true; // ntarg1 is after ntarg
num_after++;
}
}
if (targets_start_end[nSer][ntarg1][1] < targets_start_end[nSer][ntarg][0]) {
if ((targets_start_end[nSer][ntarg][0] - targets_start_end[nSer][ntarg1][1]) <= tmtch_gaps) {
after[ntarg1][ntarg] = true; // ntarg1 is after ntarg
num_after++;
if (targets_start_end[nSer][ntarg].length > 0) { // now, start,end pair may be [] if all were NaN
for (int ntarg1 = ntarg+1; ntarg1 < num_targ; ntarg1++) if (!skip_assigned || (target_map[nSer][ntarg1] <= 0)) { // no globally assigned
if (targets_start_end[nSer][ntarg1].length > 0) {
if (targets_start_end[nSer][ntarg][1] < targets_start_end[nSer][ntarg1][0]) {
if ((targets_start_end[nSer][ntarg1][0] - targets_start_end[nSer][ntarg][1]) <= tmtch_gaps) {
after[ntarg][ntarg1] = true; // ntarg1 is after ntarg
num_after++;
}
}
if (targets_start_end[nSer][ntarg1][1] < targets_start_end[nSer][ntarg][0]) {
if ((targets_start_end[nSer][ntarg][0] - targets_start_end[nSer][ntarg1][1]) <= tmtch_gaps) {
after[ntarg1][ntarg] = true; // ntarg1 is after ntarg
num_after++;
}
}
}
}
}
......@@ -735,108 +765,112 @@ public class CuasMultiSeries {
if (targs0.length > 0){
int ntarg0 = targs0[targs0.length -1]; // last if several are connected
if (!skip_assigned || (target_map[prev_ser][ntarg0] <= 0)) { // not globally assigned
int nseq0 = targets_start_end[prev_ser][ntarg0][1]; // end of the last segment in previous series
int end_gap = linked_targets_multi[prev_ser][ntarg0].length -1 - nseq0;
if (end_gap <= tmtch_ends) {
int ntile0 = linked_targets_multi[prev_ser][ntarg0][nseq0][0];
double [] target0 = targets_multi_series[prev_ser][nseq0][ntile0];
double ts0 = QuadCLT.getTimeStamp(scene_titles[prev_ser][nseq0]);
for (int ntgrp1 = 0; ntgrp1 < local_imap[nSer].length; ntgrp1++) {
int [] targs1 = local_imap[nSer][ntgrp1];
if (targs1.length > 0){
int ntarg1 = targs1[0]; // first if several are connected
if (!skip_assigned || (target_map[nSer][ntarg1] <= 0)) { // no globally assigned
int nseq1 = targets_start_end[nSer][ntarg1][0]; // start of the first segment in this series
if (nseq1 <= tmtch_ends) {
int ntile1 = linked_targets_multi[nSer][ntarg1][nseq1][0];
double [] target1 = targets_multi_series[nSer][nseq1][ntile1];
double ts1 = QuadCLT.getTimeStamp(scene_titles[nSer][nseq1]);
double dt = ts1-ts0;
double lat_err2 = getMispatch2(
clt_parameters, //CLTParameters clt_parameters
target0, // double [] target0,
target1, // double [] target1,
scene_titles[prev_ser][nseq0], // String sts0,
scene_titles[nSer][nseq1], // String sts1,
ntile0, // int ntile0,
ntile1, // int ntile1,
tilesX, // int tilesX,
tileSize, // int tileSize,
fps); // double fps,
double max_lat_err = tmtch_apix + tmtch_rpix * dt;
// calculate maximal allowable error adding time difference
double max_lat_err2 = max_lat_err * max_lat_err;
if (lat_err2 <= max_lat_err2) {
// calculate axial error and verify, print debug
// TODO: average ranging if there are several local targets corresponding to the same object
double [] middle_target0 = getMiddleTarget(
prev_ser, // int nser,
ntarg0, // int local_target)
null); // int [] seq_tile) {
if (targets_start_end[prev_ser][ntarg0].length > 0) { // now, start,end pair may be [] if all were NaN
int nseq0 = targets_start_end[prev_ser][ntarg0][1]; // end of the last segment in previous series
int end_gap = linked_targets_multi[prev_ser][ntarg0].length -1 - nseq0;
if (end_gap <= tmtch_ends) {
int ntile0 = linked_targets_multi[prev_ser][ntarg0][nseq0][0];
double [] target0 = targets_multi_series[prev_ser][nseq0][ntile0];
double ts0 = QuadCLT.getTimeStamp(scene_titles[prev_ser][nseq0]);
for (int ntgrp1 = 0; ntgrp1 < local_imap[nSer].length; ntgrp1++) {
int [] targs1 = local_imap[nSer][ntgrp1];
if (targs1.length > 0){
int ntarg1 = targs1[0]; // first if several are connected
if (!skip_assigned || (target_map[nSer][ntarg1] <= 0)) { // no globally assigned
if (targets_start_end[nSer][ntarg1].length > 0) { // now, start,end pair may be [] if all were NaN
int nseq1 = targets_start_end[nSer][ntarg1][0]; // start of the first segment in this series
if (nseq1 <= tmtch_ends) {
int ntile1 = linked_targets_multi[nSer][ntarg1][nseq1][0];
double [] target1 = targets_multi_series[nSer][nseq1][ntile1];
double ts1 = QuadCLT.getTimeStamp(scene_titles[nSer][nseq1]);
double dt = ts1-ts0;
double lat_err2 = getMispatch2(
clt_parameters, //CLTParameters clt_parameters
target0, // double [] target0,
target1, // double [] target1,
scene_titles[prev_ser][nseq0], // String sts0,
scene_titles[nSer][nseq1], // String sts1,
ntile0, // int ntile0,
ntile1, // int ntile1,
tilesX, // int tilesX,
tileSize, // int tileSize,
fps); // double fps,
double max_lat_err = tmtch_apix + tmtch_rpix * dt;
// calculate maximal allowable error adding time difference
double max_lat_err2 = max_lat_err * max_lat_err;
if (lat_err2 <= max_lat_err2) {
// calculate axial error and verify, print debug
// TODO: average ranging if there are several local targets corresponding to the same object
double [] middle_target0 = getMiddleTarget(
prev_ser, // int nser,
ntarg0, // int local_target)
null); // int [] seq_tile) {
double [] middle_target1 = getMiddleTarget(
nSer, // int nser,
ntarg1, // int local_target)
null); // int [] seq_tile) {
double [] middle_target1 = getMiddleTarget(
nSer, // int nser,
ntarg1, // int local_target)
null); // int [] seq_tile) {
// only check matches if disparity is sufficient
boolean range_match = false;
double md0 = (middle_target0 == null) ? 0: middle_target0[CuasMotionLMA.RSLT_GDISPARITY];
double md1 = (middle_target1 == null) ? 0: middle_target1[CuasMotionLMA.RSLT_GDISPARITY];
if (Math.abs(md1-md0) < tmtch_disp_diff) { // false for NaN
range_match = true;
/*
// only check matches if disparity is sufficient
boolean range_match = false;
double md0 = (middle_target0 == null) ? 0: middle_target0[CuasMotionLMA.RSLT_GDISPARITY];
double md1 = (middle_target1 == null) ? 0: middle_target1[CuasMotionLMA.RSLT_GDISPARITY];
if (Math.abs(md1-md0) < tmtch_disp_diff) { // false for NaN
range_match = true;
/*
if ((middle_target0 != null) && (middle_target1 != null) && // do not have measured disparity at all
(middle_target0[CuasMotionLMA.RSLT_GDISPARITY] > min_disp) &&
(middle_target1[CuasMotionLMA.RSLT_GDISPARITY] > min_disp)) {
*/
if ((md0 > min_disp) && (md1 > min_disp)) {
double range0 = middle_target0[CuasMotionLMA.RSLT_GRANGE];
double range1 = middle_target1[CuasMotionLMA.RSLT_GRANGE];
double avelocity = (range1 - range0)/dt;
double lvelocity = getLateralVelocity (
clt_parameters, //CLTParameters clt_parameters,
gc, // GeometryCorrection gc,
middle_target0, // double [] target0, // should contain RSLT_VX, RSLT_VX, RSLT_GRANGE,
middle_target1, // double [] target1, // should contain RSLT_VX, RSLT_VX, RSLT_GRANGE,
fps); // double fps){ // velocity_scale times fps
double max_axial_velocity = Math.max(tmtch_axv, lvelocity * tmtch_axv_k);
if (Math.abs (avelocity) > max_axial_velocity) {
range_match = false;
}
if (debug) {
System.out.println("combineGlobalTargets(): nSer="+nSer+", ntarg0="+ntarg0+", ntarg1="+ntarg1+
", range0="+range0+", range1="+range1+", avelocity="+avelocity+"m/s, lvelocity="+
lvelocity+"m/s, disparity="+
middle_target0[CuasMotionLMA.RSLT_GDISPARITY]+
":"+middle_target1[CuasMotionLMA.RSLT_GDISPARITY] +
", max_axial_velocity="+max_axial_velocity+"m/s, range_match="+range_match);
*/
if ((md0 > min_disp) && (md1 > min_disp)) {
double range0 = middle_target0[CuasMotionLMA.RSLT_GRANGE];
double range1 = middle_target1[CuasMotionLMA.RSLT_GRANGE];
double avelocity = (range1 - range0)/dt;
double lvelocity = getLateralVelocity (
clt_parameters, //CLTParameters clt_parameters,
gc, // GeometryCorrection gc,
middle_target0, // double [] target0, // should contain RSLT_VX, RSLT_VX, RSLT_GRANGE,
middle_target1, // double [] target1, // should contain RSLT_VX, RSLT_VX, RSLT_GRANGE,
fps); // double fps){ // velocity_scale times fps
double max_axial_velocity = Math.max(tmtch_axv, lvelocity * tmtch_axv_k);
if (Math.abs (avelocity) > max_axial_velocity) {
range_match = false;
}
if (debug) {
System.out.println("combineGlobalTargets(): nSer="+nSer+", ntarg0="+ntarg0+", ntarg1="+ntarg1+
", range0="+range0+", range1="+range1+", avelocity="+avelocity+"m/s, lvelocity="+
lvelocity+"m/s, disparity="+
middle_target0[CuasMotionLMA.RSLT_GDISPARITY]+
":"+middle_target1[CuasMotionLMA.RSLT_GDISPARITY] +
", max_axial_velocity="+max_axial_velocity+"m/s, range_match="+range_match);
}
} else {
if (debug) {
//double disp0 = (middle_target0 == null)? Double.NaN: middle_target0[CuasMotionLMA.RSLT_GDISPARITY];
//double disp1 = (middle_target1 == null)? Double.NaN: middle_target1[CuasMotionLMA.RSLT_GDISPARITY];
System.out.println("combineGlobalTargets(): nSer="+nSer+", ntarg0="+ntarg0+", ntarg1="+ntarg1+
". Bypassing axial matching - disparity="+md0+
":"+md1+" < "+min_disp+" .");
}
}
} else {
if (debug) {
System.out.println("combineGlobalTargets(): nSer="+nSer+", ntarg0="+ntarg0+", ntarg1="+ntarg1+
", disparity0="+md0+", disparity1="+md1+
". Disparity difference="+Math.abs(md1-md0)+" is not less than "+tmtch_disp_diff+" .");
}
}
} else {
if (debug) {
//double disp0 = (middle_target0 == null)? Double.NaN: middle_target0[CuasMotionLMA.RSLT_GDISPARITY];
//double disp1 = (middle_target1 == null)? Double.NaN: middle_target1[CuasMotionLMA.RSLT_GDISPARITY];
System.out.println("combineGlobalTargets(): nSer="+nSer+", ntarg0="+ntarg0+", ntarg1="+ntarg1+
". Bypassing axial matching - disparity="+md0+
":"+md1+" < "+min_disp+" .");
if (range_match) {
pair_list.add(new Point(ntarg0, ntarg1));
}
}
} else {
if (debug) {
System.out.println("combineGlobalTargets(): nSer="+nSer+", ntarg0="+ntarg0+", ntarg1="+ntarg1+
", disparity0="+md0+", disparity1="+md1+
". Disparity difference="+Math.abs(md1-md0)+" is not less than "+tmtch_disp_diff+" .");
}
}
if (range_match) {
pair_list.add(new Point(ntarg0, ntarg1));
}
}
}
}
}
}
}
}
}
}
} // for (int ntgrp0 = 0; ntgrp0 < local_imap[prev_ser].length; ntgrp0++) {
......
......@@ -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
......
......@@ -40,6 +40,17 @@ public class IntersceneMatchParameters {
public static String [] FLT_ALT_MODES = {"--- (no ALT filter)", "ALT only", "no ALT only"};
public static String [] FLT_ORIENT_MODES = {"--- (no ORIENT filter)", "ORIENT only", "no ORIENT only"};
public static Color DEFAULT_TARGET_TEXT_COLOR = new Color (0, 255, 255); // 220);
public static Color anaglyph_left_default = new Color (255, 0, 0); // red
public static Color anaglyph_right_default =new Color (0, 255, 255); // cyan
public static Color DEFAULT_cuas_text_color = new Color ( 0, 255, 0);// 220);
public static Color DEFAULT_cuas_text_bg = new Color (127, 127, 127);// 220);
public static Color DEFAULT_cuas_selected_color= new Color (127, 0, 255);// 220);
public static Color DEFAULT_cuas_radar_uas_color =new Color( 0,100,140);
public static Color DEFAULT_cuas_radar_color = new Color( 0,255,100);
public static Color DEFAULT_cuas_grid_color = new Color(100,100,100);
// Maybe add parameters to make sure there is enough data? Enough in each zone? Enough spread?
public boolean ims_use = true; // use IMS data
......@@ -845,15 +856,19 @@ min_str_neib_fpn 0.35
public boolean cuas_annotate = true; // save color rendered images (same as videos)
public boolean cuas_annotate_uas = true; // indicate uas from log if available
public Color cuas_text_color = new Color ( 0, 255, 0);// 220);
public Color cuas_text_bg = new Color (127, 127, 127);// 220);
public Color cuas_selected_color= new Color (127, 0, 255);// 220);
public Color cuas_text_color = DEFAULT_cuas_text_color; // new Color ( 0, 255, 0);// 220);
public Color cuas_text_bg = DEFAULT_cuas_text_bg; // new Color (127, 127, 127);// 220);
public Color cuas_selected_color= DEFAULT_cuas_selected_color; // new Color (127, 0, 255);// 220);
public boolean cuas_transparent = true; // text bg for other targets
public boolean cuas_transparent_uas=false; // text bg for UAS
public String cuas_font_name = "Monospaced";
public int cuas_font_size = 8; // before scaling
public int cuas_font_type = 1; // 0 - PLAIN, 1 - BOLD, 2 - ITALIC
public double cuas_font_spacing = 1.2; //height to size ratio. If 0 - will use default spacing ( ~=1.5)
public boolean cuas_annot_missing = false; // Reserve a line for requested but missing parameters
// AZ/EL calibration
@Deprecated
public double cuas_ifov = 0.05; // degree per pixel Use gc.getIFOVDegrees() and gc.getIFOV() instead
......@@ -920,7 +935,7 @@ min_str_neib_fpn 0.35
public double cuas_tmtch_frac = 0.8; // target should match flight log in theis fraction of keyframes
public int cuas_tmtch_ends = 6; // 2; // maximal number of undetected first/last keyframes to compare to previous/next sequence
public int cuas_tmtch_gaps = 10; // 4; // maximal number of consecutive undetected keyframes of the same target
public double cuas_tmtch_pix = 10.0; // maximal pixel mismatch for UAS target
public double cuas_tmtch_pix = 25.0; // maximal pixel mismatch for UAS target
public double cuas_local_apix = 2.0; // maximal absolute pixel mismatch for local targets matching (tightened)
public double cuas_tmtch_apix = 5.0; // 10.0; // maximal absolute pixel mismatch for the same target extrapolated with the average of the before/after lateral speeds
public double cuas_tmtch_rpix = 1.0; // maximal pixel/s mismatch for the same target extrapolated with the average of the before/after lateral speeds
......@@ -933,6 +948,24 @@ min_str_neib_fpn 0.35
// parameters for "radar" image generation
public double cuas_radar_range = 1500.0; // maximal radar range in meters
public int cuas_radar_height = 950; // height of the radar finite range view (pix)
public int cuas_radar_bottom = 10; // radar window bottom margin
public int cuas_radar_top = 24; // infinity targets from window top
public Color cuas_radar_uas_color = DEFAULT_cuas_radar_uas_color; // new Color( 0,100,140); True UAS position sircle
public Color cuas_radar_color = DEFAULT_cuas_radar_color; //new Color( 0,255,100); Detected color
public double cuas_radar_radius = 2.5;
public double cuas_radar_uas_rad = 4.0;
// parameters for "radar" grid generation
public double cuas_grid_ring = 100.0; // (m) range rings step in meters
public double cuas_grid_line = 5.0; // (deg) grid axial directions step
public boolean cuas_grid_annot =true; // annotate grid
public Color cuas_grid_color = DEFAULT_cuas_grid_color; // new Color(100,100,100); // Radar grid and grid annotations color
public int cuas_grid_font = 7; // before scaling
public int cuas_grid_az_top = 5; // where to put azimuth
public int cuas_grid_sides = 5; // grid annotation from left/right
// debug parameters
public boolean cuas_debug = false; // save debug images (and show them if not in batch mode)
......@@ -1034,15 +1067,13 @@ min_str_neib_fpn 0.35
public boolean mono_fixed = true; // normalize to fixed range when converting to 8 bits
public double mono_range = 500.0; // monochrome full-scale range (+/- half)
public boolean anaglyth_en = true; // applies to both TIFF and AVI
public static Color anaglyph_left_default = new Color (255, 0, 0); // red
public static Color anaglyph_right_default =new Color (0, 255, 255); // cyan
public Color anaglyph_left = anaglyph_left_default;
public Color anaglyph_right = anaglyph_right_default; // cyan
public boolean annotate_color = true; // annotate pseudo-color video frames with timestamps
public boolean annotate_mono = true; // annotate monochrome video frames with timestamps
public Color annotate_color_color =new Color( 255, 255, 255); // greenish over "fire"
public Color annotate_color_mono = new Color( 255, 180, 50); // reddish over grey
public Color annotate_color_mono = new Color( 255, 180, 50); // reddish over grey
public boolean annotate_transparent_mono = false; // // black if not transparent
public String terr_model_path = "/media/elphel/SSD3-4GB/lwir16-proc/berdich3/models/models_1697875868-1697879449-b/1697877487_245877/v35";
......@@ -2645,8 +2676,10 @@ min_str_neib_fpn 0.35
"Font size befoerr image scaling. Scaled images use proportionally scaled font .");
gd.addNumericField("Font type", this.cuas_font_type, 0,3,"",
"Font type: 0 - PLAIN, 1 - BOLD, 2 - ITALIC.");
gd.addNumericField("IFOV", this.cuas_ifov, 5,8,"degree/pixel",
"Angular size (degrees) of one pixel.");
gd.addNumericField("Font spacing", this.cuas_font_spacing, 5,8,"x",
"Height to size ratio. If 0 - will use default spacing ( ~=1.5).");
gd.addCheckbox ("Reserve lines for undefined parameters", this.cuas_annot_missing,
"Reserve linee for requested but missing parameters.");
gd.addNumericField("Known image pixel X coordinate", this.cuas_px0, 0,3,"",
"Image pixel X corresponding to the known azimuth.");
gd.addNumericField("Known image pixel X coordinate", this.cuas_py0, 0,3,"",
......@@ -2782,9 +2815,41 @@ min_str_neib_fpn 0.35
"Minimal disparity (any should be above) to estimate lateral velocity (smaller - match2d only).");
gd.addCheckbox ("Prefer shortest gap", this.cuas_tmtch_short,
"When multiple conflicting matches, prefer shortest gap (false - longest combo pair length).");
gd.addMessage("=== Radar image generation (check Radar mode below) ===");
gd.addNumericField("Maximal Radar distance", this.cuas_radar_range, 5,8,"m",
"Maximal Radar range in meters.");
gd.addNumericField("Radar finite range targets view height", this.cuas_radar_height, 0,3,"pix",
"Height of the radar finite range view.");
gd.addNumericField("Radar view bottom margin", this.cuas_radar_bottom, 0,3,"pix",
"Radar window bottom margin).");
gd.addNumericField("Debug ranging scene (-1 - process all)", this.cuas_radar_top, 0,3,"pix",
"Far (infinity) targets offset from window top.");
gd.addStringField ("True UAS location color", getStringColor(cuas_radar_uas_color, DEFAULT_cuas_radar_uas_color), 8,
"6-character hex value. Any wrong hex value will be replaced by the default - "+getStringColor(DEFAULT_cuas_radar_uas_color));
gd.addStringField ("Targets location color", getStringColor(cuas_radar_uas_color,DEFAULT_cuas_radar_color), 8,
"6-character hex value. Any wrong hex value will be replaced by the default - "+getStringColor(DEFAULT_cuas_radar_color));
gd.addNumericField("Detected targets circle radius", this.cuas_radar_radius, 5,8,"pix",
"Radius of the detected targets location circle. Should be less than that of the true UAS circle");
gd.addNumericField("True UAS location circle radius", this.cuas_radar_uas_rad, 5,8,"pix",
"Radius of the true UAS location circle. Should be greater than that of the detected targets rendered on top.");
gd.addMessage("=== Radar grid generation ===");
gd.addNumericField("Range circles interval", this.cuas_grid_ring, 5,8,"m",
"Range rings step in meters.");
gd.addNumericField("Aziuth grid lines interval", this.cuas_grid_line, 5,8,"degree",
"Azimuth lines step in degrees.");
gd.addCheckbox ("Annotate grid rings/lines", this.cuas_grid_annot,
"Annotate grid circles/lines wityh numerical values.");
gd.addStringField ("Grid lines/text color", getStringColor(cuas_grid_color,DEFAULT_cuas_grid_color), 8,
"6-character hex value. Any wrong hex value will be replaced by the default - "+getStringColor(DEFAULT_cuas_grid_color));
gd.addNumericField("Grid font size", this.cuas_grid_font, 0,3,"pix",
"Grid font size (before scaling by 2 for compatibility).");
gd.addNumericField("Azimuth annotations offset", this.cuas_grid_az_top, 0,3,"pix",
"Absolute Y-position of the bottom of the azimuth annotations.");
gd.addNumericField("Grid annotations margins from righht/left", this.cuas_grid_sides, 0,3,"pix",
"Grid annotations margins from left/right of the Radar pane.");
gd.addMessage("=== Debug ===");
gd.addCheckbox ("Save/show debug images", this.cuas_debug,
......@@ -3937,7 +4002,8 @@ min_str_neib_fpn 0.35
this.cuas_font_name = gd.getNextString();
this.cuas_font_size = (int) gd.getNextNumber();
this.cuas_font_type = (int) gd.getNextNumber();
this.cuas_ifov = gd.getNextNumber();
this.cuas_font_spacing = gd.getNextNumber();
this.cuas_annot_missing = gd.getNextBoolean();
this.cuas_px0 = (int) gd.getNextNumber();
this.cuas_py0 = (int) gd.getNextNumber();
this.cuas_az0 = gd.getNextNumber();
......@@ -4007,6 +4073,28 @@ min_str_neib_fpn 0.35
this.cuas_tmtch_short = gd.getNextBoolean();
this.cuas_radar_range= gd.getNextNumber();
this.cuas_radar_height = (int) gd.getNextNumber();
this.cuas_radar_bottom = (int) gd.getNextNumber();
this.cuas_radar_top = (int) gd.getNextNumber();
this.cuas_radar_uas_color = getColorFromHex(
gd.getNextString(), //String hex_color,
DEFAULT_cuas_radar_uas_color); // Color default_color)
this.cuas_radar_color = getColorFromHex(
gd.getNextString(), //String hex_color,
DEFAULT_cuas_radar_color); // Color default_color)
this.cuas_radar_radius = gd.getNextNumber();
this.cuas_radar_uas_rad = gd.getNextNumber();
// Radar grid generation
this.cuas_grid_ring = gd.getNextNumber();
this.cuas_grid_line = gd.getNextNumber();
this.cuas_grid_annot = gd.getNextBoolean();
this.cuas_grid_color = getColorFromHex(
gd.getNextString(), //String hex_color,
DEFAULT_cuas_grid_color); // Color default_color)
this.cuas_grid_font = (int) gd.getNextNumber();
this.cuas_grid_az_top = (int) gd.getNextNumber();
this.cuas_grid_sides = (int) gd.getNextNumber();
this.cuas_debug = gd.getNextBoolean();
this.cuas_dbg_rng_seq = (int) gd.getNextNumber();
......@@ -5047,7 +5135,8 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_font_name", this.cuas_font_name+""); // String
properties.setProperty(prefix+"cuas_font_size", this.cuas_font_size+""); // int
properties.setProperty(prefix+"cuas_font_type", this.cuas_font_type+""); // int
properties.setProperty(prefix+"cuas_ifov", this.cuas_ifov+""); // double
properties.setProperty(prefix+"cuas_font_spacing", this.cuas_font_spacing+""); // double
properties.setProperty(prefix+"cuas_annot_missing", this.cuas_annot_missing+""); // boolean
properties.setProperty(prefix+"cuas_px0", this.cuas_px0+""); // int
properties.setProperty(prefix+"cuas_py0", this.cuas_py0+""); // int
properties.setProperty(prefix+"cuas_az0", this.cuas_az0+""); // double
......@@ -5118,6 +5207,28 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_tmtch_short", this.cuas_tmtch_short+""); // boolean
properties.setProperty(prefix+"cuas_radar_range", this.cuas_radar_range+""); // double
properties.setProperty(prefix+"cuas_radar_height", this.cuas_radar_height+""); // int
properties.setProperty(prefix+"cuas_radar_bottom", this.cuas_radar_bottom+""); // int
properties.setProperty(prefix+"cuas_radar_top", this.cuas_radar_top+""); // int
properties.setProperty(prefix+"cuas_radar_uas_color", getStringColor(this.cuas_radar_uas_color, DEFAULT_cuas_radar_uas_color)); // Color
properties.setProperty(prefix+"cuas_radar_color", getStringColor(this.cuas_radar_color, DEFAULT_cuas_radar_color)); // Color
properties.setProperty(prefix+"cuas_radar_radius", this.cuas_radar_radius+""); // double
properties.setProperty(prefix+"cuas_radar_uas_rad", this.cuas_radar_uas_rad+""); // double
properties.setProperty(prefix+"cuas_grid_ring", this.cuas_grid_ring+""); // double
properties.setProperty(prefix+"cuas_grid_line", this.cuas_grid_line+""); // double
properties.setProperty(prefix+"cuas_grid_annot", this.cuas_grid_annot+""); // boolean
properties.setProperty(prefix+"cuas_grid_color", getStringColor(this.cuas_grid_color, DEFAULT_cuas_grid_color)); // Color
properties.setProperty(prefix+"cuas_grid_font", this.cuas_grid_font+""); // int
properties.setProperty(prefix+"cuas_grid_az_top", this.cuas_grid_az_top+""); // int
properties.setProperty(prefix+"cuas_grid_sides", this.cuas_grid_sides+""); // int
properties.setProperty(prefix+"cuas_debug", this.cuas_debug+""); // boolean
properties.setProperty(prefix+"cuas_dbg_rng_seq", this.cuas_dbg_rng_seq+""); // int
......@@ -6134,7 +6245,8 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_font_name")!= null) cuas_font_name=(String) properties.getProperty(prefix+"cuas_font_name");
if (properties.getProperty(prefix+"cuas_font_size")!=null) this.cuas_font_size=Integer.parseInt(properties.getProperty(prefix+"cuas_font_size"));
if (properties.getProperty(prefix+"cuas_font_type")!=null) this.cuas_font_type=Integer.parseInt(properties.getProperty(prefix+"cuas_font_type"));
if (properties.getProperty(prefix+"cuas_ifov")!=null) this.cuas_ifov=Double.parseDouble(properties.getProperty(prefix+"cuas_ifov"));
if (properties.getProperty(prefix+"cuas_font_spacing")!=null) this.cuas_font_spacing=Double.parseDouble(properties.getProperty(prefix+"cuas_font_spacing"));
if (properties.getProperty(prefix+"cuas_annot_missing")!=null) this.cuas_annot_missing=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_annot_missing"));
if (properties.getProperty(prefix+"cuas_px0")!=null) this.cuas_px0=Integer.parseInt(properties.getProperty(prefix+"cuas_px0"));
if (properties.getProperty(prefix+"cuas_py0")!=null) this.cuas_py0=Integer.parseInt(properties.getProperty(prefix+"cuas_py0"));
if (properties.getProperty(prefix+"cuas_az0")!=null) this.cuas_az0=Double.parseDouble(properties.getProperty(prefix+"cuas_az0"));
......@@ -6205,7 +6317,27 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_tmtch_short")!=null) this.cuas_tmtch_short=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_tmtch_short"));
if (properties.getProperty(prefix+"cuas_radar_range")!=null) this.cuas_radar_range=Double.parseDouble(properties.getProperty(prefix+"cuas_radar_range"));
if (properties.getProperty(prefix+"cuas_radar_height")!=null) this.cuas_radar_height=Integer.parseInt(properties.getProperty(prefix+"cuas_radar_height"));
if (properties.getProperty(prefix+"cuas_radar_bottom")!=null) this.cuas_radar_bottom=Integer.parseInt(properties.getProperty(prefix+"cuas_radar_bottom"));
if (properties.getProperty(prefix+"cuas_radar_top")!=null) this.cuas_radar_top=Integer.parseInt(properties.getProperty(prefix+"cuas_radar_top"));
if (properties.getProperty(prefix+"cuas_radar_uas_color")!=null) this.cuas_radar_uas_color = getColorFromHex(
properties.getProperty(prefix+"cuas_radar_uas_color"), // String hex_color,
DEFAULT_cuas_radar_uas_color); // Color default_color)
if (properties.getProperty(prefix+"cuas_radar_color")!=null) this.cuas_radar_color = getColorFromHex(
properties.getProperty(prefix+"cuas_radar_color"), // String hex_color,
DEFAULT_cuas_radar_color); // Color default_color)
if (properties.getProperty(prefix+"cuas_radar_radius")!=null) this.cuas_radar_radius=Double.parseDouble(properties.getProperty(prefix+"cuas_radar_radius"));
if (properties.getProperty(prefix+"cuas_radar_uas_rad")!=null) this.cuas_radar_uas_rad=Double.parseDouble(properties.getProperty(prefix+"cuas_radar_uas_rad"));
if (properties.getProperty(prefix+"cuas_grid_ring")!=null) this.cuas_grid_ring=Double.parseDouble(properties.getProperty(prefix+"cuas_grid_ring"));
if (properties.getProperty(prefix+"cuas_grid_line")!=null) this.cuas_grid_line=Double.parseDouble(properties.getProperty(prefix+"cuas_grid_line"));
if (properties.getProperty(prefix+"cuas_grid_annot")!=null) this.cuas_grid_annot=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_grid_annot"));
if (properties.getProperty(prefix+"cuas_grid_color")!=null) this.cuas_grid_color = getColorFromHex(
properties.getProperty(prefix+"cuas_grid_color"), // String hex_color,
DEFAULT_cuas_grid_color); // Color default_color)
if (properties.getProperty(prefix+"cuas_grid_font")!=null) this.cuas_grid_font=Integer.parseInt(properties.getProperty(prefix+"cuas_grid_font"));
if (properties.getProperty(prefix+"cuas_grid_az_top")!=null) this.cuas_grid_az_top=Integer.parseInt(properties.getProperty(prefix+"cuas_grid_az_top"));
if (properties.getProperty(prefix+"cuas_grid_sides")!=null) this.cuas_grid_sides=Integer.parseInt(properties.getProperty(prefix+"cuas_grid_sides"));
if (properties.getProperty(prefix+"cuas_debug")!=null) this.cuas_debug=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_debug"));
if (properties.getProperty(prefix+"cuas_dbg_rng_seq")!=null) this.cuas_dbg_rng_seq=Integer.parseInt(properties.getProperty(prefix+"cuas_dbg_rng_seq"));
if (properties.getProperty(prefix+"cuas_dbg_rng_tgt")!=null) this.cuas_dbg_rng_tgt=Integer.parseInt(properties.getProperty(prefix+"cuas_dbg_rng_tgt"));
......@@ -7200,7 +7332,7 @@ min_str_neib_fpn 0.35
imp.cuas_annotate = this.cuas_annotate;
imp.cuas_annotate_uas = this.cuas_annotate_uas;
imp.cuas_text_color= this.cuas_text_color;
imp.cuas_text_color= this.cuas_text_color; // Color is immutable, no need to clone
imp.cuas_text_bg= this.cuas_text_bg;
imp.cuas_selected_color= this.cuas_selected_color;
......@@ -7209,7 +7341,8 @@ min_str_neib_fpn 0.35
imp.cuas_font_name = this.cuas_font_name;
imp.cuas_font_size = this.cuas_font_size;
imp.cuas_font_type = this.cuas_font_type;
imp.cuas_ifov = this.cuas_ifov;
imp.cuas_font_spacing = this.cuas_font_spacing;
imp.cuas_annot_missing = this.cuas_annot_missing;
imp.cuas_px0 = this.cuas_px0;
imp.cuas_py0 = this.cuas_py0;
imp.cuas_az0 = this.cuas_az0;
......@@ -7280,6 +7413,20 @@ min_str_neib_fpn 0.35
imp.cuas_tmtch_short = this.cuas_tmtch_short;
imp.cuas_radar_range = this.cuas_radar_range;
imp.cuas_radar_height = this.cuas_radar_height;
imp.cuas_radar_bottom = this.cuas_radar_bottom;
imp.cuas_radar_top = this.cuas_radar_top;
imp.cuas_radar_uas_color = this.cuas_radar_uas_color;
imp.cuas_radar_color = this.cuas_radar_color;
imp.cuas_radar_radius = this.cuas_radar_radius;
imp.cuas_radar_uas_rad = this.cuas_radar_uas_rad;
imp.cuas_grid_ring = this.cuas_grid_ring;
imp.cuas_grid_line = this.cuas_grid_line;
imp.cuas_grid_annot = this.cuas_grid_annot;
imp.cuas_grid_color = this.cuas_grid_color;
imp.cuas_grid_font = this.cuas_grid_font;
imp.cuas_grid_az_top = this.cuas_grid_az_top;
imp.cuas_grid_sides = this.cuas_grid_sides;
imp.cuas_debug = this.cuas_debug;
imp.cuas_dbg_rng_seq = this.cuas_dbg_rng_seq;
......@@ -7561,9 +7708,47 @@ min_str_neib_fpn 0.35
imp.synth_add_offs = this.synth_add_offs;
return imp;
}
public static Color getColorFromHex(
String hex_color,
Color default_color) {
long lcolor = -1;
Color color = default_color;
try {
lcolor = Long.parseLong(hex_color,16);
color = setLongColor(lcolor);
} catch(NumberFormatException e){
color = default_color;
}
return color;
}
public static String getStringColor(
Color color,
Color default_color) {
if (color == null) {
color = default_color;
}
return getStringColor(color);
}
public static String getStringColor(Color color) {
return String.format("%08x", getLongColor(color));
}
public static long getLongColor(
Color color,
Color default_color) {
if (color == null) {
color = default_color;
}
return getLongColor(color);
}
public static long getLongColor(Color color) {
return ((long) color.getRGB()) & 0xffffffffL;
}
public static Color setLongColor(long lcolor) {
if (lcolor < (1 << 24)) { // no alpha
return new Color((int) lcolor);
......
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