Commit f7907c7d authored by Andrey Filippov's avatar Andrey Filippov

Working on the image sequences captured from the UAS

parent 23dab5f8
......@@ -3573,7 +3573,7 @@ public class GpuQuad{ // quad camera description
* @param threadsMax Maximal number of threads to run concurrently.
* @return Array of TpTask instances (fully prepared) to be fed to the GPU
*/
public TpTask[] setInterTasks(
public TpTask[] setInterTasks( // not used 2023.08.04
final boolean calcPortsCoordinatesAndDerivatives, // GPU can calculate them centreXY
final double [][] pXpYD, // per-tile array of pX,pY,disparity triplets (or nulls)
final boolean [] selection, // may be null, if not null do not process unselected tiles
......
......@@ -33,7 +33,8 @@ public class EventLogger {
}
Arrays.sort(logger_files); // increasing start time stamps
String out_did_gps_path = "/home/elphel/lwir16-proc/office_04/did_gps";
// String out_did_gps_path = "/home/elphel/lwir16-proc/office_04/did_gps";
String out_did_gps_path = dir+"../did_gps";
int gps_mask = 7; // +1 - DID_GPS1_POS, +2 - DID_GPS2_POS, +4 - DID_GPS1_UBX_POS
for (int nf = 0; nf < logger_files.length; nf++) {
System.out.println("Printing all DID_INS_1 data in "+logger_files[nf].abs_path);
......
......@@ -325,6 +325,10 @@ public class ErsCorrection extends GeometryCorrection {
properties.setProperty(prefix+SCENES_PREFIX+"_"+k+"_dt", s_scenes[1]);
properties.setProperty(prefix+SCENES_PREFIX+"_"+k+"_d2t", s_scenes[2]);
// properties.setProperty(prefix+SCENES_PREFIX+"_"+k, getScene(k).toString());
} else { // so it is important to scenes_poses.put(timestamp, null), not scenes_poses.remove(ts)
properties.remove(prefix+SCENES_PREFIX+"_"+k);
properties.remove(prefix+SCENES_PREFIX+"_"+k+"_dt");
properties.remove(prefix+SCENES_PREFIX+"_"+k+"_d2t");
}
}
}
......@@ -408,6 +412,12 @@ public class ErsCorrection extends GeometryCorrection {
return scenes_poses.get(timestamp);
}
public double[][] getSceneXYZATR(String timestamp) {
XyzAtr scene = scenes_poses.get(timestamp);
if (scene == null) return null;
return scene.getXYZATR();
}
public double[] getSceneXYZ(String timestamp) {
XyzAtr scene = scenes_poses.get(timestamp);
if (scene == null) return null;
......@@ -2103,6 +2113,17 @@ public class ErsCorrection extends GeometryCorrection {
scene_xyz, // double [] camera_xyz, // camera center in world coordinates
scene_rot_matrix, // Matrix rot_matrix, // 1-st of 4 matricesArray of 4 matrices -
LINE_ERR); // double line_err) // threshold error in scan lines (1.0)
if (pXpYD_scene == null) {
System.out.println("getDPxSceneDParameters(): pXpYD_scene==null. Object too close to the lens?"); // not here
return null;
}
if (Double.isNaN(pXpYD_scene[2])) {
System.out.println("getDPxSceneDParameters(): pXpYD_scene[2]==NaN.");
System.out.println("xyz4=["+xyz4[0]+","+xyz4[1]+","+xyz4[2]+","+xyz4[3]+"]");
System.out.println("scene_xyz=["+scene_xyz[0]+","+scene_xyz[1]+","+scene_xyz[2]+"]");
System.out.println("pXpYD_reference=["+pXpYD_reference[0]+","+pXpYD_reference[1]+","+pXpYD_reference[2]+"]");
return null;
}
Vector3D[] scene_vectors = ers_scene.getDWorldDPixels( // [0] X,Y,Z, other ones [DW_D* + 1]
correctDistortions,
......@@ -2111,8 +2132,12 @@ public class ErsCorrection extends GeometryCorrection {
scene_xyz,
scene_matrices_inverse,
debug_level);
if (scene_vectors == null) {
System.out.println("getDPxSceneDParameters(): scene_vectors==null. Why?");
return null;
}
Matrix dx_dpscene = new Matrix(new double[][] {
scene_vectors[DW_DPX + 1].toArray(),
scene_vectors[DW_DPX + 1].toArray(), // null pointer?
scene_vectors[DW_DPY + 1].toArray(),
scene_vectors[DW_DD + 1].toArray()}).transpose();
// next variables are {x,y,z} * disparity
......@@ -2153,8 +2178,10 @@ public class ErsCorrection extends GeometryCorrection {
dpscene_dxyz = dx_dpscene.inverse();
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("dx_dpscene is singular");
if (debug_level > -1) {
System.out.println("dx_dpscene is singular, debug_level="+debug_level+"> -1");
e.printStackTrace();
}
return null;
}
Matrix dpscene_dxyz_minus = dpscene_dxyz.times(-1.0); // negated to calculate /d{pX,pY,D) for the scene parameters
......
......@@ -1326,6 +1326,8 @@ public class ImageDtt extends ImageDttCPU {
public double [][][] clt_process_tl_interscene( // convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
// only used here to keep extra array element for disparity difference
boolean use3D, // generate disparity difference
final float [][][][] fcorr_td, // [tilesY][tilesX][pair][4*64] transform domain representation of all selected corr pairs
float [][][] num_acc, // number of accumulated tiles [tilesY][tilesX][pair] (or null). Can be inner null if not used in tp_tasks
double [] dcorr_weight, // alternative to num_acc, compatible with CPU processing (only one non-zero enough)
......@@ -1601,9 +1603,10 @@ public class ImageDtt extends ImageDttCPU {
}
}
if ((mv_td != null) || (mv_pd != null)) {
double [] mv = new double[3];
double [] mv = new double[3 + (use3D? 2 :0)]; // keep for disparity/strength
if (mv_pd != null) {
mv = mv_pd;
/// mv = mv_pd;
System.arraycopy(mv_pd, 0, mv, 0, 3); // keep [3] for optional disparities
// mv[2] *= pd_weight;
if ((mv_td != null) && !td_nopd_only) { // mix
mv[0] = (mv[0] * pd_weight + mv_td[0] * td_weight)/ (pd_weight + td_weight);
......@@ -1612,7 +1615,8 @@ public class ImageDtt extends ImageDttCPU {
mv[2] = (mv[2] * pd_weight + mv_td[2] * td_weight)/ (pd_weight + td_weight);
} // mix
} else { // (mv_pd == null) && (mv_td != null) below
mv = mv_td;
/// mv = mv_td;
System.arraycopy(mv_td, 0, mv, 0, 3); // keep [3] for optional disparities
//mv[2] *= td_weight;
}
if (mv != null) {
......
......@@ -29,6 +29,10 @@ import java.util.Properties;
import com.elphel.imagej.common.GenericJTabbedDialog;
public class IntersceneLmaParameters {
public boolean ilma_3d = false; // use disparity for interscene matching (as for UAS imagery)
public double ilma_disparity_weight = 2.0; // disparity component weight compared to dX and dY
public boolean ilma_3d_lma = false; // Use LMA for disparity in 3D pose matching mode
public boolean ilma_3d_tilt_only = true; // remove disparity average, use tilts only
public boolean ilma_thread_invariant = true; // Do not use DoubleAdder, provide results not dependent on threads
public boolean [] ilma_lma_select = new boolean [ErsCorrection.DP_NUM_PARS]; // first three will not be used
public double [] ilma_regularization_weights = new double [ErsCorrection.DP_NUM_PARS]; // first three will not be used
......@@ -107,6 +111,15 @@ public class IntersceneLmaParameters {
public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addMessage("Interframe LMA parameters selection");
gd.addCheckbox ("3D mode (use disparity)", this.ilma_3d,
"Use disparity for interscene matching (as for UAS imagery)" );
gd.addNumericField("Disp[arity weight", this.ilma_disparity_weight, 6,8,"",
"Disparity component weight compared to dX and dY");
gd.addCheckbox ("LMA in 3D mode", this.ilma_3d_lma,
"Use LMA disparity for interscene matching (as for UAS imagery)" );
gd.addCheckbox ("Remove average disparity, use tilts only", this.ilma_3d_tilt_only,
"Calculate disparity for tilts only." );
gd.addCheckbox ("Thread-invariant execution", this.ilma_thread_invariant,
"Do not use DoubleAdder and provide results not dependent on threads" );
for (int i = ErsCorrection.DP_DVAZ; i < ErsCorrection.DP_NUM_PARS; i++) {
......@@ -163,6 +176,10 @@ public class IntersceneLmaParameters {
}
public void dialogAnswers(GenericJTabbedDialog gd) {
this.ilma_3d = gd.getNextBoolean();
this.ilma_disparity_weight = gd.getNextNumber();
this.ilma_3d_lma = gd.getNextBoolean();
this.ilma_3d_tilt_only = gd.getNextBoolean();
this.ilma_thread_invariant = gd.getNextBoolean();
for (int i = ErsCorrection.DP_DVAZ; i < ErsCorrection.DP_NUM_PARS; i++) {
this.ilma_lma_select[i] = gd.getNextBoolean();
......@@ -191,6 +208,10 @@ public class IntersceneLmaParameters {
}
public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"ilma_3d", this.ilma_3d+"");
properties.setProperty(prefix+"ilma_disparity_weight", this.ilma_disparity_weight+"");
properties.setProperty(prefix+"ilma_3d_lma", this.ilma_3d_lma+"");
properties.setProperty(prefix+"ilma_3d_tilt_only", this.ilma_3d_tilt_only+"");
properties.setProperty(prefix+"ilma_thread_invariant", this.ilma_thread_invariant+"");
for (int i = ErsCorrection.DP_DVAZ; i < ErsCorrection.DP_NUM_PARS; i++) {
properties.setProperty(prefix+ErsCorrection.DP_DERIV_NAMES[i]+"_sel", this.ilma_lma_select[i]+"");
......@@ -216,6 +237,10 @@ public class IntersceneLmaParameters {
properties.setProperty(prefix+"ilma_debug_ers", this.ilma_debug_ers+"");
}
public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"ilma_3d")!=null) this.ilma_3d=Boolean.parseBoolean(properties.getProperty(prefix+"ilma_3d"));
if (properties.getProperty(prefix+"ilma_disparity_weight")!=null) this.ilma_disparity_weight=Double.parseDouble(properties.getProperty(prefix+"ilma_disparity_weight"));
if (properties.getProperty(prefix+"ilma_3d_lma")!=null) this.ilma_3d_lma=Boolean.parseBoolean(properties.getProperty(prefix+"ilma_3d_lma"));
if (properties.getProperty(prefix+"ilma_3d_tilt_only")!=null) this.ilma_3d_tilt_only=Boolean.parseBoolean(properties.getProperty(prefix+"ilma_3d_tilt_only"));
if (properties.getProperty(prefix+"ilma_thread_invariant")!=null) this.ilma_thread_invariant=Boolean.parseBoolean(properties.getProperty(prefix+"ilma_thread_invariant"));
for (int i = ErsCorrection.DP_DVAZ; i < ErsCorrection.DP_NUM_PARS; i++) {
String pn_sel = prefix+ErsCorrection.DP_DERIV_NAMES[i]+"_sel";
......@@ -255,6 +280,10 @@ public class IntersceneLmaParameters {
@Override
public IntersceneLmaParameters clone() throws CloneNotSupportedException {
IntersceneLmaParameters ilp = new IntersceneLmaParameters();
ilp.ilma_3d = this.ilma_3d;
ilp.ilma_disparity_weight = this.ilma_disparity_weight;
ilp.ilma_3d_lma = this.ilma_3d_lma;
ilp.ilma_3d_tilt_only = this.ilma_3d_tilt_only;
ilp.ilma_thread_invariant = this.ilma_thread_invariant;
System.arraycopy(this.ilma_lma_select, 0, ilp.ilma_lma_select, 0, ilma_lma_select.length);
System.arraycopy(this.ilma_regularization_weights, 0, ilp.ilma_regularization_weights, 0, ilma_regularization_weights.length);
......
......@@ -67,7 +67,11 @@ public class IntersceneMatchParameters {
public boolean [] generate_stereo_var = new boolean[stereo_views.length];
// Other parameters
public double scale_extrap_atr = 1.0; // scale angular extrapolation
public double scale_extrap_xyz = 0.0; // scale linear extrapolation (1.0 for drones)
public int avg_len = 1; // average pose over number of previous scenes
public int min_num_scenes = 10; // abandon series if there are less than this number of scenes in it
public int max_num_scenes = 100; // abandon series if longer than
public double blur_egomotion = 2.0;
......@@ -449,13 +453,23 @@ public class IntersceneMatchParameters {
"Display calculated depth map in meters");
gd.addMessage ("Additional parameters");
gd.addCheckbox ("Color NaN background", this.show_color_nan,
"Use NaN for undefined tiles (false - 0.0f). NaN produces sharp distinct result, 0.0f - blended");
gd.addCheckbox ("Mono NaN background", this.show_mono_nan,
"Use NaN for undefined tiles (false - 0.0f). NaN produces sharp distinct result, 0.0f - blended");
gd.addNumericField("Scale angular pose extrapolation", this.scale_extrap_atr, 3,5,"",
"Scale angular extrapolation relative to the previous pair");
gd.addNumericField("Scale linear pose extrapolation", this.scale_extrap_xyz, 3,5,"",
"Scale linear extrapolation relative to the previous pair (use 1.0 for a drone)");
gd.addNumericField("Number of previous scenes to extrapolate",this.avg_len, 0,3,"",
"Average this number of previous scenes movement for next scene prediction");
gd.addNumericField("Minimal number of scenes to keep series",this.min_num_scenes, 0,3,"",
"Scrap all seriest if less numer of scenes can be matched to the reference scene (including reference itself)");
gd.addNumericField("Cut longer series", this.max_num_scenes, 0,3,"",
"Cut longer series");
gd.addNumericField("LPF egomotion sigma", this.blur_egomotion, 3,5,"scenes",
"LPF egomotion components with this sigma before using as ERS (not implemented).");
......@@ -999,8 +1013,11 @@ public class IntersceneMatchParameters {
this.show_color_nan = gd.getNextBoolean();
this.show_mono_nan = gd.getNextBoolean();
this.scale_extrap_atr = gd.getNextNumber();
this.scale_extrap_xyz = gd.getNextNumber();
this.avg_len = (int) gd.getNextNumber();
this.min_num_scenes = (int) gd.getNextNumber();
this.max_num_scenes = (int) gd.getNextNumber();
this.blur_egomotion = gd.getNextNumber();
this.range_disparity_offset = gd.getNextNumber();
this.range_min_strength = gd.getNextNumber();
......@@ -1008,9 +1025,6 @@ public class IntersceneMatchParameters {
this.export3d = gd.getNextBoolean();
this.scene_is_ref_test = gd.getNextBoolean();
this.render_ref = gd.getNextBoolean();
this.render_scene = gd.getNextBoolean();
......@@ -1329,12 +1343,15 @@ public class IntersceneMatchParameters {
properties.setProperty(prefix+"show_color_nan", this.show_color_nan + ""); // boolean
properties.setProperty(prefix+"show_mono_nan", this.show_mono_nan + ""); // boolean
properties.setProperty(prefix+"scale_extrap_atr", this.scale_extrap_atr+""); // double
properties.setProperty(prefix+"scale_extrap_xyz", this.scale_extrap_xyz+""); // double
properties.setProperty(prefix+"avg_len", this.avg_len+""); // int
properties.setProperty(prefix+"min_num_scenes", this.min_num_scenes+""); // int
properties.setProperty(prefix+"max_num_scenes", this.max_num_scenes+""); // int
properties.setProperty(prefix+"blur_egomotion", this.blur_egomotion+""); // double
properties.setProperty(prefix+"range_disparity_offset", this.range_disparity_offset+""); // double
properties.setProperty(prefix+"range_min_strength", this.range_min_strength+""); // double
properties.setProperty(prefix+"range_max", this.range_max+""); // double
properties.setProperty(prefix+"export3d", this.export3d+""); // boolean
properties.setProperty(prefix+"scene_is_ref_test", this.scene_is_ref_test+""); // boolean
......@@ -1606,7 +1623,13 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"show_color_nan")!=null) this.show_color_nan=Boolean.parseBoolean(properties.getProperty(prefix+"show_color_nan"));
if (properties.getProperty(prefix+"show_mono_nan")!=null) this.show_mono_nan=Boolean.parseBoolean(properties.getProperty(prefix+"show_mono_nan"));
if (properties.getProperty(prefix+"scale_extrap_atr")!=null) this.scale_extrap_atr=Double.parseDouble(properties.getProperty(prefix+"scale_extrap_atr"));
if (properties.getProperty(prefix+"scale_extrap_xyz")!=null) this.scale_extrap_xyz=Double.parseDouble(properties.getProperty(prefix+"scale_extrap_xyz"));
if (properties.getProperty(prefix+"avg_len")!=null) this.avg_len=Integer.parseInt(properties.getProperty(prefix+"avg_len"));
if (properties.getProperty(prefix+"min_num_scenes")!=null) this.min_num_scenes=Integer.parseInt(properties.getProperty(prefix+"min_num_scenes"));
if (properties.getProperty(prefix+"max_num_scenes")!=null) this.max_num_scenes=Integer.parseInt(properties.getProperty(prefix+"max_num_scenes"));
if (properties.getProperty(prefix+"blur_egomotion")!=null) this.blur_egomotion=Double.parseDouble(properties.getProperty(prefix+"blur_egomotion"));
if (properties.getProperty(prefix+"range_disparity_offset")!=null)this.range_disparity_offset=Double.parseDouble(properties.getProperty(prefix+"range_disparity_offset"));
if (properties.getProperty(prefix+"range_min_strength")!=null) this.range_min_strength=Double.parseDouble(properties.getProperty(prefix+"range_min_strength"));
......@@ -1895,15 +1918,17 @@ public class IntersceneMatchParameters {
imp.debug_ranges = this.debug_ranges;
imp.show_ranges = this.show_ranges;
imp.export_ml_files = this.export_ml_files;
imp.show_color_nan = this.show_color_nan;
imp.show_mono_nan = this.show_mono_nan;
imp.scale_extrap_atr = this.scale_extrap_atr;
imp.scale_extrap_xyz = this.scale_extrap_xyz;
imp.avg_len = this.avg_len;
imp.min_num_scenes = this.min_num_scenes;
imp.max_num_scenes = this.max_num_scenes;
imp.blur_egomotion = this.blur_egomotion;
imp.range_disparity_offset = this.range_disparity_offset;
imp.range_min_strength = this.range_min_strength;
imp.range_max = this.range_max;
imp.export3d = this.export3d;
......
......@@ -807,7 +807,7 @@ public class QuadCLT extends QuadCLTCPU {
debugLevel); // int debugLevel);
// once per quad here
// once per quad here. "GPU not initialized, using CPU mode"
processCLTQuadCorrGPU( // returns ImagePlus, but it already should be saved/shown
null, // imp_srcs, // [srcChannel], // should have properties "name"(base for saving results), "channel","path"
saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null
......
......@@ -189,6 +189,9 @@ public class QuadCLTCPU {
}
String ts = scenes[nscene].getImageName();
if (!ts.equals(ts_ref)) {
if (ers_reference.getScene(ts) == null) {
return nscene + 1;
}
double [] scene_xyz = ers_reference.getSceneXYZ(ts);
double [] scene_atr = ers_reference.getSceneATR(ts);
if ((scene_xyz == null) || (scene_atr == null)){
......@@ -15028,7 +15031,43 @@ public class QuadCLTCPU {
return true;
}
public boolean writePreview(
double [] data,
// boolean overwrite, // correctionsParameters.thumb_overwrite
int debugLevel
)
{
int width = getTileProcessor().getTilesX() *getTileProcessor().getTileSize();
int height = data.length/width;
String set_name = getImageName();
if (set_name == null ) {
QuadCLTCPU.SetChannels [] set_channels = setChannels(debugLevel);
set_name = set_channels[0].set_name;
}
String model_dir= correctionsParameters.selectX3dDirectory(
set_name, // quad timestamp. Will be ignored if correctionsParameters.use_x3d_subdirs is false
null,
true, // smart,
true); //newAllowed, // save\
String title = getImageName()+"-preview";
ImagePlus imp= ShowDoubleFloatArrays.makeArrays(data, width, height, title);
String preview_path = model_dir + Prefs.getFileSeparator() + title+".jpeg";
if (new File(preview_path).exists() && !correctionsParameters.thumb_overwrite) {
System.out.println("file "+preview_path+" exists, skipping preview generation");
return false;
}
if (debugLevel > -2) {
System.out.println("Saving preview image to "+preview_path);
}
EyesisCorrections.saveAndShow(
imp,
model_dir,
false,
false,
correctionsParameters.JPEG_quality, // jpegQuality); // jpegQuality){// <0 - keep current, 0 - force Tiff, >0 use for JPEG
(debugLevel > -2) ? debugLevel : 1); // int debugLevel (print what it saves)
return true;
}
public boolean writeRatingFile( // USED in lwir
int debugLevel
......
......@@ -2691,7 +2691,7 @@ public class TexturedModel {
boolean [] scenes_sel = new boolean[scenes.length];
// for (int i = scenes.length - 10; i < scenes.length; i++) { // start with just one (reference) scene
for (int i = 0; i < scenes.length; i++) { // start with just one (reference) scene
for (int i = 0; i < scenes.length; i++) if (scenes[i] != null){ // start with just one (reference) scene
scenes_sel[i] = true;
}
......@@ -7297,7 +7297,7 @@ public class TexturedModel {
min_trim_disparity, // final double min_trim_disparity, // do not try to trim texture outlines with lower disparities
tp_tasks_ref, // final TpTask[][][] tp_tasks_ref, // reference tasks for each slice to get offsets
ref_scene.getImageName()); // null); // ref_scene.getImageName()); // final String dbg_prefix);
if (debugLevel > -1) {
if (debugLevel > -20) {
double [][] dbg_textures = new double [faded_textures.length * faded_textures[0].length][faded_textures[0][0].length];
String [] dbg_titles = new String[dbg_textures.length];
String [] dbg_subtitles = new String [faded_textures[0].length];
......@@ -7309,14 +7309,22 @@ public class TexturedModel {
dbg_titles[i] = dbg_subtitles[i % dbg_subtitles.length] + "-" + (i / dbg_subtitles.length);
}
String suffix = "-combined_textures-prenorm-pre_UM";
if (!batch_run && (debugLevel > -1)) {
ShowDoubleFloatArrays.showArrays(
dbg_textures,
tilesX * transform_size,
tilesY * transform_size,
true,
ref_scene.getImageName()+"-combined_textures-prenorm-pre_UM",
ref_scene.getImageName()+suffix,
dbg_titles);
}
ref_scene.saveDoubleArrayInModelDirectory(
suffix, // String suffix,
null, // String [] labels, // or null
dbg_textures, // double [][] data,
tilesX * transform_size, // int width, // int tilesX,
tilesY * transform_size); // int height, // int tilesY,
}
// fix alpha
if (alphaOverlapFix) {
......@@ -7342,7 +7350,7 @@ public class TexturedModel {
THREADS_MAX); // final int threadsMax) // maximal number of threads to launch
}
if (debugLevel > -1) {
if (debugLevel > -20) {
double [][] dbg_textures = new double [faded_textures.length * faded_textures[0].length][faded_textures[0][0].length];
String [] dbg_titles = new String[dbg_textures.length];
String [] dbg_subtitles = new String [faded_textures[0].length];
......@@ -7355,14 +7363,23 @@ public class TexturedModel {
dbg_titles[i] = dbg_subtitles[i % dbg_subtitles.length] + "-" + (i / dbg_subtitles.length);
}
String suffix = "-combined_textures-filled-NaNs";
if (!batch_run && (debugLevel > -1)) {
ShowDoubleFloatArrays.showArrays(
dbg_textures,
tilesX * transform_size,
tilesY * transform_size,
true,
ref_scene.getImageName()+"-combined_textures-filled-NaNs",
ref_scene.getImageName()+suffix,
dbg_titles);
}
ref_scene.saveDoubleArrayInModelDirectory(
suffix, // String suffix,
null, // String [] labels, // or null
dbg_textures, // double [][] data,
tilesX * transform_size, // int width, // int tilesX,
tilesY * transform_size); // int height, // int tilesY,
}
// Optionally apply UM (before auto/manual range)
final boolean um_ignore_alpha = true;
......@@ -7376,7 +7393,7 @@ public class TexturedModel {
tex_um_weight); // final double um_weight)
}
if (debugLevel > -1) {
if (debugLevel > -20) {
double [][] dbg_textures = new double [faded_textures.length * faded_textures[0].length][faded_textures[0][0].length];
String [] dbg_titles = new String[dbg_textures.length];
String [] dbg_subtitles = new String [faded_textures[0].length];
......@@ -7389,20 +7406,39 @@ public class TexturedModel {
dbg_titles[i] = dbg_subtitles[i % dbg_subtitles.length] + "-" + (i / dbg_subtitles.length);
}
String suffix = "-combined_textures-prenorm";
if (!batch_run && (debugLevel > -1)) {
ShowDoubleFloatArrays.showArrays(
dbg_textures,
tilesX * transform_size,
tilesY * transform_size,
true,
ref_scene.getImageName()+"-combined_textures-prenorm",
ref_scene.getImageName()+suffix,
dbg_titles);
}
ref_scene.saveDoubleArrayInModelDirectory(
suffix, // String suffix,
null, // String [] labels, // or null
dbg_textures, // double [][] data,
tilesX * transform_size, // int width, // int tilesX,
tilesY * transform_size); // int height, // int tilesY,
if (dbg_weights != null) {
suffix = "-texture_weights-prenorm";
if (!batch_run && (debugLevel > -1)) {
ShowDoubleFloatArrays.showArrays(
dbg_weights,
tilesX,
tilesY,
tilesX * transform_size,
tilesY * transform_size,
true,
ref_scene.getImageName()+"-texture_weights-prenorm");
ref_scene.getImageName()+suffix,
dbg_titles);
}
ref_scene.saveDoubleArrayInModelDirectory(
suffix, // String suffix,
null, // String [] labels, // or null
dbg_weights, // double [][] data,
tilesX * transform_size, // int width, // int tilesX,
tilesY * transform_size); // int height, // int tilesY,
}
}
......@@ -7471,7 +7507,7 @@ public class TexturedModel {
}
if (!batch_run && (debugLevel > -2)) {
if (debugLevel > -20) { // always
double [][] dbg_textures = new double [faded_textures.length * faded_textures[0].length][faded_textures[0][0].length];
String [] dbg_titles = new String[dbg_textures.length];
String [] dbg_subtitles = new String [faded_textures[0].length];
......@@ -7484,21 +7520,47 @@ public class TexturedModel {
dbg_titles[i] = dbg_subtitles[i % dbg_subtitles.length] + "-" + (i / dbg_subtitles.length);
}
ref_scene.writePreview( // may movbe to different (earlier) stage of processing, (search for "-combined_textures")
dbg_textures[0], // double [] data,
debugLevel); // int debugLevel
String suffix = "-combined_textures";
if (!batch_run && (debugLevel > -1)) {
ShowDoubleFloatArrays.showArrays(
dbg_textures,
tilesX * transform_size,
tilesY * transform_size,
true,
ref_scene.getImageName()+"-combined_textures",
ref_scene.getImageName()+suffix,
dbg_titles);
}
ref_scene.saveDoubleArrayInModelDirectory(
suffix, // String suffix,
null, // String [] labels, // or null
dbg_textures, // double [][] data,
tilesX * transform_size, // int width, // int tilesX,
tilesY * transform_size); // int height, // int tilesY,
if (dbg_weights != null) {
suffix = "-texture_weights";
if (!batch_run && (debugLevel > -1)) {
ShowDoubleFloatArrays.showArrays(
dbg_weights,
tilesX,
tilesY,
tilesX * transform_size,
tilesY * transform_size,
true,
ref_scene.getImageName()+"-texture_weights");
ref_scene.getImageName()+suffix,
dbg_titles);
}
ref_scene.saveDoubleArrayInModelDirectory(
suffix, // String suffix,
null, // String [] labels, // or null
dbg_weights, // double [][] data,
tilesX * transform_size, // int width, // int tilesX,
tilesY * transform_size); // int height, // int tilesY,
}
}
return faded_textures;
}
......@@ -7528,6 +7590,7 @@ public class TexturedModel {
int transform_size,
int debugLevel)
{
boolean save_tiff_texture = true;
if (debugLevel > -2) {
System.out.println("getInterCombinedTextures(): no_alpha=" + no_alpha); // true
}
......@@ -7540,8 +7603,18 @@ public class TexturedModel {
double [] minmax = parameter_scene.getColdHot(); // used in linearStackToColor
ImagePlus [] imp_tex = new ImagePlus[num_slices];
for (int nslice = 0; nslice < num_slices; nslice++) {
String suffix=String.format("-combo%03d-texture",nslice);
String title=String.format("%s-combo%03d-texture",ref_scene.getImageName(), nslice);
double [][] rendered_texture = faded_textures[nslice].clone(); // shallow !
if (save_tiff_texture) {
ref_scene.saveDoubleArrayInModelDirectory(
suffix, // String suffix,
null, // String [] labels, // or null
rendered_texture, // double [][] data,
tilesX * transform_size, // int width, // int tilesX,
tilesY * transform_size); // int height, // int tilesY,
}
if (no_alpha) {
rendered_texture[1] = new double [rendered_texture[0].length];
for (int i = 0; i < rendered_texture[0].length; i++) {
......
......@@ -124,7 +124,9 @@ public class XyzAtr {
String.format("%f, %f, %f, %f, %f, %f",ers_xyz_d2t[0], ers_xyz_d2t[1], ers_xyz_d2t[2], ers_atr_d2t[0], ers_atr_d2t[1], ers_atr_d2t[2])};
}
public double [][] getXYZATR() {
return new double[][] {xyz,atr};
}
public double [] getXYZ() {
return xyz;
}
......
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