Commit 33977018 authored by Andrey Filippov's avatar Andrey Filippov

Working on extended window (more than reference scene sesnor view)

parent b4d88911
......@@ -95,7 +95,7 @@ public class ImagejJp4Tiff {
// private static final int FIXCH6_MAXVAL = 23367; // higher - subtract 4096, <19271 -add 4096
private static final int FIXCH6_EXPECTED = 21319; // expected value
private static final String FIXCH6_EARLIEST = "2021-12-01 00:00:00.000";
private static final String FIXCH6_LATEST = "2022-04-01 00:00:00.000";
private static final String FIXCH6_LATEST = "2022-12-01 00:00:00.000";
// -- Fields --
......
......@@ -141,35 +141,16 @@ public class ImageDtt extends ImageDttCPU {
final boolean macro_mode = macro_scale != 1; // correlate tile data instead of the pixel data
// final int quad = getNumSensors(); // 4; // number of subcameras
// final int numcol = 3; // number of colors // keep the same, just do not use [0] and [1], [2] - green
final int numcol = isMonochrome()?1:3;
final int width = gpuQuad.getImageWidth();
final int height = gpuQuad.getImageHeight();
final int tilesX=gpuQuad.getTilesX(); // width/transform_size;
final int tilesY=gpuQuad.getTilesY(); // final int tilesY=height/transform_size;
//// final int nTilesInChn=tilesX*tilesY;
//// final double [][][][][][] clt_data = new double[quad][numcol][tilesY][tilesX][][];
final Thread[] threads = newThreadArray(threadsMax);
final AtomicInteger ai = new AtomicInteger(0);
final double [] col_weights= new double [numcol]; // colors are RBG
final double [][] dbg_distort = debug_distort? (new double [4*getNumSensors()][tilesX*tilesY]) : null;
// not yet used with GPU
/**
final double [][] corr_wnd = Corr2dLMA.getCorrWnd(
transform_size,
imgdtt_params.lma_wnd);
final double [] corr_wnd_inv_limited = (imgdtt_params.lma_min_wnd <= 1.0)? new double [corr_wnd.length * corr_wnd[0].length]: null;
if (corr_wnd_inv_limited != null) {
double inv_pwr = imgdtt_params.lma_wnd_pwr - (imgdtt_params.lma_wnd - 1.0); // compensate for lma_wnd
for (int i = imgdtt_params.lma_hard_marg; i < (corr_wnd.length - imgdtt_params.lma_hard_marg); i++) {
for (int j = imgdtt_params.lma_hard_marg; j < (corr_wnd.length - imgdtt_params.lma_hard_marg); j++) {
corr_wnd_inv_limited[i * (corr_wnd.length) + j] = 1.0/Math.max(Math.pow(corr_wnd[i][j],inv_pwr), imgdtt_params.lma_min_wnd);
}
}
}
*/
// keep for now for mono, find out what do they mean for macro mode
if (isMonochrome()) {
......@@ -1173,6 +1154,7 @@ public class ImageDtt extends ImageDttCPU {
* @param globalDebugLevel
*/
public void setReferenceTD(
final int [] wh, // null (use sensor dimensions) or pair {width, height} in pixels
final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
final boolean use_reference_buffer,
final TpTask[] tp_tasks,
......@@ -1203,7 +1185,8 @@ public class ImageDtt extends ImageDttCPU {
tp_tasks,
false); // boolean use_aux // while is it in class member? - just to be able to free
// Skipping if ((fdisp_dist != null) || (fpxpy != null)) {...
gpuQuad.execConvertDirect(use_reference_buffer); // put results into a "reference" buffer
// int [] wh = null;
gpuQuad.execConvertDirect(use_reference_buffer, wh); // put results into a "reference" buffer
}
......
......@@ -33,8 +33,10 @@ public class IntersceneMatchParameters {
public boolean force_ref_dsi = false; // true;
public boolean force_orientations = false;
public boolean force_interscene = false; // true;
public boolean export_images = true; // 16-slice images (same disparity, COMBO_DSN_INDX_DISP_FG and COMBO_DSN_INDX_DISP_BG_ALL,
public boolean show_images = false;
public boolean export_images = true; // pseudo-color 16-slice images (same disparity, COMBO_DSN_INDX_DISP_FG and COMBO_DSN_INDX_DISP_BG_ALL,
public boolean show_images = false; // color, infinity
public boolean show_images_bgfg = false; // bg and fg
public boolean show_images_mono = false; // float, monochrome 16-slice images (same disparity, COMBO_DSN_INDX_DISP_FG and COMBO_DSN_INDX_DISP_BG_ALL,
public boolean show_ranges = true;
public double range_disparity_offset = -0.08;
......@@ -112,8 +114,12 @@ public class IntersceneMatchParameters {
"Force interscene calculation (+ML export) even if it was performed before.");
gd.addCheckbox ("Export all-sensor images", this.export_images,
"Export multi-slice images: with constant disparity, with foreground disparity, and with background disparity");
gd.addCheckbox ("Show exported images", this.show_images,
"Display generated/saved images");
gd.addCheckbox ("Show exported images (same disparity)", this.show_images,
"Display generated/saved image set, pseudocolors");
gd.addCheckbox ("Show exported FG/BG", this.show_images_bgfg,
"Show foreground and background exported images");
gd.addCheckbox ("Show floating-point monochrome images", this.show_images_mono,
"Display generated/saved monochrome images");
gd.addCheckbox ("Show distances in meters", this.show_ranges,
"Calculate strength, distance, X, and Y in meters");
......@@ -226,6 +232,8 @@ public class IntersceneMatchParameters {
this.force_interscene = gd.getNextBoolean();
this.export_images = gd.getNextBoolean();
this.show_images = gd.getNextBoolean();
this.show_images_bgfg = gd.getNextBoolean();
this.show_images_mono = gd.getNextBoolean();
this.show_ranges = gd.getNextBoolean();
this.range_disparity_offset = gd.getNextNumber();
this.range_min_strength = gd.getNextNumber();
......@@ -282,6 +290,8 @@ public class IntersceneMatchParameters {
properties.setProperty(prefix+"force_interscene", this.force_interscene + ""); // boolean
properties.setProperty(prefix+"export_images", this.export_images + ""); // boolean
properties.setProperty(prefix+"show_images", this.show_images + ""); // boolean
properties.setProperty(prefix+"show_images_bgfg", this.show_images_bgfg + ""); // boolean
properties.setProperty(prefix+"show_images_mono", this.show_images_mono + ""); // boolean
properties.setProperty(prefix+"show_ranges", this.show_ranges + ""); // boolean
properties.setProperty(prefix+"range_disparity_offset",this.range_disparity_offset+""); // double
......@@ -337,6 +347,8 @@ public class IntersceneMatchParameters {
if (properties.getProperty(prefix+"force_interscene")!=null) this.force_interscene=Boolean.parseBoolean(properties.getProperty(prefix+"force_interscene"));
if (properties.getProperty(prefix+"export_images")!=null) this.export_images=Boolean.parseBoolean(properties.getProperty(prefix+"export_images"));
if (properties.getProperty(prefix+"show_images")!=null) this.show_images=Boolean.parseBoolean(properties.getProperty(prefix+"show_images"));
if (properties.getProperty(prefix+"show_images_bgfg")!=null) this.show_images_bgfg=Boolean.parseBoolean(properties.getProperty(prefix+"show_images_bgfg"));
if (properties.getProperty(prefix+"show_images_mono")!=null) this.show_images_mono=Boolean.parseBoolean(properties.getProperty(prefix+"show_images_mono"));
if (properties.getProperty(prefix+"show_ranges")!=null) this.show_images=Boolean.parseBoolean(properties.getProperty(prefix+"show_ranges"));
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"));
......@@ -392,6 +404,8 @@ public class IntersceneMatchParameters {
imp.force_interscene = this.force_interscene;
imp.export_images = this.export_images;
imp.show_images = this.show_images;
imp.show_images_bgfg = this.show_images_bgfg;
imp.show_images_mono = this.show_images_mono;
imp.show_ranges = this.show_ranges;
imp.range_disparity_offset = this.range_disparity_offset;
imp.range_min_strength = this.range_min_strength;
......
package com.elphel.imagej.tileprocessor;
import java.awt.Rectangle;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicInteger;
......@@ -237,6 +238,7 @@ public class MultisceneLY {
String ts = scenes[nscene].getImageName();
if (nscene == last_scene_index) {
scenes_pXpYD[nscene] = OpticalFlow.transformToScenePxPyD(
null, // final Rectangle [] extra_woi, // show larger than sensor WOI (or null)
disparity_ref, // final double [] disparity_ref, // invalid tiles - NaN in disparity (maybe it should not be masked by margins?)
OpticalFlow.ZERO3, // final double [] scene_xyz, // camera center in world coordinates
OpticalFlow.ZERO3, // final double [] scene_atr, // camera orientation relative to world frame
......@@ -253,6 +255,7 @@ public class MultisceneLY {
scene_ers_atr_dt); // double [] ers_atr_dt)(ers_scene_original_xyz_dt);
//setupERS() will be inside transformToScenePxPyD()
scenes_pXpYD[nscene] = OpticalFlow.transformToScenePxPyD( // will be null for disparity == NaN, total size - tilesX*tilesY
null, // final Rectangle [] extra_woi, // show larger than sensor WOI (or null)
disparity_ref, // final double [] disparity_ref, // invalid tiles - NaN in disparity (maybe it should not be masked by margins?)
scene_xyz, // final double [] scene_xyz, // camera center in world coordinates
scene_atr, // final double [] scene_atr, // camera orientation relative to world frame
......
......@@ -1175,12 +1175,15 @@ public class QuadCLTCPU {
}
public void saveImagePlusInModelDirectory(
String suffix,
String suffix, // null - use title from the imp
ImagePlus imp)
{
String x3d_path = getX3dDirectory();
String file_name = image_name + suffix;
String file_path = x3d_path + Prefs.getFileSeparator() + file_name + ".tiff";
String file_name = (suffix==null) ? imp.getTitle():(image_name + suffix);
String file_path = x3d_path + Prefs.getFileSeparator() + file_name; // + ".tiff";
if (!file_path.endsWith(".tiff")) {
file_path +=".tiff";
}
FileSaver fs=new FileSaver(imp);
fs.saveAsTiff(file_path);
System.out.println("saveDoubleArrayInModelDirectory(): saved "+file_path);
......@@ -7122,7 +7125,8 @@ public class QuadCLTCPU {
float [] alpha = null; // (0..1.0)
if (iclt_data.length > 3) alpha = iclt_data[3];
if (isLwir()) {
if (!colorProcParameters.lwir_pseudocolor) {
//// if (!colorProcParameters.lwir_pseudocolor) {
if (!toRGB) {
ImageProcessor ip= new FloatProcessor(width,height);
ip.setPixels(iclt_data[0]);
ip.resetMinAndMax();
......
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