Commit 1aa3cc9e authored by Andrey Filippov's avatar Andrey Filippov

Other earlier changes

parent 31d4cc0f
...@@ -639,7 +639,6 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -639,7 +639,6 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
addButton("CLT process files", panelClt1, color_process); addButton("CLT process files", panelClt1, color_process);
addButton("CLT process sets", panelClt1, color_process); addButton("CLT process sets", panelClt1, color_process);
addButton("CLT process quads", panelClt1, color_process);
plugInFrame.add(panelClt1); plugInFrame.add(panelClt1);
} }
...@@ -4301,68 +4300,6 @@ public class Eyesis_Correction implements PlugIn, ActionListener { ...@@ -4301,68 +4300,6 @@ public class Eyesis_Correction implements PlugIn, ActionListener {
} }
return; return;
} else if (label.equals("CLT process quads")) {
DEBUG_LEVEL = MASTER_DEBUG_LEVEL;
EYESIS_CORRECTIONS.setDebug(DEBUG_LEVEL);
if (QUAD_CLT == null) {
QUAD_CLT = new QuadCLT(QuadCLT.PREFIX, PROPERTIES, EYESIS_CORRECTIONS, CORRECTION_PARAMETERS);
if (DEBUG_LEVEL > 0) {
System.out.println("Created new QuadCLT instance, will need to read CLT kernels");
}
}
String configPath = getSaveCongigPath();
if (configPath.equals("ABORT"))
return;
EYESIS_CORRECTIONS.initSensorFiles(DEBUG_LEVEL);
int numChannels = EYESIS_CORRECTIONS.getNumChannels();
// NONLIN_PARAMETERS.modifyNumChannels(numChannels);
CHANNEL_GAINS_PARAMETERS.modifyNumChannels(numChannels);
if (!QUAD_CLT.CLTKernelsAvailable()) {
if (DEBUG_LEVEL > 0) {
System.out.println("Reading CLT kernels");
}
QUAD_CLT.readCLTKernels(CLT_PARAMETERS, THREADS_MAX, UPDATE_STATUS, // update status info
DEBUG_LEVEL);
if (DEBUG_LEVEL > 1) {
QUAD_CLT.showCLTKernels(THREADS_MAX, UPDATE_STATUS, // update status info
DEBUG_LEVEL);
}
}
if (!QUAD_CLT.geometryCorrectionAvailable()) {
if (DEBUG_LEVEL > 0) {
System.out.println("Calculating geometryCorrection");
}
if (!QUAD_CLT.initGeometryCorrection(DEBUG_LEVEL + 2)) {
return;
}
}
///========================================
QUAD_CLT.processCLTQuads( // uses quad
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS, // EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS, // EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CHANNEL_GAINS_PARAMETERS, // CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS, // EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS, // EyesisCorrectionParameters.EquirectangularParameters
// equirectangularParameters,
THREADS_MAX, // final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, // final boolean updateStatus,
DEBUG_LEVEL); // final int debugLevel);
if (configPath != null) {
saveTimestampedProperties( // save config again
configPath, // full path or null
null, // use as default directory if path==null
true, PROPERTIES);
}
return;
} else if (label.equals("CLT 4 images") || label.equals("CLT apply fine corr") } else if (label.equals("CLT 4 images") || label.equals("CLT apply fine corr")
|| label.equals("CLT infinity corr") || label.equals("CORR TEST") || label.equals("ERS main")) { || label.equals("CLT infinity corr") || label.equals("CORR TEST") || label.equals("ERS main")) {
boolean apply_corr = label.equals("CLT apply fine corr"); boolean apply_corr = label.equals("CLT apply fine corr");
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/** /**
** TexturedModel - Generate 3D mesh with textures ** TexturedModel - Generate 3D mesh with textures
** **
** Copyright (C) 2017 Elphel, Inc. ** Copyright (C) 2022 Elphel, Inc.
** **
** -----------------------------------------------------------------------------** ** -----------------------------------------------------------------------------**
** **
...@@ -35,8 +35,6 @@ import com.elphel.imagej.cameras.ColorProcParameters; ...@@ -35,8 +35,6 @@ import com.elphel.imagej.cameras.ColorProcParameters;
import com.elphel.imagej.cameras.EyesisCorrectionParameters; import com.elphel.imagej.cameras.EyesisCorrectionParameters;
import com.elphel.imagej.common.ShowDoubleFloatArrays; import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.correction.EyesisCorrections; import com.elphel.imagej.correction.EyesisCorrections;
import com.elphel.imagej.gpu.GpuQuad;
import com.elphel.imagej.gpu.TpTask;
import com.elphel.imagej.x3d.export.GlTfExport; import com.elphel.imagej.x3d.export.GlTfExport;
import com.elphel.imagej.x3d.export.TriMesh; import com.elphel.imagej.x3d.export.TriMesh;
import com.elphel.imagej.x3d.export.WavefrontExport; import com.elphel.imagej.x3d.export.WavefrontExport;
...@@ -555,7 +553,7 @@ public class TexturedModel { ...@@ -555,7 +553,7 @@ public class TexturedModel {
ArrayList<TriMesh> tri_meshes = null; ArrayList<TriMesh> tri_meshes = null;
long startStepTime=System.nanoTime(); long startStepTime=System.nanoTime();
final int tilesX = tp.getTilesX(); final int tilesX = tp.getTilesX();
final int tilesY = tp.getTilesY(); // final int tilesY = tp.getTilesY();
final int transform_size = tp.getTileSize(); final int transform_size = tp.getTileSize();
final double tex_disp_adiffo = clt_parameters.tex_disp_adiffo; // 0.35; // 0.3; disparity absolute tolerance to connect in ortho directions final double tex_disp_adiffo = clt_parameters.tex_disp_adiffo; // 0.35; // 0.3; disparity absolute tolerance to connect in ortho directions
final double tex_disp_rdiffo = clt_parameters.tex_disp_rdiffo; // 0.12; // 0.1; disparity relative tolerance to connect in ortho directions final double tex_disp_rdiffo = clt_parameters.tex_disp_rdiffo; // 0.12; // 0.1; disparity relative tolerance to connect in ortho directions
...@@ -563,7 +561,7 @@ public class TexturedModel { ...@@ -563,7 +561,7 @@ public class TexturedModel {
final double tex_disp_rdiffd = clt_parameters.tex_disp_rdiffd; // 0.18; // 0.12; disparity relative tolerance to connect in diagonal directions final double tex_disp_rdiffd = clt_parameters.tex_disp_rdiffd; // 0.18; // 0.12; disparity relative tolerance to connect in diagonal directions
final double tex_disp_fof = clt_parameters.tex_disp_fof; // 1.5; // Increase tolerance for friend of a friend final double tex_disp_fof = clt_parameters.tex_disp_fof; // 1.5; // Increase tolerance for friend of a friend
final double tex_fg_bg = clt_parameters.tex_fg_bg; // 0.1; // Minimal FG/BG disparity difference (NaN bg if difference from FG < this) final double tex_fg_bg = clt_parameters.tex_fg_bg; // 0.1; // Minimal FG/BG disparity difference (NaN bg if difference from FG < this)
final double tex_distort = clt_parameters.tex_distort; // 0.1; // Maximal texture distortion to accumulate multiple scenes // final double tex_distort = clt_parameters.tex_distort; // 0.1; // Maximal texture distortion to accumulate multiple scenes
// get multi-scene disparity map for FG and BG and filter it // get multi-scene disparity map for FG and BG and filter it
if (combo_dsn_final == null) { if (combo_dsn_final == null) {
combo_dsn_final =scenes[ref_index].readDoubleArrayFromModelDirectory( combo_dsn_final =scenes[ref_index].readDoubleArrayFromModelDirectory(
...@@ -799,6 +797,11 @@ public class TexturedModel { ...@@ -799,6 +797,11 @@ public class TexturedModel {
} }
// Save KML and ratings files if they do not exist (so not to overwrite edited ones), make them world-writable // Save KML and ratings files if they do not exist (so not to overwrite edited ones), make them world-writable
if (!correctionsParameters.use_set_dirs) {
System.out.println("**** output3d(): likely a bug (not copied?), temporary fix ***");
correctionsParameters.use_set_dirs = true;
}
ref_scene.writeKml (null, debugLevel); ref_scene.writeKml (null, debugLevel);
ref_scene.writeRatingFile (debugLevel); ref_scene.writeRatingFile (debugLevel);
Runtime.getRuntime().gc(); Runtime.getRuntime().gc();
...@@ -1073,6 +1076,48 @@ public class TexturedModel { ...@@ -1073,6 +1076,48 @@ public class TexturedModel {
tex_um_sigma, // final double um_sigma, tex_um_sigma, // final double um_sigma,
tex_um_weight); // final double um_weight) tex_um_weight); // final double um_weight)
} }
if (debug_level > -1) {
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];
for (int i = 0; i < dbg_subtitles.length; i++) {
dbg_subtitles[i] = (i < (dbg_subtitles.length -1)) ? ("Y"+i):"alpha";
}
for (int i = 0; i < dbg_textures.length; i++) {
dbg_textures[i] = faded_textures[i / faded_textures[0].length][i % faded_textures[0].length];
dbg_titles[i] = dbg_subtitles[i % dbg_subtitles.length] + "-" + (i / dbg_subtitles.length);
}
ShowDoubleFloatArrays.showArrays(
dbg_textures,
tilesX * transform_size,
tilesY * transform_size,
true,
ref_scene.getImageName()+"-combined_textures-prenorm",
dbg_titles);
if (dbg_overlap != null) {
ShowDoubleFloatArrays.showArrays(
dbg_overlap,
2 * tilesX * transform_size,
2 * tilesY * transform_size,
true,
ref_scene.getImageName()+"-non-overlap_textures-prenorm",
dbg_titles);
}
if (dbg_weights != null) {
ShowDoubleFloatArrays.showArrays(
dbg_weights,
tilesX,
tilesY,
true,
ref_scene.getImageName()+"-texture_weights-prenorm");
}
}
//renormalize //renormalize
// normalize all slices together if LWIR // normalize all slices together if LWIR
// FIXME: Should it be here? Will setColdHot() change photometric calibration ? Or should it be disabled? // FIXME: Should it be here? Will setColdHot() change photometric calibration ? Or should it be disabled?
...@@ -1092,8 +1137,8 @@ public class TexturedModel { ...@@ -1092,8 +1137,8 @@ public class TexturedModel {
} else { // for UM need to calculate min and max (probably OK for non-UM too !) } else { // for UM need to calculate min and max (probably OK for non-UM too !)
double [] minmax = QuadCLTCPU.getMinMaxTextures( double [] minmax = QuadCLTCPU.getMinMaxTextures(
faded_textures ); //double [][][] textures // [slices][nchn][i] faded_textures ); //double [][][] textures // [slices][nchn][i]
rel_low = minmax[0]; rel_low = minmax[0]; // absolute min
rel_high = minmax[1]; rel_high = minmax[1]; // absolute max
} }
double [] cold_hot = QuadCLTCPU.autorangeTextures( double [] cold_hot = QuadCLTCPU.autorangeTextures(
faded_textures, // double [][][] textures, // [nslices][nchn][i] faded_textures, // double [][][] textures, // [nslices][nchn][i]
...@@ -1414,7 +1459,7 @@ public class TexturedModel { ...@@ -1414,7 +1459,7 @@ public class TexturedModel {
final int alpha_chn = is_mono ? 1: 3; final int alpha_chn = is_mono ? 1: 3;
final int [] cluster_index = tileCluster.getClusterIndex(); final int [] cluster_index = tileCluster.getClusterIndex();
final boolean [] borderTiles = tileCluster.getBorder(); // .getBorderTiles(); final boolean [] borderTiles = tileCluster.getBorder(); // .getBorderTiles();
final boolean [] selected = tileCluster.getSelected(); // maybe not needed // final boolean [] selected = tileCluster.getSelected(); // maybe not needed
final double [][]alphaFade = TileProcessor.getAlphaFade(transform_size); final double [][]alphaFade = TileProcessor.getAlphaFade(transform_size);
final double [] alpha_zero = new double [4*transform_size*transform_size]; final double [] alpha_zero = new double [4*transform_size*transform_size];
final double [][][][] texture_tiles_cluster = new double[tilesY][tilesX][][]; final double [][][][] texture_tiles_cluster = new double[tilesY][tilesX][][];
......
...@@ -44,19 +44,19 @@ import com.google.gson.JsonParser; ...@@ -44,19 +44,19 @@ import com.google.gson.JsonParser;
import ij.Prefs; import ij.Prefs;
public class GlTfExport { public class GlTfExport {
public static int NEAREST = 9728; public static int NEAREST = 9728;
public static int LINEAR = 9729; public static int LINEAR = 9729;
public static int NEAREST_MIPMAP_NEAREST = 9984; public static int NEAREST_MIPMAP_NEAREST = 9984;
public static int LINEAR_MIPMAP_NEAREST = 9985; public static int LINEAR_MIPMAP_NEAREST = 9985;
public static int NEAREST_MIPMAP_LINEAR = 9986; public static int NEAREST_MIPMAP_LINEAR = 9986;
public static int LINEAR_MIPMAP_LINEAR = 9986; public static int LINEAR_MIPMAP_LINEAR = 9986;
public static int CLAMP_TO_EDGE = 33071; public static int CLAMP_TO_EDGE = 33071;
public static int MIRRORED_REPEAT = 33648; public static int MIRRORED_REPEAT = 33648;
public static int REPEAT = 10497; public static int REPEAT = 10497;
public static int ARRAY_BUFFER = 34962; // for attributes public static int ARRAY_BUFFER = 34962; // for attributes
public static int ELEMENT_ARRAY_BUFFER = 34963; // for indices public static int ELEMENT_ARRAY_BUFFER = 34963; // for indices
public static int COMPONENT_SIGNED_BYTE = 5120; public static int COMPONENT_SIGNED_BYTE = 5120;
public static int COMPONENT_UNSIGNED_BYTE = 5121; public static int COMPONENT_UNSIGNED_BYTE = 5121;
...@@ -77,13 +77,13 @@ public class GlTfExport { ...@@ -77,13 +77,13 @@ public class GlTfExport {
public static String TYPE_MAT3 = "MAT3"; // 9 public static String TYPE_MAT3 = "MAT3"; // 9
public static String TYPE_MAT4 = "MAT4"; // 16 public static String TYPE_MAT4 = "MAT4"; // 16
public static int MODE_POINTS = 0; public static int MODE_POINTS = 0;
public static int MODE_LINES = 1; public static int MODE_LINES = 1;
public static int MODE_LINE_LOOP = 2; public static int MODE_LINE_LOOP = 2;
public static int MODE_LINE_STRIP = 3; public static int MODE_LINE_STRIP = 3;
public static int MODE_TRIANGLES = 4; public static int MODE_TRIANGLES = 4;
public static int MODE_TRIANGLE_STRIP = 5; public static int MODE_TRIANGLE_STRIP = 5;
public static int MODE_TRIANGLE_FAN = 6; public static int MODE_TRIANGLE_FAN = 6;
public static void glTFExport( public static void glTFExport(
......
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