Commit 844fe76d authored by Andrey Filippov's avatar Andrey Filippov

Implemented DJI SRT->KML

parent 4aa60524
......@@ -109,6 +109,8 @@ import com.elphel.imagej.dct.FactorConvKernel;
import com.elphel.imagej.gpu.GPUTileProcessor;
import com.elphel.imagej.gpu.GpuQuad;
import com.elphel.imagej.gpu.JCuda_ImageJ_Example_Plugin;
import com.elphel.imagej.ims.DjiSrt;
import com.elphel.imagej.ims.DjiSrtReader;
import com.elphel.imagej.ims.EventLogger;
import com.elphel.imagej.ims.UasLogReader;
//import com.elphel.imagej.ims.Imx5;
......@@ -873,6 +875,9 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
// addButton("Test LDLT Cholesky", panelOrange, color_process);
addButton("Test LLT Cholesky", panelOrange, color_process);
addButton("UAS log", panelOrange, color_process);
addButton("DJI SRT", panelOrange, color_process);
addButton("SRT to KML", panelOrange, color_process);
//
plugInFrame.add(panelOrange);
}
plugInFrame.pack();
......@@ -5833,8 +5838,11 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
CholeskyBlockTest.testCholesky(imp_sel); // ImagePlus imp.);
} else if (label.equals("UAS log")) {
testUasLog();
} else if (label.equals("DJI SRT")) {
testDjiSrt();
} else if (label.equals("SRT to KML")) {
djiSrtToKml();
}
//
}
public static boolean testUasLog() {
......@@ -5857,6 +5865,79 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
}
return true;
}
public static boolean testDjiSrt() {
String srt_path= "/home/elphel/Documents/dji/images/DJI_001-02/DJI_20250515122524_0007_D.SRT";
GenericJTabbedDialog gd = new GenericJTabbedDialog("DJI SRT");
gd.addStringField("File path of the DJI SRT", srt_path, 100,
"Provide full path to the DJI SRT");
gd.showDialog();
if (gd.wasCanceled())
return false;
srt_path = gd.getNextString();
try {
ArrayList<DjiSrt> drt_list=DjiSrt.parseDjiSrt(srt_path);
} catch (Exception e) {
System.out.println("Error reading/parsing "+srt_path);
System.out.println();
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public static boolean djiSrtToKml() {
String srt_path= "/home/elphel/Documents/dji/images/DJI_001-02/DJI_20250515122524_0007_D.SRT";
String kml_path= "/home/elphel/Documents/dji/images/DJI_001-02/DJI_20250515122524_0007_D.kml";
String icon_url= "https://community.elphel.com/lwir16/test_kml/drone01.png";
String name = "Flight path from SRT";
double alt_corr = 0;
String time_zone = "MDT"; // "Americas/Boise"
double time_step = 1.0; // sec
GenericJTabbedDialog gd = new GenericJTabbedDialog("DJI SRT to KML");
gd.addStringField("File path of the DJI SRT", srt_path, 100, "Provide full path to the DJI SRT");
gd.addStringField("File path of the output KML", kml_path, 100, "Provide full path to the DJI SRT");
gd.addStringField("UAS icon URL", icon_url, 100, "Provide url of the UAS icon file");
gd.addStringField("KML document title", name, 100, "Provide title of the KML file");
gd.addStringField("Time Zone", time_zone, 100, "Provide url of the UAS icon file");
gd.addNumericField("Interval between Placemarks", time_step, 3, 6, "s","Interval between Placemarks");
gd.addNumericField("Altitude correction", alt_corr, 3, 6, "m","Add to log altitude");
gd.showDialog();
if (gd.wasCanceled())
return false;
srt_path = gd.getNextString();
kml_path = gd.getNextString();
icon_url = gd.getNextString();
name = gd.getNextString();
if (icon_url.trim().length()==0) {
icon_url = null;
}
time_zone = gd.getNextString();
time_step = gd.getNextNumber();
alt_corr = gd.getNextNumber();
boolean ok = false;
if (alt_corr != 0) {
// modify file name
}
try {
ok=DjiSrt.srtToKml(
srt_path, // String srt_path,
kml_path, // String kml_path,
icon_url, //String icon_url,
name+" "+srt_path, // String name,
time_zone, // String time_zone, // "MDT", "UTC"
time_step, //double time_step // interval in seconds
alt_corr);// double alt_corr // add to altitude
} catch (Exception e) {
System.out.println("Error reading/parsing "+srt_path);
System.out.println();
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
//
public boolean debugInitOneScene() {
......
package com.elphel.imagej.ims;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
public class DjiSrt {
static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
final static String [] SRT_KEYWORDS = {
"iso", // 0
"shutter", // 1
"fnum", // 2
"ev", // 3
"color_md", // 4
"focal_len",// 5
"latitude", // 6
"longitude",// 7
"rel_alt", // 8
"abs_alt", // 9 - not at the beginning
"ct"}; // 10
final static int I_iso = 0;
final static int I_shutter = 1;
final static int I_fnum = 2;
final static int I_ev = 3;
final static int I_color_md = 4;
final static int I_focal_len= 5;
final static int I_latitude = 6;
final static int I_longitude= 7;
final static int I_rel_alt = 8;
final static int I_abs_alt = 9;//- not at the beginning
final static int I_ct = 10;
int frameCnt = -1;
double diffTime = Double.NaN;
Date date = null;
int iso = -1;
double shutter = Double.NaN;
double fnum = Double.NaN;
int ev = -1;
String color_md = "";
double focal_len = Double.NaN;
double latitude = Double.NaN;
double longitude = Double.NaN;
double rel_alt = Double.NaN;
double abs_alt = Double.NaN;
int ct = -1; // incremented by 1 for each frame
/*
00:00:00,066 --> 00:00:00,099
<font size="28">FrameCnt: 3, DiffTime: 33ms
2025-05-15 12:24:25.129
[iso: 110] [shutter: 1/5000.0] [fnum: 1.7] [ev: 0] [color_md: default] [focal_len: 24.00] [latitude: 38.621147] [longitude: -110.720468] [rel_alt: 192.800 abs_alt: 1788.479] [ct: 5415] </font>
*/
public static ArrayList<DjiSrt> parseDjiSrt(String srt_path){
ArrayList<DjiSrt> srtList = new ArrayList<DjiSrt>();
List<String> lines;
Path seq_path = Paths.get(srt_path);
try {
lines = Files.readAllLines(seq_path, StandardCharsets.UTF_8);
} catch (IOException e) {
e.printStackTrace();
return null;
}
int line = 0;
double min_abs_rel = Double.NaN, max_abs_rel = Double.NaN;
while (line < lines.size()) {
// skip till has "-->"
while ((line < lines.size()) && (lines.get(line).indexOf("-->") < 0)) line++;
line++; // now <font size="28">FrameCnt: 3, DiffTime: 33ms
if (line >= lines.size()) {
break;
}
String line_frameCnt = lines.get(line);
int ifcnt = (line_frameCnt.indexOf("FrameCnt:"));
DjiSrt djiSrt = new DjiSrt();
if (ifcnt >= 0){
ifcnt += "FrameCnt:".length();
int icomma = line_frameCnt.indexOf(",",ifcnt);
if (icomma > ifcnt) {
djiSrt.frameCnt = Integer.parseInt(line_frameCnt.substring(ifcnt,icomma).trim());
int idtim = line_frameCnt.indexOf("DiffTime:",icomma);
if (idtim >= 0){
idtim+="DiffTime:".length();
int isec = line_frameCnt.indexOf("s",idtim);
if (isec >= 0) {
int im = line_frameCnt.indexOf("m",idtim);
if (im >=0) {
djiSrt.diffTime = Double.parseDouble(line_frameCnt.substring(idtim,im).trim())/1000;
} else {
djiSrt.diffTime = Double.parseDouble(line_frameCnt.substring(idtim,isec).trim());
}
}
}
}
line++;
}
if (line >= lines.size()) {
break;
}
// 2025-05-15 12:24:25.129
try {
djiSrt.date = dateFormat.parse(lines.get(line));
} catch (ParseException e) {
// TODO Auto-generated catch block
// e.printStackTrace();
break; // no date found for this record
}
line++;
if (line >= lines.size()) {
break;
}
//
//[iso: 110] [shutter: 1/5000.0] [fnum: 1.7] [ev: 0] [color_md: default] [focal_len: 24.00] [latitude: 38.621147] [longitude: -110.720468] [rel_alt: 192.800 abs_alt: 1788.479] [ct: 5415] </font>
String s = lines.get(line);
String [] tokens = s.split("\\[");
// System.out.println(tokens);
for (int ntok = 1; ntok < tokens.length; ntok++) {
int iclos = tokens[ntok].indexOf("]");
if (iclos > 0) {
s = tokens[ntok].substring(0, iclos);
for (int k = 0; k < SRT_KEYWORDS.length; k++) {
if (s.startsWith(SRT_KEYWORDS[k])){
String sv = s.substring(SRT_KEYWORDS[k].length()+1,iclos).trim();
switch (k) {
case I_iso: djiSrt.iso = Integer.parseInt(sv); break;
case I_shutter: djiSrt.shutter = 1.0/Double.parseDouble(sv.substring(2)); break;
case I_fnum: djiSrt.fnum = Double.parseDouble(sv); break;
case I_ev: djiSrt.ev = Integer.parseInt(sv); break;
case I_color_md: djiSrt.color_md = sv; break;
case I_focal_len:djiSrt.focal_len = Double.parseDouble(sv); break;
case I_latitude: djiSrt.latitude = Double.parseDouble(sv); break;
case I_longitude:djiSrt.longitude = Double.parseDouble(sv); break;
case I_rel_alt:
int ispilt = sv.indexOf(" ");
djiSrt.rel_alt = Double.parseDouble(sv.substring(0,ispilt));
String sv2 = sv.substring(ispilt).trim();
if (sv2.startsWith(SRT_KEYWORDS[I_abs_alt])) {
sv2 = sv2.substring(SRT_KEYWORDS[I_abs_alt].length() + 1).trim();
djiSrt.abs_alt = Double.parseDouble(sv2);
}
break;
case I_ct: djiSrt.ct = Integer.parseInt(sv); break;
}
}
}
}
}
// double min_abs_rel = Double.NaN, max_abs_rel = Double.NaN;
double abs_rel = djiSrt.abs_alt-djiSrt.rel_alt;
if (!(min_abs_rel < abs_rel)) min_abs_rel = abs_rel;
if (!(max_abs_rel > abs_rel)) max_abs_rel = abs_rel;
srtList.add(djiSrt);
}
// No need to compare - difference is home position
System.out.println("abs_alt-rel_alt: min="+min_abs_rel+", max="+max_abs_rel+" (are the same)");
return srtList;
}
public static boolean srtToKml(
String srt_path,
String kml_path,
String icon_url,
String name,
String time_zone, // "MDT", "UTC"
double time_step, // interval in seconds
double alt_corr // add to altitude
) {
int step_millis = (int) Math.round(1000*time_step);
SimpleDateFormat dateFormatZ = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
ArrayList<DjiSrt> srtList = parseDjiSrt(srt_path);
StringBuffer sb = new StringBuffer();
// Generate header
sb.append( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
sb.append( "<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n");
sb.append( " <Document>\n");
if (alt_corr != 0) {
sb.append( " <name>"+name+" Altitude corrected by "+alt_corr+"m. "+"</name>\n");
} else {
sb.append( " <name>"+name+"</name>\n");
}
if (icon_url != null) {
sb.append(" <Style id=\"style_icon\">\n");
sb.append(" <IconStyle>\n");
sb.append(" <Icon>\n");
sb.append(" <href>"+icon_url+"</href>\n");
sb.append(" </Icon>\n");
sb.append(" <hotSpot x=\"32\" y=\"1\" xunits=\"pixels\" yunits=\"pixels\"/>\n");
sb.append(" </IconStyle>\n");
sb.append(" </Style>\n");
}
sb.append( " <Style id=\"check-hide-children\">\n");
sb.append( " <ListStyle>\n");
sb.append( " <listItemType>checkHideChildren</listItemType>\n");
sb.append( " </ListStyle>\n");
sb.append( " </Style>\n");
sb.append( " <styleUrl>#check-hide-children</styleUrl>\n");
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(time_zone));
calendar.setTime(srtList.get(0).date);
/// Calendar calendar_utc = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
// calendar.add(Calendar.MILLISECOND, -step_millis);
Instant last_instant = calendar.toInstant();
// last_instant = last_instant.plusMillis(-step_millis);
Instant next_instant = last_instant.plusMillis(step_millis);
for (DjiSrt point:srtList) {
calendar.setTime(point.date);
Instant instant = calendar.toInstant();
if (!instant.isBefore(next_instant)) {
/// calendar_utc.setTime(calendar.getTime());
// add new placemark
sb.append(" <Placemark>\n");
sb.append(" <TimeStamp>\n");
/// sb.append(" <when>"+dateFormatZ.format(calendar_utc.getTime())+"</when>\n");
sb.append(" <when>"+dateFormatZ.format(calendar.getTime())+"</when>\n");
sb.append(" </TimeStamp>\n");
if (icon_url != null) {
sb.append(" <styleUrl>#style_icon</styleUrl>\n");
}
sb.append(" <Point>\n");
sb.append(" <altitudeMode>absolute</altitudeMode>\n");
sb.append(" <coordinates>"+String.format("%f,%f,%f",point.longitude,point.latitude,point.abs_alt+alt_corr)+"</coordinates>\n");
sb.append(" </Point>\n");
sb.append(" </Placemark>\n");
next_instant = next_instant.plusMillis(step_millis);
}
}
/*
* https://developers.google.com/kml/documentation/time
<Placemark>
<TimeStamp>
<when>2007-01-14T21:05:02Z</when>
</TimeStamp>
<styleUrl>#paddle-a</styleUrl>
<Point>
<coordinates>-122.536226,37.86047,0</coordinates>
</Point>
</Placemark>
*
*/
// Generate footer
sb.append(" </Document>\n");
sb.append("</kml>\n");
try {
BufferedWriter out = new BufferedWriter(
new FileWriter(kml_path)); // , true)); true is for append!
out.write(sb.toString());
out.close();
System.out.println("Written KML to: "+kml_path);
return true;
} catch (IOException e) {
// Display message when exception occurs
System.out.println("exception occurred" + e);
return false;
}
}
}
package com.elphel.imagej.ims;
public class DjiSrtReader {
public DjiSrtReader(String path) {
}
}
......@@ -717,6 +717,7 @@ min_str_neib_fpn 0.35
public boolean add_average = true;
public boolean subtract_average = false;
public int running_average = 0;
public boolean extract_center_orientation = true; // in lock_position mode only - debug feature
public boolean um_mono = true; // applies to both TIFF and AVI
public double um_sigma = 10;
public double um_weight = 0.97; //
......@@ -2085,6 +2086,8 @@ min_str_neib_fpn 0.35
"Subtract average slice from all scenes");
gd.addNumericField("Running average length", this.running_average, 0,3,"",
"Apply running average to the scene sequence, set length.");
gd.addCheckbox ("Calculate center orientation", this.extract_center_orientation,
"Calculate center of orientation rotation (in lock_position=true mode only). Debug feature.");
gd.addCheckbox ("Apply unsharp mask to mono", this.um_mono,
"Apply unsharp mask to monochrome image sequences/video. Applies to TIFF generatiojn too");
gd.addNumericField("Unsharp mask sigma (radius)", this.um_sigma, 5,7,"pix",
......@@ -2895,6 +2898,7 @@ min_str_neib_fpn 0.35
this.add_average = gd.getNextBoolean();
this.subtract_average = gd.getNextBoolean();
this.running_average = (int) gd.getNextNumber();
this.extract_center_orientation=gd.getNextBoolean();
this.um_mono = gd.getNextBoolean();
this.um_sigma = gd.getNextNumber();
this.um_weight = gd.getNextNumber();
......@@ -3698,6 +3702,8 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"add_average", this.add_average+""); // boolean
properties.setProperty(prefix+"subtract_average", this.subtract_average+""); // boolean
properties.setProperty(prefix+"running_average", this.running_average+""); // int
properties.setProperty(prefix+"extract_center_orientation",this.extract_center_orientation+"");// boolean
properties.setProperty(prefix+"um_mono", this.um_mono+""); // boolean
properties.setProperty(prefix+"um_sigma", this.um_sigma+""); // double
properties.setProperty(prefix+"um_weight", this.um_weight+""); // double
......@@ -4485,6 +4491,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"add_average")!=null) this.add_average=Boolean.parseBoolean(properties.getProperty(prefix+"add_average"));
if (properties.getProperty(prefix+"subtract_average")!=null) this.subtract_average=Boolean.parseBoolean(properties.getProperty(prefix+"subtract_average"));
if (properties.getProperty(prefix+"running_average")!=null) this.running_average=Integer.parseInt(properties.getProperty(prefix+"running_average"));
if (properties.getProperty(prefix+"extract_center_orientation")!=null)this.extract_center_orientation=Boolean.parseBoolean(properties.getProperty(prefix+"extract_center_orientation"));
if (properties.getProperty(prefix+"um_mono")!=null) this.um_mono=Boolean.parseBoolean(properties.getProperty(prefix+"um_mono"));
if (properties.getProperty(prefix+"um_sigma")!=null) this.um_sigma=Double.parseDouble(properties.getProperty(prefix+"um_sigma"));
if (properties.getProperty(prefix+"um_weight")!=null) this.um_weight=Double.parseDouble(properties.getProperty(prefix+"um_weight"));
......@@ -5272,6 +5279,7 @@ min_str_neib_fpn 0.35
imp.add_average = this. add_average;
imp.subtract_average = this. subtract_average;
imp.running_average = this. running_average;
imp.extract_center_orientation=this.extract_center_orientation;
imp.um_mono = this. um_mono;
imp.um_sigma = this. um_sigma;
imp.um_weight = this. um_weight;
......
......@@ -1586,7 +1586,7 @@ public class OpticalFlow {
* @return Scene macrotiles - double array [number_of_macrotiles][number_of_channels][numer_of_tiles_per_macrotile], typically
* [][5][256]
*/
public double [][][] prepareSceneTiles(// to match to reference
public static double [][][] prepareSceneTiles(// to match to reference
// null for {scene,reference}{xyz,atr} uses instances globals
final double [] scene_xyz, // camera center in world coordinates
final double [] scene_atr, // camera orientation relative to world frame
......@@ -5594,14 +5594,16 @@ public class OpticalFlow {
}
}
boolean extract_center_orientation = true;
boolean extract_center_orientation = clt_parameters.imp.extract_center_orientation; // true; // false; // true;
double [][] center_ATR = null; // {{center_A, center_T, average_R},{radius_A, radius_T}}
double [] cuas_atr = ZERO3;
if (extract_center_orientation && clt_parameters.imp.lock_position) {
center_ATR = CuasCenterLma.getCenterATR(
quadCLTs, // QuadCLT [] quadCLTs,
ref_index, //int ref_index,
new int [] {earliest_scene, last_index}, //int [] range,
debugLevel); // int debugLevel);
cuas_atr = new double [] {-center_ATR[0][0],-center_ATR[0][1],-center_ATR[0][2]};
}
if (generate_egomotion) {
......@@ -5901,6 +5903,7 @@ public class OpticalFlow {
mode3d, // int mode3d,
toRGB, // boolean toRGB,
xyz_offset, // double [] stereo_offset, // offset reference camera {x,y,z}
cuas_atr, // double [] stereo_atr, // offset reference orientation (cuas)
sensor_mask, // int sensor_mask,
scenes_suffix, // String suffix,
ds_vantage[0], // selected_disparity, // double [] ref_disparity,
......@@ -6366,6 +6369,7 @@ public class OpticalFlow {
1, // int mode3d,
false, // boolean toRGB,
ZERO3, // double [] stereo_offset, // offset reference camera {x,y,z}
null, // double [] stereo_atr, // offset reference orientation (cuas)
1, // int sensor_mask,
scenes_suffix, // String suffix,
terrain_disparity, // selected_disparity, // double [] ref_disparity,
......@@ -6392,6 +6396,7 @@ public class OpticalFlow {
1, // int mode3d,
false, // boolean toRGB,
ZERO3, // double [] stereo_offset, // offset reference camera {x,y,z}
null, // double [] stereo_atr, // offset reference orientation (cuas)
1, // int sensor_mask,
scenes_suffix, // String suffix,
elevation_disparity, // selected_disparity, // double [] ref_disparity,
......@@ -7475,6 +7480,7 @@ public class OpticalFlow {
int mode3d, // for older compatibility mode3d = -1 for RAW, 0 - INF, 1 - FG, 2 BG
boolean toRGB,
double [] stereo_xyz, // offset reference camera {x,y,z}
double [] stereo_atr_in, // offset reference orientation (cuas)
int sensor_mask,
String suffix_in,
double [] ref_disparity,
......@@ -7483,7 +7489,8 @@ public class OpticalFlow {
int threadsMax,
int debugLevel) {
boolean corr_raw_ers = true;
double [] stereo_atr = ZERO3; // maybe later play with rotated camera
double [] stereo_atr = (stereo_atr_in != null)? stereo_atr_in: ZERO3; // maybe later play with rotated camera
boolean mode_cuas = (stereo_atr[0] != 0) || (stereo_atr[1] != 0) || (stereo_atr[2] != 0);
// boolean um_mono = clt_parameters.imp.um_mono;
double um_sigma = clt_parameters.imp.um_sigma;
double um_weight = clt_parameters.imp.um_weight;
......@@ -7513,6 +7520,12 @@ public class OpticalFlow {
if (subtract_average && insert_average) {
suffix+="-DIFFAVG"+running_average;
}
if (mode_cuas) {
suffix+="-CUAS"; // add properties too? include offsets
}
if (!mb_en) {
suffix+="-NOMB"; // no motion blur
}
int num_sens = quadCLTs[ref_index].getNumSensors();
ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection();
int num_used_sens = 0;
......@@ -7525,8 +7538,8 @@ public class OpticalFlow {
double [][] ref_pXpYD = transformToScenePxPyD( // now should work with offset ref_scene
fov_tiles, // final Rectangle [] extra_woi, // show larger than sensor WOI (or null)
ref_disparity, // final double [] disparity_ref, // invalid tiles - NaN in disparity
ZERO3, // final double [] scene_xyz, // camera center in world coordinates
ZERO3, // final double [] scene_atr, // camera orientation relative to world frame
ZERO3, // stereo_xyz, // ZERO3, // final double [] scene_xyz, // camera center in world coordinates
ZERO3, // stereo_atr, // ZERO3, // final double [] scene_atr, // camera orientation relative to world frame
quadCLTs[ref_index], // final QuadCLT scene_QuadClt,
quadCLTs[ref_index], // final QuadCLT reference_QuadClt, // now - may be null - for testing if scene is rotated ref
threadsMax); // int threadsMax)
......@@ -7559,7 +7572,7 @@ public class OpticalFlow {
scene_atr = ZERO3;
}
}
if (stereo_xyz != null) { // offset all, including reference scene
if (stereo_xyz != null) { // offset all, including reference scene - now always, it is never null
double [][] combo_xyzatr = ErsCorrection.combineXYZATR(
stereo_xyz, // double [] reference_xyz,
stereo_atr, // double [] reference_atr,
......@@ -13125,7 +13138,7 @@ public class OpticalFlow {
* @param debug_level debug level
* @return TpTask[][] arrays used to program GPU. With no MB has only one element, with MB - two
*/
public static TpTask[][] setReferenceGPU (
public static TpTask[][] setReferenceGPU ( // never used
CLTParameters clt_parameters,
QuadCLT ref_scene,
double [] ref_disparity, // null or alternative reference disparity
......
......@@ -1357,10 +1357,10 @@ public class QuadCLT extends QuadCLTCPU {
if (showPxPyD) {
int dbg_width = rendered_width/GPUTileProcessor.DTT_SIZE;
int dbg_height = pXpYD.length/dbg_width;
double [][] dbg_img = new double [3 + ((mb_vectors!=null)? 2:0)][pXpYD.length];
String [] dbg_titles = (mb_vectors!=null)?
(new String[] {"pX","pY","Disparity","mb_X","mb_Y"}):
(new String[] {"pX","pY","Disparity"});
(new String[] {"pX","pY","Disparity","mb_X","mb_Y","disparity_ref"}):
(new String[] {"pX","pY","Disparity","disparity_ref"});
double [][] dbg_img = new double [dbg_titles.length][pXpYD.length]; // 3 + ((mb_vectors!=null)? 2:0)][pXpYD.length];
for (int i = 0; i < dbg_img.length; i++) {
Arrays.fill(dbg_img[i], Double.NaN);
}
......@@ -1376,6 +1376,7 @@ public class QuadCLT extends QuadCLTCPU {
}
}
}
dbg_img[dbg_img.length-1] = disparity_ref;
ShowDoubleFloatArrays.showArrays( // out of boundary 15
dbg_img,
dbg_width,
......
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