Commit d87183b6 authored by Andrey Filippov's avatar Andrey Filippov

tested model generation (w/o field calibration with gpu tile processor)

parent e608c208
......@@ -6264,8 +6264,6 @@ private Panel panel1,
public boolean batchLwir() {
long startTime=System.nanoTime();
// load needed sensor and kernels files
if (!prepareRigImages()) return false;
String configPath=getSaveCongigPath();
......
......@@ -918,9 +918,15 @@ public class GPUTileProcessor {
* Copy array of CPU-prepared tasks to the GPU memory
* @param tile_tasks array of TpTask prepared by the CPU (before geometry correction is applied)
* @param use_aux Use second (aux) camera
* @param verify correct data
*/
public void setTasks(TpTask [] tile_tasks, boolean use_aux) // while is it in class member? - just to be able to free
public void setTasks(
TpTask [] tile_tasks,
boolean use_aux, // while is it in class member? - just to be able to free
boolean verify
)
{
if (verify) checkTasks(tile_tasks);
num_task_tiles = tile_tasks.length;
float [] ftasks = new float [TPTASK_SIZE * num_task_tiles];
for (int i = 0; i < num_task_tiles; i++) {
......@@ -929,6 +935,40 @@ public class GPUTileProcessor {
cuMemcpyHtoD(gpu_tasks, Pointer.to(ftasks), TPTASK_SIZE * num_task_tiles * Sizeof.FLOAT);
}
void checkTasks (TpTask [] tile_tasks) {
float min_disp = tile_tasks[0].target_disparity;
float max_disp = min_disp;
int min_ty = tile_tasks[0].ty;
int min_tx = tile_tasks[0].tx;
int max_ty = min_ty;
int max_tx = min_tx;
int max_task = 0;
for (int i = 0; i < tile_tasks.length; i++) {
if (Float.isNaN(tile_tasks[i].target_disparity)) {
System.out.println(String.format("Disparity=NaN for tY=%d, tX=%d, task = 0x%x", tile_tasks[i].ty, tile_tasks[i].tx, tile_tasks[i].task));
System.out.println("Setting disparity and tas to 0");
tile_tasks[i].target_disparity = 0f;
tile_tasks[i].task = 0;
}
if (tile_tasks[i].task != 0) {
if (tile_tasks[i].target_disparity < min_disp ) min_disp = tile_tasks[i].target_disparity;
if (tile_tasks[i].target_disparity > max_disp ) max_disp = tile_tasks[i].target_disparity;
if (tile_tasks[i].task > max_task ) max_task = tile_tasks[i].task;
if (tile_tasks[i].ty < min_ty ) min_ty = tile_tasks[i].ty;
if (tile_tasks[i].ty > max_ty ) max_ty = tile_tasks[i].ty;
if (tile_tasks[i].tx < min_tx ) min_tx = tile_tasks[i].tx;
if (tile_tasks[i].tx > max_tx ) max_tx = tile_tasks[i].tx;
}
}
System.out.println(String.format("---Disparity=[%f..%f] task=[0..0x%x] ty=[%d..%d] tx=[%d..%d] ---",
min_disp,max_disp, max_task, min_ty, max_ty, min_tx, max_tx));
}
public TpTask [] getTasks (boolean use_aux)
{
float [] ftasks = new float [TPTASK_SIZE * num_task_tiles];
......@@ -1926,6 +1966,7 @@ public class GPUTileProcessor {
boolean calc_textures,
boolean calc_extra)
{
execCalcReverseDistortions(); // will check if it is needed first
if (GPU_TEXTURES_kernel == null)
{
IJ.showMessage("Error", "No GPU kernel: GPU_TEXTURES_kernel");
......@@ -2204,8 +2245,9 @@ public class GPUTileProcessor {
return textures;
}
public double [][][][] doubleTextures(
Rectangle woi,
public double [][][][] doubleTextures( // may be accelerated with multithreading if needed.
Rectangle woi, // null or width and height match texture_tiles
double [][][][] texture_tiles, // null or [tilesY][tilesX]
int [] indices,
float [] ftextures,
int full_width,
......@@ -2214,22 +2256,34 @@ public class GPUTileProcessor {
){
int texture_slice_size = (2 * DTT_SIZE)* (2 * DTT_SIZE);
int texture_tile_size = texture_slice_size * num_src_slices ;
double [][][][] textures = new double [woi.height][woi.width][num_slices][texture_slice_size];
if ((woi == null) && (texture_tiles==null)) {
System.out.println("doubleTextures(): woi and texture_tiles can not be simultaneously null");
return null;
}
if (texture_tiles == null) {
texture_tiles = new double [woi.height][woi.width][][];
} else {
woi.height = texture_tiles.length;
woi.width = texture_tiles[0].length;
}
// double [][][][] textures = new double [woi.height][woi.width][num_slices][texture_slice_size];
for (int indx = 0; indx < indices.length; indx++) if ((indices[indx] & (1 << LIST_TEXTURE_BIT)) != 0){
int tile = indices[indx] >> CORR_NTILE_SHIFT;
int tileX = tile % full_width;
int tileY = tile / full_width;
int wtileX = tileX - woi.x;
int wtileY = tileY - woi.y;
if ((wtileX < woi.width) && (wtileY < woi.height)) {
texture_tiles[tileY][tileX] = new double [num_slices][texture_slice_size];
if ((wtileX >=0 ) && (wtileX < woi.width) && (wtileY >= 0) && (wtileY < woi.height)) {
for (int slice = 0; slice < num_slices; slice++) {
for (int i = 0; i < texture_slice_size; i++) {
textures[wtileY][wtileX][slice][i] = ftextures[indx * texture_tile_size + slice * texture_slice_size + i];
texture_tiles[wtileY][wtileX][slice][i] = ftextures[indx * texture_tile_size + slice * texture_slice_size + i];
}
}
}
}
return textures;
return texture_tiles;
}
public float [][] getRBG (int ncam){
......
......@@ -60,16 +60,17 @@ public class CLTPass3d{
public boolean [] border_tiles = null; // these are border tiles, zero out alpha
public boolean [] selected = null; // which tiles are selected for this layer
public double [][][][] texture_tiles;
public float [][] texture_img = null; // [3][] (RGB) or [4][] RGBA
public Rectangle texture_woi = null; // null or generated texture location/size
// texture_selection is only used for the GPU and if not null means it is for the GPU
public boolean [] texture_selection = null; // use by the GPU to set texture to generate
public double [][] max_tried_disparity = null; //[ty][tx] used for combined passes, shows maximal disparity for this tile, regardless of results
public boolean is_combo = false;
public boolean is_measured = false;
public String texture = null; // relative (to x3d) path
public Rectangle texture_bounds;
public Rectangle texture_bounds; // in tiles, not pixels !
public int dbg_index;
public int disparity_index = ImageDtt.DISPARITY_INDEX_CM; // may also be ImageDtt.DISPARITY_INDEX_POLY
public double [][] tiles_RBGA = null;
SuperTiles superTiles = null;
TileProcessor tileProcessor;
......@@ -99,7 +100,31 @@ public class CLTPass3d{
{
return texture_tiles;
}
// texture_selection is only used for the GPU and if not null means it is for the GPU
public boolean [] getTextureSelection()
{
return texture_selection;
}
public void setTextureSelection(boolean [] selection) {
texture_selection = selection;
}
public void setTextureSelection(int indx, boolean sel) {
texture_selection[indx] = sel;
}
public double [][] getTilesRBGA()
{
return tiles_RBGA;
}
public void setTilesRBGA(double [][] rgba)
{
tiles_RBGA = rgba;
}
/*
public float [][] getTextureImages()
{
return texture_img;
......@@ -109,17 +134,35 @@ public class CLTPass3d{
{
return texture_woi;
}
*/
public double [][] getMaxTriedDisparity()
{
return max_tried_disparity;
}
public double [][] getTileRBGA(
int num_layers) // 4 or 12
{
if (texture_img != null) {
System.out.println("FIXME: implement replacement for the GPU-generated textures (using macro mode?)");
// if (texture_img != null) {
// System.out.println("FIXME: implement replacement for the GPU-generated textures (using macro mode?)");
// }
double [][] tones = getTilesRBGA();
if (tones != null) {
int nl = tones.length;
if (nl > num_layers) {
double [][] tones1 = new double [num_layers][tones[0].length];
for (int n = 0; n < num_layers; n++) {
tones1[n] = tones[n];
}
return tones1;
} else {
return tones;
}
}
System.out.println("FIXME: should not get here, tones should be calculated earlier");
if (texture_tiles == null) return null;
int tilesY = texture_tiles.length;
int tilesX = 0;
......@@ -175,11 +218,12 @@ public class CLTPass3d{
// Will not work if texture is disabled
public void updateSelection(){ // add updating border tiles?
public void updateSelection(){ // add updating border tiles? -- only for CPU!
int tilesX = tileProcessor.getTilesX();
int tilesY = tileProcessor.getTilesY();
selected = new boolean[tilesY*tilesX];
int minX = tilesX, minY = tilesY, maxX = -1, maxY = -1;
/*
if (texture_img != null) { // using GPU output
//tileProcessor.getTileSize()
if (texture_woi != null) {
......@@ -195,6 +239,7 @@ public class CLTPass3d{
return;
}
}
*/
if (texture_tiles != null) {
for (int ty = 0; ty < tilesY; ty++) for (int tx = 0; tx < tilesX; tx++){
if (texture_tiles[ty][tx] != null) {
......@@ -214,7 +259,6 @@ public class CLTPass3d{
texture_bounds = new Rectangle(minX, minY, maxX - minX +1, maxY - minY +1 );
}
}
public Rectangle getTextureBounds(){
return texture_bounds;
}
......@@ -250,7 +294,7 @@ public class CLTPass3d{
// border_tiles = null; // these are border tiles, zero out alpha
// selected = null; // which tiles are selected for this layer
superTiles = null;
setTilesRBGA(null);
}
/**
......
......@@ -1511,64 +1511,36 @@ public class ImageDttCPU {
// removing macro and FPGA modes
public double [][] cltMeasureLazyEye ( // returns d,s lazy eye parameters
final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
// final int macro_scale, // to correlate tile data instead of the pixel data: 1 - pixels, 8 - tiles
final int [][] tile_op, // [tilesY][tilesX] - what to do - 0 - nothing for this tile
final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity
final double [][][] image_data, // first index - number of image in a quad
final boolean [][] saturation_imp, // (near) saturated pixels or null
// correlation results - final and partial
// final double [][][][] clt_corr_combo, // [type][tilesY][tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
// [type][tilesY][tilesX] should be set by caller
// types: 0 - selected correlation (product+offset), 1 - sum
// final double [][][][][] clt_corr_partial,// [tilesY][tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
// [tilesY][tilesX] should be set by caller
// When clt_mismatch is non-zero, no far objects extraction will be attempted
final double [][] clt_mismatch, // [12][tilesY * tilesX] // ***** transpose unapplied ***** ?. null - do not calculate
// values in the "main" directions have disparity (*_CM) subtracted, in the perpendicular - as is
final double [][] disparity_map, // [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
// last 2 - contrast, avg/ "geometric average)
// final double [][][][] texture_tiles, // [tilesY][tilesX]["RGBA".length()][]; null - will skip images combining
final int width,
final double corr_fat_zero, // add to denominator to modify phase correlation (same units as data1, data2). <0 - pure sum
// final boolean corr_sym,
// final double corr_offset,
final double corr_red,
final double corr_blue,
final double corr_sigma,
// final boolean corr_normalize, // normalize correlation results by rms
final double min_corr, // 0.02; // minimal correlation value to consider valid
// final double max_corr_sigma, // 1.2; // weights of points around global max to find fractional
// final double max_corr_radius, // 3.9;
// final boolean max_corr_double, //"Double pass when masking center of mass to reduce preference for integer values
// final int corr_mode, // Correlation mode: 0 - integer max, 1 - center of mass, 2 - polynomial
// final double min_shot, // 10.0; // Do not adjust for shot noise if lower than
// final double scale_shot, // 3.0; // scale when dividing by sqrt ( <0 - disable correction)
// final double diff_sigma, // 5.0;//RMS difference from average to reduce weights (~ 1.0 - 1/255 full scale image)
// final double diff_threshold, // 5.0; // RMS difference from average to discard channel (~ 1.0 - 1/255 full scale image)
// final boolean diff_gauss, // true; // when averaging images, use Gaussian around average as weight (false - sharp all/nothing)
// final double min_agree, // 3.0; // minimal number of channels to agree on a point (real number to work with fuzzy averages)
// final boolean dust_remove, // Do not reduce average weight when only one image differs much from the average
// final boolean keep_weights, // Add port weights to RGBA stack (debug feature)
final GeometryCorrection geometryCorrection,
final GeometryCorrection geometryCorrection_main, // if not null correct this camera (aux) to the coordinates of the main
final double [][][][][][] clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
final int kernel_step,
// final int transform_size,
final int window_type,
final double [][] shiftXY, // [port]{shiftX,shiftY}
final double disparity_corr, // disparity at infinity
// final double [][][] fine_corr, // quadratic coefficients for fine correction (or null)
// final double corr_magic_scale, // still not understood coefficient that reduces reported disparity value. Seems to be around 0.85
final double shiftX, // shift image horizontally (positive - right) - just for testing
final double shiftY, // shift image vertically (positive - down)
final int tileStep, // process tileStep x tileStep cluster of tiles when adjusting lazy eye parameters
final int debug_tileX,
final int debug_tileY,
// final boolean no_fract_shift,
// final boolean no_deconvolution,
final int threadsMax, // maximal number of threads to launch
final int globalDebugLevel)
{
......@@ -2390,7 +2362,7 @@ public class ImageDttCPU {
final double [][][] image_data, // first index - number of image in a quad
final boolean [][] saturation_imp, // (near) saturated pixels or null
// correlation results - final and partial
final double [][][][] clt_corr_combo, // [type][tilesY][tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
final double [][][][] clt_corr_combo_in, // [type][tilesY][tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
// [type][tilesY][tilesX] should be set by caller
// types: 0 - selected correlation (product+offset), 1 - sum
final double [][][][][] clt_corr_partial,// [tilesY][tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
......@@ -2442,6 +2414,14 @@ public class ImageDttCPU {
final int threadsMax, // maximal number of threads to launch
final int globalDebugLevel)
{
// ****** FIXME tries to use color == 3, should be disabled!
if (clt_corr_combo_in != null) {
System.out.println("clt_corr_combo != null");
System.out.println("clt_corr_combo != null");
System.out.println("clt_corr_combo != null");
}
final double [][][][] clt_corr_combo = (globalDebugLevel >-10000)?null:clt_corr_combo_in;
final boolean debug_distort= globalDebugLevel > 0; ///false; // true;
final double [][] debug_offsets = new double[imgdtt_params.lma_dbg_offset.length][2];
......@@ -3072,8 +3052,8 @@ public class ImageDttCPU {
// if ((clt_corr_partial != null) && (imgdtt_params.corr_mode_debug || imgdtt_params.gpu_mode_debug)) {
if (debugTile0) {
System.out.println("Debugging tileY = "+tileY+" tileX = " + tileX);
System.out.println("Debugging tileY = "+tileY+" tileX = " + tileX);
System.out.println("Debugging tileY = "+tileY+" tileX = " + tileX);
// System.out.println("Debugging tileY = "+tileY+" tileX = " + tileX);
// System.out.println("Debugging tileY = "+tileY+" tileX = " + tileX);
}
double [][][] corr_pairs_td = corr2d.correlateCompositeTD(
......@@ -3577,6 +3557,7 @@ public class ImageDttCPU {
} // if (disparity_map != null){ // not null - calculate correlations
// only debug is left
// old (per-color correlation)
// ****** FIXME tries to use color == 3, should be disabled!
if ((clt_corr_combo != null) && !imgdtt_params.corr_mode_debug){ // not null - calculate correlations // not used in lwir
tcorr_tpartial= new double[corr_pairs.length][numcol+1][4][transform_len];
tcorr_partial = new double[quad][numcol+1][];
......@@ -3623,7 +3604,7 @@ public class ImageDttCPU {
for (int i = 0; i < transform_len; i++) {
for (int n = 0; n<4; n++) {
tcorr_tpartial[pair][numcol][n][i] = 0.0;
for (int ncol= 0; ncol < tcorr_tpartial[pair].length; ncol++) {
for (int ncol= 0; ncol < tcorr_tpartial[pair].length; ncol++) { // tcorr_tpartial[pair].length = 4 > colors
if (tcorr_tpartial[pair][ncol] != null) {
tcorr_tpartial[pair][numcol][n][i] += col_weights[ncol] * tcorr_tpartial[pair][0][n][i];
}
......@@ -5197,7 +5178,6 @@ public class ImageDttCPU {
// in monochrome mode only MONO_CHN == GREEN_CHN is used, R and B are null
public double [][] combineRBGATiles( // USED in lwir
final double [][][][] texture_tiles, // array [tilesY][tilesX][4][4*transform_size] or [tilesY][tilesX]{null}
// final int transform_size,
final boolean overlap, // when false - output each tile as 16x16, true - overlap to make 8x8
final boolean sharp_alpha, // combining mode for alpha channel: false - treat as RGB, true - apply center 8x8 only
final int threadsMax, // maximal number of threads to launch
......@@ -5227,7 +5207,6 @@ public class ImageDttCPU {
}
}
// final double [][] dpixels = new double["RGBA".length()+(has_weights? 4: 0)][width*height]; // assuming java initializes them to 0
final double [][] dpixels = new double["RGBA".length()+(has_weights? 8: 0)][width*height]; // assuming java initializes them to 0
final Thread[] threads = newThreadArray(threadsMax);
final AtomicInteger ai = new AtomicInteger(0);
......
......@@ -29,6 +29,7 @@ import com.elphel.imagej.common.GenericJTabbedDialog;
public class ImageDttParameters {
public boolean gpu_mode_debug = true;
public boolean gpu_verify = false; // verify tasks/ input data
public boolean corr_mode_debug = true;
public boolean mix_corr_poly = true;
public boolean corr_poly_only = false; // if LMA fails, discard tile
......@@ -212,6 +213,8 @@ public class ImageDttParameters {
gd.addCheckbox ("Debug CPU->GPU matching", this.gpu_mode_debug,
"output clt_corr_partial");
gd.addCheckbox ("Verify GPU input", this.gpu_verify,
"Check tp_tasks and fix NaN");
gd.addCheckbox ("Enable ImageDtt correlation debug layers", this.corr_mode_debug,
"false - return (old) per-coord correlations, true - replace them with more pairs correlation (new)");
gd.addCheckbox ("Replace CM layer with mixed/new poly one", this.mix_corr_poly);
......@@ -507,6 +510,7 @@ public class ImageDttParameters {
}
public void dialogAnswers(GenericJTabbedDialog gd) {
this.gpu_mode_debug = gd.getNextBoolean();
this.gpu_verify = gd.getNextBoolean();
this.corr_mode_debug= gd.getNextBoolean();
this.mix_corr_poly= gd.getNextBoolean();
this.corr_poly_only= gd.getNextBoolean();
......@@ -658,6 +662,7 @@ public class ImageDttParameters {
public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"gpu_mode_debug", this.gpu_mode_debug+"");
properties.setProperty(prefix+"gpu_verify", this.gpu_verify+"");
properties.setProperty(prefix+"corr_mode_debug", this.corr_mode_debug+"");
properties.setProperty(prefix+"mix_corr_poly", this.mix_corr_poly+"");
properties.setProperty(prefix+"corr_poly_only", this.corr_poly_only+"");
......@@ -809,6 +814,7 @@ public class ImageDttParameters {
public void getProperties(String prefix,Properties properties){
if (properties.getProperty(prefix+"gpu_mode_debug")!=null) this.gpu_mode_debug=Boolean.parseBoolean(properties.getProperty(prefix+"gpu_mode_debug"));
if (properties.getProperty(prefix+"gpu_verify")!=null) this.gpu_verify=Boolean.parseBoolean(properties.getProperty(prefix+"gpu_verify"));
if (properties.getProperty(prefix+"corr_mode_debug")!=null) this.corr_mode_debug=Boolean.parseBoolean(properties.getProperty(prefix+"corr_mode_debug"));
if (properties.getProperty(prefix+"mix_corr_poly")!=null) this.mix_corr_poly=Boolean.parseBoolean(properties.getProperty(prefix+"mix_corr_poly"));
if (properties.getProperty(prefix+"corr_poly_only")!=null) this.corr_poly_only=Boolean.parseBoolean(properties.getProperty(prefix+"corr_poly_only"));
......@@ -960,6 +966,7 @@ public class ImageDttParameters {
public ImageDttParameters clone() throws CloneNotSupportedException {
ImageDttParameters idp = new ImageDttParameters();
idp.gpu_mode_debug = this.gpu_mode_debug;
idp.gpu_verify = this.gpu_verify;
idp.corr_mode_debug = this.corr_mode_debug;
idp.mix_corr_poly = this.mix_corr_poly;
idp.corr_poly_only = this.corr_poly_only;
......
......@@ -283,9 +283,10 @@ public class MacroCorrelation {
double [][] shiftXY = {{0.0,0.0},{0.0,0.0},{0.0,0.0},{0.0,0.0}};
double [][][][] clt_corr_combo = new double [ImageDtt.TCORR_TITLES.length][mTilesY][mTilesX][]; // needed always
double [][][][] clt_corr_combo = null; // new double [ImageDtt.TCORR_TITLES.length][mTilesY][mTilesX][]; // needed always
double [][][][][] clt_corr_partial = null; // [tp.tilesY][tp.tilesX][pair][color][(2*transform_size-1)*(2*transform_size-1)]
/*
if (show_corr_partial) {
clt_corr_partial = new double [mTilesY][mTilesX][][][];
for (int i = 0; i < mTilesY; i++){
......@@ -296,6 +297,7 @@ public class MacroCorrelation {
}
if (show_corr_combo) {
clt_corr_combo = new double [ImageDtt.TCORR_TITLES.length][mTilesY][mTilesX][]; // needed always
for (int i = 0; i < mTilesY; i++){
for (int j = 0; j < mTilesX; j++){
for (int k = 0; k<clt_corr_combo.length; k++){
......@@ -304,9 +306,8 @@ public class MacroCorrelation {
}
}
}
*/
// double [][][][] texture_tiles = save_textures ? new double [tilesY][tilesX][][] : null; // ["RGBA".length()][];
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
this.mtp.isMonochrome(),
......
......@@ -4215,7 +4215,7 @@ public class TilePlanes {
if (world_xyz != null) {
double l2 = world_xyz[0]*world_xyz[0] + world_xyz[1]*world_xyz[1]+world_xyz[2]*world_xyz[2];
if (l2 < 0.5) {
if (debugLevel > -1) {
if (debugLevel > 0) { // -1
System.out.println("getWorldXYZ(): l2="+l2); // +" this=\n"+this.toString());
}
world_xyz = null;
......@@ -4317,7 +4317,7 @@ public class TilePlanes {
world_xyz = norm_xyz.times((xyz.transpose().times(norm_xyz).get(0,0))).getColumnPackedCopy();
double l2 = world_xyz[0]*world_xyz[0] + world_xyz[1]*world_xyz[1]+world_xyz[2]*world_xyz[2];
if (l2 < 0.5) {
if (debugLevel > -1) {
if (debugLevel > 0) { // -1
System.out.println("getWorldXYZ(): l2="+l2); // +" this=\n"+this.toString());
}
}
......
......@@ -269,6 +269,7 @@ public class TileProcessor {
* @param debugLevel debug level
* @return combined pass, contains same data as after the measurement of the actual one
*/
/*
public CLTPass3d combinePasses_old(
final ArrayList <CLTPass3d> passes,
final int firstPass,
......@@ -415,6 +416,7 @@ public class TileProcessor {
}
return combo_pass;
}
*/
/**
* When expanding over previously identified background (may be in error) remove tiles from the
......@@ -1293,7 +1295,11 @@ public class TileProcessor {
combo_pass.calc_disparity[nt] = pass.disparity_map[disparity_index][nt]/corr_magic_scale + pass.disparity[ty][tx];
combo_pass.strength[nt] = pass.disparity_map[ImageDtt.DISPARITY_STRENGTH_INDEX][nt];
// Only copy for full disparity
for (int i = 0; i< ImageDtt.QUAD; i++) combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt];
for (int i = 0; i< ImageDtt.QUAD; i++) {
if (pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i]!= null) {// do not copy empty
combo_pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt] = pass.disparity_map[ImageDtt.IMG_DIFF0_INDEX + i][nt];
}
}
if (copyDebug){
combo_pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt] = pass.disparity_map[ImageDtt.DISPARITY_INDEX_CM][nt];
......@@ -3419,9 +3425,7 @@ public class TileProcessor {
if (debugLevel > -1)
sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
// boolean [] new_tiles = new boolean [tilesY * tilesX]; // grow selection by 1 tile over non-background?
CLTPass3d bgnd_data = clt_3d_passes.get(0);
// double [][][][] texture_tiles = bgnd_data.texture_tiles;
double [][] disparity_map= bgnd_data.disparity_map;
for (int tileY = 0; tileY < tilesY; tileY++){
for (int tileX = 0; tileX < tilesX; tileX++){
......@@ -5809,7 +5813,7 @@ public class TileProcessor {
}
// show testure_tiles
double [][][][] texture_tiles = scan_prev.getTextureTiles();
double [][][][] texture_tiles = scan_prev.getTextureTiles(); // each is null, manually set texture_tiles - null
ImageDtt image_dtt = new ImageDtt(
clt_parameters.transform_size,
isMonochrome(),
......@@ -5831,9 +5835,9 @@ public class TileProcessor {
String [] rgba_weights_titles = {"red","blue","green","alpha","port0","port1","port2","port3","r-rms","b-rms","g-rms","w-rms"};
String name = scan_prev.getTextureName();
boolean show_nonoverlap = false; // true; // clt_parameters.show_nonoverlap
boolean show_overlap = false; //true; // clt_parameters.show_overlap
boolean show_rgba_color = false; //true; // clt_parameters.show_rgba_color
boolean show_nonoverlap = true; //false; // true; // clt_parameters.show_nonoverlap
boolean show_overlap = true; //false; //true; // clt_parameters.show_overlap
boolean show_rgba_color = true; //false; //true; // clt_parameters.show_rgba_color
if (!batch_mode && show_nonoverlap){
texture_nonoverlap = image_dtt.combineRBGATiles(
......@@ -5883,7 +5887,7 @@ public class TileProcessor {
(clt_parameters.keep_weights?rgba_weights_titles:rgba_titles));
}
}
if (!batch_mode && (debugLevel > -1)) {
if (!batch_mode && (debugLevel > -3)) {
double [][] tiles_tone = scan_prev.getTileRBGA(
12); // int num_layers);
sdfa_instance.showArrays(
......@@ -7581,7 +7585,7 @@ public class TileProcessor {
int num_surf = tileSurface.getSurfaceDataLength();
if (num_surf_proc > num_surf) num_surf_proc = num_surf;
int op = ImageDtt.setImgMask(0, 0xf);
op = ImageDtt.setPairMask(op,0xf);
/// op = ImageDtt.setPairMask(op,0xf); // 2020 no need for correlations, just textures?
op = ImageDtt.setForcedDisparity(op,true);
int numClusters = 0; // needed?
for (int ns = 0 ; ns < num_surf_proc; ns ++){
......
......@@ -3054,7 +3054,7 @@ if (debugLevel > -100) return true; // temporarily !
return occl_sel;
}
public double [][][][][] getRigTextures(
public double [][][][][] getRigTextures( // never used
boolean need_master,
boolean need_aux,
double [] disparity, // non-nan - measure
......@@ -8101,6 +8101,13 @@ if (debugLevel > -100) return true; // temporarily !
if (quadCLT_main.correctionsParameters.clt_batch_assign) {
if (updateStatus) IJ.showStatus("Assigning tiles to candidate surfaces "+quadCLT_main.image_name);
// prepare average RGBA for the last scan
quadCLT_main.setPassAvgRBGA( // get image from a single pass, return relative path for x3d // USED in lwir
clt_parameters, // CLTParameters clt_parameters,
quadCLT_main.tp.clt_3d_passes.size() - 1, // int scanIndex,
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus, // boolean updateStatus,
debugLevelInner); // int debugLevel)
double [][] assignments_dbg = quadCLT_main.tp.assignTilesToSurfaces(
clt_parameters,
quadCLT_main.geometryCorrection,
......@@ -8392,6 +8399,13 @@ if (debugLevel > -100) return true; // temporarily !
if (quadCLT_main.correctionsParameters.clt_batch_assign) {
if (updateStatus) IJ.showStatus("Assigning tiles to candidate surfaces "+quadCLT_main.image_name);
// prepare average RGBA for the last scan
quadCLT_main.setPassAvgRBGA( // get image from a single pass, return relative path for x3d // USED in lwir
clt_parameters, // CLTParameters clt_parameters,
quadCLT_main.tp.clt_3d_passes.size() - 1, // int scanIndex,
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus, // boolean updateStatus,
debugLevelInner); // int debugLevel)
double [][] assignments_dbg = quadCLT_main.tp.assignTilesToSurfaces(
clt_parameters,
quadCLT_main.geometryCorrection,
......
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