Commit 8755d17e authored by Andrey Filippov's avatar Andrey Filippov

applied changes from 107

parent 54f1979a
...@@ -141,8 +141,9 @@ public class CalibrationFileManagement { ...@@ -141,8 +141,9 @@ public class CalibrationFileManagement {
(dir!=null) && (dir!=null) &&
(defaultPath.length()>1) && // skip "/" (defaultPath.length()>1) && // skip "/"
save && save &&
!dir.exists()) dir.mkdirs(); !dir.exists()) {
dir.mkdirs();
}
// see if defaultPath matches // see if defaultPath matches
if (smart && if (smart &&
...@@ -155,9 +156,11 @@ public class CalibrationFileManagement { ...@@ -155,9 +156,11 @@ public class CalibrationFileManagement {
} }
if ((dir==null) || (!dir.exists())) { if ((dir==null) || (!dir.exists())) {
if (DEFAULT_DIRECTORY!=null) { if (smart && (DEFAULT_DIRECTORY!=null)) { // 07.15.2025
defaultPath = DEFAULT_DIRECTORY; defaultPath = DEFAULT_DIRECTORY;
dir = new File(defaultPath); dir = new File(defaultPath);
} else { // 07.15.2025
return null;
} }
} }
if ((dir==null) || (!dir.exists())) { if ((dir==null) || (!dir.exists())) {
...@@ -168,6 +171,13 @@ public class CalibrationFileManagement { ...@@ -168,6 +171,13 @@ public class CalibrationFileManagement {
if ((dir!=null) && (!dir.isDirectory())){ if ((dir!=null) && (!dir.isDirectory())){
dir=dir.getParentFile(); dir=dir.getParentFile();
} }
if ((dir!=null) && (dir.exists()) && (dir.isDirectory() == directory)) {// 05.30.2025
return dir.getPath();
}
if (!smart) { // 05.29.2025
return null;
}
JFileChooser fc= new JFileChooser(); JFileChooser fc= new JFileChooser();
......
...@@ -1599,6 +1599,23 @@ public class CalibrationIllustration { ...@@ -1599,6 +1599,23 @@ public class CalibrationIllustration {
public void setImages(String[] images) { public void setImages(String[] images) {
this.images = images; this.images = images;
} }
public String toString() {
String s = "";
if (getImages() != null) {
for (int i = 0; i < getImages().length; i++) {
if (getImages()[i] != null) {
s+="*";
} else {
s+=".";
}
}
} else {
s += " NULL ";
}
s+= " " + getName();
return s;
}
} }
public CapturedScene [] listCapturedScenes( public CapturedScene [] listCapturedScenes(
...@@ -1657,7 +1674,7 @@ public class CalibrationIllustration { ...@@ -1657,7 +1674,7 @@ public class CalibrationIllustration {
Arrays.sort(scenePaths[si]); Arrays.sort(scenePaths[si]);
// Filter by number of files // Filter by number of files
} }
String debugScene = "1747805206_851249";
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
ArrayList<CapturedScene> [] partial_lists = new ArrayList[scenePaths.length]; ArrayList<CapturedScene> [] partial_lists = new ArrayList[scenePaths.length];
// for (File sceneDir: scenesFiles) { // for (File sceneDir: scenesFiles) {
...@@ -1665,6 +1682,9 @@ public class CalibrationIllustration { ...@@ -1665,6 +1682,9 @@ public class CalibrationIllustration {
partial_lists[si] = new ArrayList<CapturedScene>(); partial_lists[si] = new ArrayList<CapturedScene>();
if (scenePaths[si] != null) { if (scenePaths[si] != null) {
for (String scenePath: scenePaths[si]) { for (String scenePath: scenePaths[si]) {
if (scenePath.contains(debugScene)) {
System.out.println("listCapturedScenes() 1: debug scene, path = "+scenePath);
}
int basename_start = scenePath.lastIndexOf(Prefs.getFileSeparator()); int basename_start = scenePath.lastIndexOf(Prefs.getFileSeparator());
if (basename_start >= 0) { if (basename_start >= 0) {
basename_start++; basename_start++;
...@@ -1717,6 +1737,9 @@ public class CalibrationIllustration { ...@@ -1717,6 +1737,9 @@ public class CalibrationIllustration {
} }
} }
CapturedScene cs = partial_lists[first_earliet_ts].get(lists_indices[first_earliet_ts]); CapturedScene cs = partial_lists[first_earliet_ts].get(lists_indices[first_earliet_ts]);
if (cs.getName().contains(debugScene)) {
System.out.println("listCapturedScenes() 2: debug scene, cs.getName() = "+cs.getName());
}
lists_indices[first_earliet_ts]++; lists_indices[first_earliet_ts]++;
// combine with all remaining partial list of the same timestamp; // combine with all remaining partial list of the same timestamp;
int ns[] = {0,0}; int ns[] = {0,0};
......
...@@ -1280,6 +1280,17 @@ public class CLTParameters { ...@@ -1280,6 +1280,17 @@ public class CLTParameters {
return lwir? fom_cdiff_lwir : fom_cdiff_rgb; return lwir? fom_cdiff_lwir : fom_cdiff_rgb;
} }
public boolean getErsForw() {
return ly_ers_forw && !imp.lock_position;
}
public boolean getErsSide() {
return ly_ers_side && !imp.lock_position;
}
public boolean getErsVert() {
return ly_ers_vert && !imp.lock_position;
}
public CLTParameters(){} public CLTParameters(){}
public void setProperties(String prefix,Properties properties){ public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"transform_size", this.transform_size+""); properties.setProperty(prefix+"transform_size", this.transform_size+"");
......
...@@ -19,7 +19,7 @@ public class PolynomialApproximation { ...@@ -19,7 +19,7 @@ public class PolynomialApproximation {
double [] SF=new double [N+1]; double [] SF=new double [N+1];
for (int i=0;i<=2*N;i++) S[i]=0.0; for (int i=0;i<=2*N;i++) S[i]=0.0;
for (int i=0;i<=N;i++) SF[i]=0.0; for (int i=0;i<=N;i++) SF[i]=0.0;
for (int i=0;i<data.length;i++){ for (int i=0;i<data.length;i++) if (data[i] != null){
double wxn=(data[i].length>2)?data[i][2]:1.0; double wxn=(data[i].length>2)?data[i][2]:1.0;
if (wxn>0.0){ // save time on 0.0 that can be used to mask out some samples if (wxn>0.0){ // save time on 0.0 that can be used to mask out some samples
double f=data[i][1]; double f=data[i][1];
......
...@@ -169,12 +169,9 @@ import ij.process.ImageProcessor; ...@@ -169,12 +169,9 @@ import ij.process.ImageProcessor;
int num_slices = pixels[0].length; int num_slices = pixels[0].length;
double [][] dpixels = new double [num_frames*num_slices][]; double [][] dpixels = new double [num_frames*num_slices][];
// System.out.println("pixels.length="+pixels.length+" pixels[0].length="+pixels[0].length);
for (int f = 0; f < num_frames; f++) { for (int f = 0; f < num_frames; f++) {
// System.out.println("f="+f);
for (int s = 0; s < num_slices; s ++) { for (int s = 0; s < num_slices; s ++) {
int indx = s + f * num_slices; int indx = s + f * num_slices;
// System.out.println("f="+f+" s="+s+" indx="+indx);
dpixels[indx] = pixels[f][s]; dpixels[indx] = pixels[f][s];
} }
} }
......
...@@ -80,6 +80,10 @@ public class FootageOrganize { ...@@ -80,6 +80,10 @@ public class FootageOrganize {
double inter_gap = illustrationParameters.two_level_dirs ? illustrationParameters.inter_gap : 0.0; double inter_gap = illustrationParameters.two_level_dirs ? illustrationParameters.inter_gap : 0.0;
int seq_len = illustrationParameters.two_level_dirs ? illustrationParameters.seq_len : 0; int seq_len = illustrationParameters.two_level_dirs ? illustrationParameters.seq_len : 0;
System.out.println("OrganizeSeries(): scaning source folders:");
for (int i = 0; i < illustrationParameters.sourceFolders.length;i++) {
System.out.println(i+": "+illustrationParameters.sourceFolders[i]);
}
final CalibrationIllustration.CapturedScene [] captured_scenes = illustration.listCapturedScenes( final CalibrationIllustration.CapturedScene [] captured_scenes = illustration.listCapturedScenes(
illustrationParameters.destinationFolder, // String result_path, illustrationParameters.destinationFolder, // String result_path,
illustrationParameters.sourceFolders, // String captured_paths, illustrationParameters.sourceFolders, // String captured_paths,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
package com.elphel.imagej.cuas;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import com.elphel.imagej.gpu.GPUTileProcessor;
public class CuasTile implements Comparable<CuasTile>, Serializable {
private static final long serialVersionUID = 1L;
public final static int TILE_SIZE = GPUTileProcessor.DTT_SIZE; // 8
public final static int TILE_LENGTH = TILE_SIZE * TILE_SIZE; // 64
public final static int CLT_TILE_LENGTH = 4 * TILE_LENGTH; // 256
public float [] clt_data; // = new float [CLT_TILE_LENGTH];
public double dts = 0; // time stamp as double
public double weight = 0;
/*
public int parent_index = -1;
public void setParentIndex(int indx) {
parent_index = indx;
}
public int getParentIndex() {
return parent_index;
}
*/
public CuasTile (
int num_colors,
double dts,
double weight,
float [] clt_data) {
// clt_data = new float [num_colors * CLT_TILE_LENGTH];
this.dts = dts;
this.weight = weight;
this.clt_data = clt_data;
}
public CuasTile (
int num_colors,
double dts,
double weight,
float [] clt_full,
int ntile) {
int tile_length = num_colors * CLT_TILE_LENGTH;
clt_data = new float [tile_length];
this.dts = dts;
this.weight = weight;
System.arraycopy(
clt_full,
ntile * tile_length,
clt_data,
0,
tile_length);
}
public void getData (
float [] fclt,
int ntile) {
if (isEmpty()) return; // do nothing
System.arraycopy(
clt_data,
0,
fclt,
ntile * clt_data.length,
clt_data.length);
}
public double getWeight() {
return weight;
}
public double getTimeStamp() {
return dts;
}
public boolean isEmpty() {
return (clt_data == null) || (weight <= 0);
}
public float [] getData() {
return clt_data;
}
public double getWeight(
double decay,
double ts_now) {
if (isEmpty()) {
return 0;
}
if (decay > 0) {
return weight * Math.exp(-Math.max(ts_now-this.dts, 0)/decay);
}
return weight;
}
public CuasTile cloneEmpty() {
int num_colors = clt_data.length/CLT_TILE_LENGTH;
// return new CuasTile(num_colors, dts, 0, null);
return new CuasTile(num_colors, dts, 0, new float[clt_data.length]);
}
public double merge (CuasTile tile, double decay) {
if ((tile.clt_data == null) || (tile.weight == 0)) {
// do nothing
} else if ((clt_data == null) || (weight == 0)) {
clt_data = tile.clt_data;
weight = tile.weight;
dts = tile.dts;
} else {
double w = weight, wt = tile.weight;
if (decay > 0) {
if (dts < tile.dts) {
w = getWeight(
decay, // double decay,
tile.dts); // double ts_now)
} else if (dts > tile.dts) {
wt = tile.getWeight(
decay, // double decay,
dts); // double ts_now)
}
}
double sumw = w + wt;
w /= sumw;
wt /= sumw;
for (int i = 0; i < clt_data.length; i++) {
clt_data[i] = (float)(clt_data[i] * w + tile.clt_data[i] * wt);
}
dts = Math.max(dts, tile.dts);
weight = sumw;
}
return weight;
}
@Override
public CuasTile clone() {
int num_colors = clt_data.length/CLT_TILE_LENGTH;
return new CuasTile(num_colors, dts, weight, clt_data.clone());
}
@Override
public int compareTo(CuasTile otherTile) {
return Double.compare(dts, otherTile.dts);
}
public double diffTile2 (float [] clt_data_other) {
double d2 = 0;
for (int i = 0; i < clt_data.length; i++) {
double dd = clt_data_other[i] - clt_data[i];
d2 += dd * dd;
}
return d2/clt_data.length;
}
public double diffTile2 (CuasTile tile_other) {
return diffTile2(tile_other.clt_data);
}
@SuppressWarnings("static-method")
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
ois.defaultReadObject();
}
@SuppressWarnings("static-method")
private void writeObject(ObjectOutputStream oos) throws IOException {
oos.defaultWriteObject();
}
}
...@@ -55,7 +55,7 @@ public class ExportForGPUDevelopment { ...@@ -55,7 +55,7 @@ public class ExportForGPUDevelopment {
saveFloatKernels( saveFloatKernels(
kernel_dir + (quadCLT.isAux()?"aux":"main"), // String file_prefix, kernel_dir + (quadCLT.isAux()?"aux":"main"), // String file_prefix,
(what_to_save[0][0]?quadCLT.getCLTKernels(): null), // double [][][][][][] clt_kernels, // null (what_to_save[0][0]?quadCLT.getCLTKernels(): null), // double [][][][][][] clt_kernels, // null
(what_to_save[0][1]?quadCLT.image_data: null), (what_to_save[0][1]?quadCLT.getImageData(): null),
(what_to_save[0][2]?port_xy: null), // double [][][] port_xy, (what_to_save[0][2]?port_xy: null), // double [][][] port_xy,
true); true);
} catch (IOException e) { } catch (IOException e) {
......
...@@ -6,7 +6,7 @@ package com.elphel.imagej.gpu; ...@@ -6,7 +6,7 @@ package com.elphel.imagej.gpu;
** GPU acceleration for the Tile Processor ** GPU acceleration for the Tile Processor
** **
** **
** Copyright (C) 2018-2025 Elphel, Inc. ** Copyright (C) 2018 Elphel, Inc.
** **
** -----------------------------------------------------------------------------** ** -----------------------------------------------------------------------------**
** **
...@@ -75,18 +75,16 @@ import jcuda.nvrtc.JNvrtc; ...@@ -75,18 +75,16 @@ import jcuda.nvrtc.JNvrtc;
import jcuda.nvrtc.nvrtcProgram; import jcuda.nvrtc.nvrtcProgram;
public class GPUTileProcessor { public class GPUTileProcessor {
public static boolean USE_DS_DP = true; // false; // Use Dynamic Shared memory with Dynamic Parallelism (not implemented) public static boolean USE_DS_DP = false; // Use Dynamic Shared memory with Dynamic Parallelism (not implemented)
String LIBRARY_PATH = "/usr/local/cuda/targets/x86_64-linux/lib/libcudadevrt.a"; // linux String LIBRARY_PATH = "/usr/local/cuda/targets/x86_64-linux/lib/libcudadevrt.a"; // linux
// Can be downloaded and twice extracted from // Can be downloaded and twice extracted from
// https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-cudart-dev-11-2_11.2.152-1_amd64.deb // https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-cudart-dev-11-2_11.2.152-1_amd64.deb
// First deb itself, then data.tar.xz, and it will have usr/local/cuda/targets/x86_64-linux/lib/libcudadevrt.a inside // First deb itself, then data.tar.xz, and it will have usr/local/cuda/targets/x86_64-linux/lib/libcudadevrt.a inside
// Found "cuda-cudart-dev" on https://ubuntu.pkgs.org/ // Found "cuda-cudart-dev" on https://ubuntu.pkgs.org/
static String GPU_RESOURCE_DIR = "kernels"; static String GPU_RESOURCE_DIR = "kernels";
// static String [] GPU_KERNEL_FILES = {"dtt8x8.cuh","TileProcessor.cuh"}; // was never used and dtt8x8.cuh had incorrect name static String [] GPU_KERNEL_FILES = {"dtt8x8.cuh","TileProcessor.cuh"};
// static String [] GPU_KERNEL_FILES = {"dtt8x8.cu","TileProcessor.cu"};
// "*" - generated defines, first index - separately compiled unit // "*" - generated defines, first index - separately compiled unit
// static String [][] GPU_SRC_FILES = {{"*","dtt8x8.h","dtt8x8.cu","geometry_correction.h","geometry_correction.cu","TileProcessor.h","TileProcessor.cuh"}}; static String [][] GPU_SRC_FILES = {{"*","dtt8x8.h","dtt8x8.cu","geometry_correction.h","geometry_correction.cu","TileProcessor.h","TileProcessor.cuh"}};
static String [][] GPU_SRC_FILES = {{"*","dtt8x8.h","dtt8x8.cu","geometry_correction.h","geometry_correction.cu","TileProcessor.h","TileProcessor.cu"}};
static String GPU_CONVERT_DIRECT_NAME = "convert_direct"; // name in C code static String GPU_CONVERT_DIRECT_NAME = "convert_direct"; // name in C code
static String GPU_IMCLT_ALL_NAME = "imclt_rbg_all"; static String GPU_IMCLT_ALL_NAME = "imclt_rbg_all";
static String GPU_CORRELATE2D_NAME = "correlate2D"; // name in C code static String GPU_CORRELATE2D_NAME = "correlate2D"; // name in C code
...@@ -94,7 +92,7 @@ public class GPUTileProcessor { ...@@ -94,7 +92,7 @@ public class GPUTileProcessor {
static String GPU_CORR2D_COMBINE_NAME = "corr2D_combine"; // name in C code static String GPU_CORR2D_COMBINE_NAME = "corr2D_combine"; // name in C code
static String GPU_CORR2D_NORMALIZE_NAME = "corr2D_normalize"; // name in C code static String GPU_CORR2D_NORMALIZE_NAME = "corr2D_normalize"; // name in C code
static String GPU_TEXTURES_NAME = "textures_nonoverlap"; // name in C code static String GPU_TEXTURES_NAME = "textures_nonoverlap"; // name in C code
static String GPU_RBGA_NAME = "generate_RBGA"; // name in C code //// *** Modified 2025 *** //// static String GPU_RBGA_NAME = "generate_RBGA"; // name in C code
static String GPU_ROT_DERIV = "calc_rot_deriv"; // calculate rotation matrices and derivatives static String GPU_ROT_DERIV = "calc_rot_deriv"; // calculate rotation matrices and derivatives
static String GPU_SET_TILES_OFFSETS = "get_tiles_offsets"; // calculate pixel offsets and disparity distortions static String GPU_SET_TILES_OFFSETS = "get_tiles_offsets"; // calculate pixel offsets and disparity distortions
static String GPU_CALCULATE_TILES_OFFSETS = "calculate_tiles_offsets"; // calculate pixel offsets and disparity distortions static String GPU_CALCULATE_TILES_OFFSETS = "calculate_tiles_offsets"; // calculate pixel offsets and disparity distortions
...@@ -105,7 +103,7 @@ public class GPUTileProcessor { ...@@ -105,7 +103,7 @@ public class GPUTileProcessor {
static String GPU_MARK_TEXTURE_NEIGHBOR_NAME = "mark_texture_neighbor_tiles"; static String GPU_MARK_TEXTURE_NEIGHBOR_NAME = "mark_texture_neighbor_tiles";
static String GPU_GEN_TEXTURE_LIST_NAME = "gen_texture_list"; static String GPU_GEN_TEXTURE_LIST_NAME = "gen_texture_list";
static String GPU_CLEAR_TEXTURE_RBGA_NAME = "clear_texture_rbga"; static String GPU_CLEAR_TEXTURE_RBGA_NAME = "clear_texture_rbga";
static String GPU_TEXTURES_ACCUMULATE_NAME = "textures_accumulate"; //// *** Modified 2025 *** //// static String GPU_TEXTURES_ACCUMULATE_NAME = "textures_accumulate";
static String GPU_CREATE_NONOVERLAP_LIST_NAME ="create_nonoverlap_list"; static String GPU_CREATE_NONOVERLAP_LIST_NAME ="create_nonoverlap_list";
static String GPU_ERASE_CLT_TILES_NAME = "erase_clt_tiles"; static String GPU_ERASE_CLT_TILES_NAME = "erase_clt_tiles";
...@@ -375,7 +373,7 @@ public class GPUTileProcessor { ...@@ -375,7 +373,7 @@ public class GPUTileProcessor {
GPU_CORR2D_COMBINE_kernel = functions[4]; GPU_CORR2D_COMBINE_kernel = functions[4];
GPU_CORR2D_NORMALIZE_kernel = functions[5]; GPU_CORR2D_NORMALIZE_kernel = functions[5];
GPU_TEXTURES_kernel= functions[6]; GPU_TEXTURES_kernel= functions[6];
GPU_RBGA_kernel= functions[7]; //// *** Modified 2025 *** //// GPU_RBGA_kernel= functions[7];
GPU_ROT_DERIV_kernel = functions[8]; GPU_ROT_DERIV_kernel = functions[8];
GPU_CALCULATE_TILES_OFFSETS_kernel = functions[9]; GPU_CALCULATE_TILES_OFFSETS_kernel = functions[9];
GPU_CALC_REVERSE_DISTORTION_kernel = functions[10]; GPU_CALC_REVERSE_DISTORTION_kernel = functions[10];
...@@ -385,7 +383,7 @@ public class GPUTileProcessor { ...@@ -385,7 +383,7 @@ public class GPUTileProcessor {
GPU_MARK_TEXTURE_NEIGHBOR_kernel = functions[13]; GPU_MARK_TEXTURE_NEIGHBOR_kernel = functions[13];
GPU_GEN_TEXTURE_LIST_kernel = functions[14]; GPU_GEN_TEXTURE_LIST_kernel = functions[14];
GPU_CLEAR_TEXTURE_RBGA_kernel = functions[15]; GPU_CLEAR_TEXTURE_RBGA_kernel = functions[15];
GPU_TEXTURES_ACCUMULATE_kernel = functions[16]; //// *** Modified 2025 *** //// GPU_TEXTURES_ACCUMULATE_kernel = functions[16];
GPU_CREATE_NONOVERLAP_LIST_kernel = functions[17]; GPU_CREATE_NONOVERLAP_LIST_kernel = functions[17];
GPU_ERASE_CLT_TILES_kernel = functions[18]; GPU_ERASE_CLT_TILES_kernel = functions[18];
...@@ -509,6 +507,8 @@ public class GPUTileProcessor { ...@@ -509,6 +507,8 @@ public class GPUTileProcessor {
// Use the NVRTC to create a program by compiling the source code // Use the NVRTC to create a program by compiling the source code
nvrtcProgram program = new nvrtcProgram(); nvrtcProgram program = new nvrtcProgram();
nvrtcCreateProgram( program, sourceCode, null, 0, null, null); nvrtcCreateProgram( program, sourceCode, null, 0, null, null);
String options[] = {"--gpu-architecture=compute_"+capability};
int [][] nvrtc_version = new int[2][];
int nvrtc_rslt = -1; int nvrtc_rslt = -1;
/* /*
nvrtc_rslt= nvrtcVersion(nvrtc_version[0],nvrtc_version[0]); nvrtc_rslt= nvrtcVersion(nvrtc_version[0],nvrtc_version[0]);
...@@ -519,23 +519,8 @@ public class GPUTileProcessor { ...@@ -519,23 +519,8 @@ public class GPUTileProcessor {
System.out.println("nvrtc_num_arch="+nvrtc_num_arch[0]+" (returned "+nvrtc_rslt+")."); System.out.println("nvrtc_num_arch="+nvrtc_num_arch[0]+" (returned "+nvrtc_rslt+").");
int [] nvrtc_archs = new int[nvrtc_num_arch[0]]; int [] nvrtc_archs = new int[nvrtc_num_arch[0]];
nvrtc_rslt= nvrtcGetSupportedArchs(nvrtc_archs); nvrtc_rslt= nvrtcGetSupportedArchs(nvrtc_archs);
int max_arch = 0;
for (int sa: nvrtc_archs) {
max_arch = Math.max(max_arch, sa);
}
for (int sa: nvrtc_archs) { for (int sa: nvrtc_archs) {
System.out.println("Supported arch "+sa); System.out.println("Supported arch "+sa);
}
System.out.println("Max supported arch is "+max_arch+", gpu capability = "+capability);
if (capability > max_arch) {
capability = max_arch;
System.out.println("Reduced capability to match NVRTC compiler to "+capability);
}
System.out.println();
String options[] = {"--gpu-architecture=compute_"+capability,"--extensible-whole-program"};
System.out.println("Running NVRTC with the following options:");
for (String s:options) {
System.out.println(s);
} }
System.out.println(); System.out.println();
try { try {
......
...@@ -103,7 +103,7 @@ public class Did_gps_pos { ...@@ -103,7 +103,7 @@ public class Did_gps_pos {
public boolean isDidSane() { // add more! public boolean isDidSane() { // add more!
if ( (lla[0] <-90) || (lla[0] > 90) || // latitude if ( (lla[0] <-90) || (lla[0] > 90) || // latitude
(lla[1] <-90) || (lla[1] > 90) || // longitude (lla[1] <-180) || (lla[1] > 180) || // longitude
(lla[2] <-10) || (lla[1] > 20000)) { // altitude (lla[2] <-10) || (lla[1] > 20000)) { // altitude
System.out.println("isDidSane(): bad lla=["+ System.out.println("isDidSane(): bad lla=["+
lla[0]+", "+lla[1]+", "+lla[2]+"], timeOfWeekMs="+timeOfWeekMs); lla[0]+", "+lla[1]+", "+lla[2]+"], timeOfWeekMs="+timeOfWeekMs);
......
...@@ -9,6 +9,8 @@ import com.elphel.imagej.tileprocessor.IntersceneMatchParameters; ...@@ -9,6 +9,8 @@ import com.elphel.imagej.tileprocessor.IntersceneMatchParameters;
public abstract class Did_ins <T extends Did_ins <T>>{ public abstract class Did_ins <T extends Did_ins <T>>{
final static LocalDateTime DT_01_06_1980 = LocalDateTime.of(1980,1,6,0,0); final static LocalDateTime DT_01_06_1980 = LocalDateTime.of(1980,1,6,0,0);
final static int WEEK_SECONDS = 7 * 24 * 3600; final static int WEEK_SECONDS = 7 * 24 * 3600;
public boolean good = true;
/** GPS number of weeks since January 6th, 1980 */ /** GPS number of weeks since January 6th, 1980 */
public int week; // uint32_t public int week; // uint32_t
/** GPS time of week (since Sunday morning) in seconds */ /** GPS time of week (since Sunday morning) in seconds */
...@@ -67,6 +69,9 @@ public abstract class Did_ins <T extends Did_ins <T>>{ ...@@ -67,6 +69,9 @@ public abstract class Did_ins <T extends Did_ins <T>>{
public boolean isDidSane() { public boolean isDidSane() {
if (!good) { // BufferUnderflowException when creating
return false;
}
if ((week < MIN_WEEK) || (week > MAX_WEEK)) { if ((week < MIN_WEEK) || (week > MAX_WEEK)) {
System.out.println("isDidSane(): bad week = "+week+ System.out.println("isDidSane(): bad week = "+week+
" - should be in range ["+MIN_WEEK+","+MAX_WEEK+"]"); " - should be in range ["+MIN_WEEK+","+MAX_WEEK+"]");
...@@ -91,9 +96,9 @@ public abstract class Did_ins <T extends Did_ins <T>>{ ...@@ -91,9 +96,9 @@ public abstract class Did_ins <T extends Did_ins <T>>{
(insStatus ^ eInsStatusFlags_data) & eInsStatusFlags_mask)); (insStatus ^ eInsStatusFlags_data) & eInsStatusFlags_mask));
return false; return false;
} }
if ( (lla[0] <-90) || (lla[0] > 90) || // latitude if ( (lla[0] <-90) || (lla[0] > 90) || // latitude
(lla[1] <-90) || (lla[1] > 90) || // longitude (lla[1] <-180) || (lla[1] > 180) || // longitude
(lla[2] <-10) || (lla[1] > 20000)) { // altitude (lla[2] <-10) || (lla[1] > 20000)) { // altitude
System.out.println("isDidSane(): bad lla=["+ System.out.println("isDidSane(): bad lla=["+
lla[0]+", "+lla[1]+", "+lla[2]+"], timeOfWeek="+timeOfWeek); lla[0]+", "+lla[1]+", "+lla[2]+"], timeOfWeek="+timeOfWeek);
return false; return false;
......
package com.elphel.imagej.ims; package com.elphel.imagej.ims;
import java.nio.BufferUnderflowException;
//import java.io.Serializable; //import java.io.Serializable;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
...@@ -38,15 +39,21 @@ public class Did_ins_1 extends Did_ins <Did_ins_1>{ ...@@ -38,15 +39,21 @@ public class Did_ins_1 extends Did_ins <Did_ins_1>{
} }
public Did_ins_1 (ByteBuffer bb) { public Did_ins_1 (ByteBuffer bb) {
bb.order(ByteOrder.LITTLE_ENDIAN); bb.order(ByteOrder.LITTLE_ENDIAN);
week= bb.getInt(); try {
timeOfWeek=bb.getDouble(); week= bb.getInt();
insStatus= bb.getInt(); timeOfWeek=bb.getDouble();
hdwStatus= bb.getInt(); insStatus= bb.getInt();
theta[0]= bb.getFloat(); theta[1] = bb.getFloat(); theta[2]= bb.getFloat(); hdwStatus= bb.getInt();
uvw[0]= bb.getFloat(); uvw[1] = bb.getFloat(); uvw[2]= bb.getFloat(); theta[0]= bb.getFloat(); theta[1] = bb.getFloat(); theta[2]= bb.getFloat();
lla[0]= bb.getDouble(); lla[1] = bb.getDouble(); lla[2]= bb.getDouble(); uvw[0]= bb.getFloat(); uvw[1] = bb.getFloat(); uvw[2]= bb.getFloat();
ned[0]= bb.getFloat(); ned[1] = bb.getFloat(); ned[2]= bb.getFloat(); lla[0]= bb.getDouble(); lla[1] = bb.getDouble(); lla[2]= bb.getDouble();
ned[0]= bb.getFloat(); ned[1] = bb.getFloat(); ned[2]= bb.getFloat();
} catch (BufferUnderflowException e) {
// TODO Auto-generated catch block
good = false;
return; // e.printStackTrace();
}
} }
public Did_ins_1() {} public Did_ins_1() {}
public Did_ins_1(String prefix, Properties properties) { public Did_ins_1(String prefix, Properties properties) {
......
This diff is collapsed.
package com.elphel.imagej.ims;
public class DjiSrtReader {
public DjiSrtReader(String path) {
}
}
This diff is collapsed.
...@@ -2909,7 +2909,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{ ...@@ -2909,7 +2909,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
}; };
} }
ImageDtt.startAndJoin(threads); ImageDtt.startAndJoin(threads);
imp.setTitle(removeKnownExtension(imp.getTitle())+String.format("-UM%.1f_%.2f",um_sigma,um_weight)); imp.setTitle(removeKnownExtension(imp.getTitle())+String.format("-UM%.1f_%.3f",um_sigma,um_weight));
return imp; return imp;
} }
......
This diff is collapsed.
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