Commit a149cadd authored by Andrey Filippov's avatar Andrey Filippov

converting to GPU

parent ac185fe7
...@@ -705,8 +705,8 @@ private Panel panel1, ...@@ -705,8 +705,8 @@ private Panel panel1,
panelClt_GPU.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap panelClt_GPU.setLayout(new GridLayout(1, 0, 5, 5)); // rows, columns, vgap, hgap
addButton("JCUDA TEST", panelClt_GPU); addButton("JCUDA TEST", panelClt_GPU);
addButton("TF TEST", panelClt_GPU); addButton("TF TEST", panelClt_GPU);
addButton("GPU simulate", panelClt_GPU, color_conf_process); addButton("GPU simulate", panelClt_GPU, color_conf_process);
addButton("GPU RUN", panelClt_GPU, color_conf_process); addButton("GPU RUN", panelClt_GPU, color_conf_process);
// addButton("ShowGPU", panelClt_GPU, color_conf_process); // addButton("ShowGPU", panelClt_GPU, color_conf_process);
addButton("LWIR_TEST", panelClt_GPU, color_conf_process); addButton("LWIR_TEST", panelClt_GPU, color_conf_process);
......
...@@ -63,7 +63,10 @@ import java.io.IOException; ...@@ -63,7 +63,10 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import com.elphel.imagej.tileprocessor.DttRad2; import com.elphel.imagej.tileprocessor.DttRad2;
...@@ -739,6 +742,13 @@ public class GPUTileProcessor { ...@@ -739,6 +742,13 @@ public class GPUTileProcessor {
Sizeof.FLOAT); // int ElementSizeBytes) Sizeof.FLOAT); // int ElementSizeBytes)
texture_stride_rgba = (int)(device_stride[0] / Sizeof.FLOAT); texture_stride_rgba = (int)(device_stride[0] / Sizeof.FLOAT);
} }
public int getTilesX() {
return img_width / DTT_SIZE;
}
public int getTilesY() {
return img_height / DTT_SIZE;
}
public void resetGeometryCorrection() { public void resetGeometryCorrection() {
geometry_correction_set = false; geometry_correction_set = false;
...@@ -760,7 +770,6 @@ public class GPUTileProcessor { ...@@ -760,7 +770,6 @@ public class GPUTileProcessor {
} }
public void setGeometryCorrectionVector() { // will reset geometry_correction_vector_set when running GPU kernel public void setGeometryCorrectionVector() { // will reset geometry_correction_vector_set when running GPU kernel
// if (geometry_correction_vector_set) return;
setExtrinsicsVector( setExtrinsicsVector(
quadCLT.getGeometryCorrection().getCorrVector()); quadCLT.getGeometryCorrection().getCorrVector());
} }
...@@ -1210,6 +1219,63 @@ public class GPUTileProcessor { ...@@ -1210,6 +1219,63 @@ public class GPUTileProcessor {
} }
return tp_tasks; return tp_tasks;
} }
public GPUTileProcessor.TpTask[] setTpTask(
// final GPUTileProcessor.GpuQuad gpuQuad,
final double [][] disparity_array, // [tilesY][tilesX] - individual per-tile expected disparity
final double disparity_corr,
final boolean [] need_corrs, // should be initialized to boolean[1] or null
final int [][] tile_op, // [tilesY][tilesX] - what to do - 0 - nothing for this tile
final int corr_mask, // <0 - use corr mask from the tile tile_op, >=0 - overwrite all with non-zero corr_mask_tp
final int threadsMax) // maximal number of threads to launch
{
final int tilesX = getTilesX();
final int tilesY = getTilesY();
final AtomicInteger ai = new AtomicInteger(0);
final AtomicBoolean acorrs = new AtomicBoolean(false);
final List<GPUTileProcessor.TpTask> task_list = new CopyOnWriteArrayList<GPUTileProcessor.TpTask>();
final Thread[] threads = ImageDtt.newThreadArray(threadsMax);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
@Override
public void run() {
for (int nTile = ai.getAndIncrement(); nTile < tilesX * tilesY; nTile = ai.getAndIncrement()) {
int tileY = nTile /tilesX;
int tileX = nTile % tilesX;
// tIndex = tileY * tilesX + tileX;
if (tile_op[tileY][tileX] == 0) continue; // nothing to do for this tile
// which images to use
int img_mask = ImageDtt.getImgMask(tile_op[tileY][tileX]);
// which pairs to combine in the combo: 1 - top, 2 bottom, 4 - left, 8 - right
int corr_mask_tp = ImageDtt.getPairMask(tile_op[tileY][tileX]); // limited to 4 bits only!
if (corr_mask_tp != 0) {
if (corr_mask >=0) {
corr_mask_tp = corr_mask;
}
if (corr_mask_tp != 0) {
acorrs.set(true);
}
}
task_list.add(new GPUTileProcessor.TpTask(
tileX,
tileY,
(float) (disparity_array[tileY][tileX] + disparity_corr),
((img_mask & 0x0f) << 0) |
((corr_mask_tp & 0x3f) << 4)
)); // task == 1 for now
// mask out pairs that use missing channels
}
}
};
}
ImageDtt.startAndJoin(threads);
if (need_corrs != null) {
need_corrs[0] = acorrs.get();
}
return task_list.toArray(new GPUTileProcessor.TpTask[task_list.size()]);
}
/** /**
...@@ -1653,6 +1719,21 @@ public class GPUTileProcessor { ...@@ -1653,6 +1719,21 @@ public class GPUTileProcessor {
cuCtxSynchronize(); cuCtxSynchronize();
} }
public int [] getCorrIndices() {
float [] fnum_corrs = new float[1];
cuMemcpyDtoH(Pointer.to(fnum_corrs), gpu_num_corr_tiles, 1 * Sizeof.FLOAT);
int num_corrs = Float.floatToIntBits(fnum_corrs[0]);
float [] fcorr_indices = new float [num_corrs];
cuMemcpyDtoH(Pointer.to(fcorr_indices), gpu_corr_indices, num_corrs * Sizeof.FLOAT);
int [] corr_indices = new int [num_corrs];
for (int i = 0; i < num_corrs; i++) {
corr_indices[i] = Float.floatToIntBits(fcorr_indices[i]);
}
num_corr_tiles = num_corrs;
return corr_indices;
}
public float [][] getCorr2D(int corr_rad){ public float [][] getCorr2D(int corr_rad){
int corr_size = (2 * corr_rad + 1) * (2 * corr_rad + 1); int corr_size = (2 * corr_rad + 1) * (2 * corr_rad + 1);
float [] cpu_corrs = new float [ num_corr_tiles * corr_size]; float [] cpu_corrs = new float [ num_corr_tiles * corr_size];
...@@ -1677,20 +1758,6 @@ public class GPUTileProcessor { ...@@ -1677,20 +1758,6 @@ public class GPUTileProcessor {
return corrs; return corrs;
} }
public int [] getCorrIndices() {
float [] fnum_corrs = new float[1];
cuMemcpyDtoH(Pointer.to(fnum_corrs), gpu_num_corr_tiles, 1 * Sizeof.FLOAT);
int num_corrs = Float.floatToIntBits(fnum_corrs[0]);
float [] fcorr_indices = new float [num_corrs];
cuMemcpyDtoH(Pointer.to(fcorr_indices), gpu_corr_indices, num_corrs * Sizeof.FLOAT);
int [] corr_indices = new int [num_corrs];
for (int i = 0; i < num_corrs; i++) {
corr_indices[i] = Float.floatToIntBits(fcorr_indices[i]);
}
num_corr_tiles = num_corrs;
return corr_indices;
}
// //
/** /**
......
...@@ -60,6 +60,9 @@ public class CLTPass3d{ ...@@ -60,6 +60,9 @@ public class CLTPass3d{
public boolean [] border_tiles = null; // these are border tiles, zero out alpha public boolean [] border_tiles = null; // these are border tiles, zero out alpha
public boolean [] selected = null; // which tiles are selected for this layer public boolean [] selected = null; // which tiles are selected for this layer
public double [][][][] texture_tiles; 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
public double [][] max_tried_disparity = null; //[ty][tx] used for combined passes, shows maximal disparity for this tile, regardless of results 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_combo = false;
public boolean is_measured = false; public boolean is_measured = false;
...@@ -96,13 +99,27 @@ public class CLTPass3d{ ...@@ -96,13 +99,27 @@ public class CLTPass3d{
{ {
return texture_tiles; return texture_tiles;
} }
public float [][] getTextureImages()
{
return texture_img;
}
public Rectangle getTextureWoi()
{
return texture_woi;
}
public double [][] getMaxTriedDisparity() public double [][] getMaxTriedDisparity()
{ {
return max_tried_disparity; return max_tried_disparity;
} }
public double [][] getTileRBGA( public double [][] getTileRBGA(
int num_layers) 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_tiles == null) return null; if (texture_tiles == null) return null;
int tilesY = texture_tiles.length; int tilesY = texture_tiles.length;
int tilesX = 0; int tilesX = 0;
...@@ -163,15 +180,32 @@ public class CLTPass3d{ ...@@ -163,15 +180,32 @@ public class CLTPass3d{
int tilesY = tileProcessor.getTilesY(); int tilesY = tileProcessor.getTilesY();
selected = new boolean[tilesY*tilesX]; selected = new boolean[tilesY*tilesX];
int minX = tilesX, minY = tilesY, maxX = -1, maxY = -1; int minX = tilesX, minY = tilesY, maxX = -1, maxY = -1;
for (int ty = 0; ty < tilesY; ty++) for (int tx = 0; tx < tilesX; tx++){ if (texture_img != null) { // using GPU output
if (texture_tiles[ty][tx] != null) { //tileProcessor.getTileSize()
selected[ty * tilesX + tx] = true; if (texture_woi != null) {
if (maxX < tx) maxX = tx; int tile_size = tileProcessor.getTileSize();
if (minX > tx) minX = tx; texture_bounds = new Rectangle(
if (maxY < ty) maxY = ty; texture_woi.x/tile_size, texture_woi.y/tile_size, texture_woi.width/tile_size, texture_woi.height/tile_size);
if (minY > ty) minY = ty; // setting full rectangle as selected, not just textures? Use some other method?
} else { for (int ty = texture_bounds.y; ty < (texture_bounds.y + texture_bounds.height); ty++) {
selected[ty * tilesX + tx] = false; // may be omitted for (int tx = texture_bounds.x; tx < (texture_bounds.x + texture_bounds.width); tx++) {
selected[ty*tilesX+tx] = true;
}
}
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) {
selected[ty * tilesX + tx] = true;
if (maxX < tx) maxX = tx;
if (minX > tx) minX = tx;
if (maxY < ty) maxY = ty;
if (minY > ty) minY = ty;
} else {
selected[ty * tilesX + tx] = false; // may be omitted
}
} }
} }
if (maxX < 0) { if (maxX < 0) {
......
This diff is collapsed.
...@@ -28,6 +28,7 @@ import java.util.Properties; ...@@ -28,6 +28,7 @@ import java.util.Properties;
import com.elphel.imagej.common.GenericJTabbedDialog; import com.elphel.imagej.common.GenericJTabbedDialog;
public class ImageDttParameters { public class ImageDttParameters {
public boolean gpu_mode_debug = true;
public boolean corr_mode_debug = true; public boolean corr_mode_debug = true;
public boolean mix_corr_poly = true; public boolean mix_corr_poly = true;
public double min_poly_strength = 0.2; /// 0.1 public double min_poly_strength = 0.2; /// 0.1
...@@ -191,6 +192,9 @@ public class ImageDttParameters { ...@@ -191,6 +192,9 @@ public class ImageDttParameters {
public void dialogQuestions(GenericJTabbedDialog gd) { public void dialogQuestions(GenericJTabbedDialog gd) {
gd.addCheckbox ("Debug CPU->GPU matching", this.gpu_mode_debug,
"output clt_corr_partial");
gd.addCheckbox ("Enable ImageDtt correlation debug layers", this.corr_mode_debug, 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)"); "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); gd.addCheckbox ("Replace CM layer with mixed/new poly one", this.mix_corr_poly);
...@@ -467,6 +471,7 @@ public class ImageDttParameters { ...@@ -467,6 +471,7 @@ public class ImageDttParameters {
} }
public void dialogAnswers(GenericJTabbedDialog gd) { public void dialogAnswers(GenericJTabbedDialog gd) {
this.gpu_mode_debug = gd.getNextBoolean();
this.corr_mode_debug= gd.getNextBoolean(); this.corr_mode_debug= gd.getNextBoolean();
this.mix_corr_poly= gd.getNextBoolean(); this.mix_corr_poly= gd.getNextBoolean();
this.min_poly_strength= gd.getNextNumber(); this.min_poly_strength= gd.getNextNumber();
...@@ -608,6 +613,7 @@ public class ImageDttParameters { ...@@ -608,6 +613,7 @@ public class ImageDttParameters {
public void setProperties(String prefix,Properties properties){ public void setProperties(String prefix,Properties properties){
properties.setProperty(prefix+"gpu_mode_debug", this.gpu_mode_debug+"");
properties.setProperty(prefix+"corr_mode_debug", this.corr_mode_debug+""); properties.setProperty(prefix+"corr_mode_debug", this.corr_mode_debug+"");
properties.setProperty(prefix+"mix_corr_poly", this.mix_corr_poly+""); properties.setProperty(prefix+"mix_corr_poly", this.mix_corr_poly+"");
properties.setProperty(prefix+"min_poly_strength", this.min_poly_strength+""); properties.setProperty(prefix+"min_poly_strength", this.min_poly_strength+"");
...@@ -749,6 +755,7 @@ public class ImageDttParameters { ...@@ -749,6 +755,7 @@ public class ImageDttParameters {
} }
public void getProperties(String prefix,Properties properties){ 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+"corr_mode_debug")!=null) this.corr_mode_debug=Boolean.parseBoolean(properties.getProperty(prefix+"corr_mode_debug")); 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+"mix_corr_poly")!=null) this.mix_corr_poly=Boolean.parseBoolean(properties.getProperty(prefix+"mix_corr_poly"));
if (properties.getProperty(prefix+"min_poly_strength")!=null) this.min_poly_strength=Double.parseDouble(properties.getProperty(prefix+"min_poly_strength")); if (properties.getProperty(prefix+"min_poly_strength")!=null) this.min_poly_strength=Double.parseDouble(properties.getProperty(prefix+"min_poly_strength"));
...@@ -890,6 +897,7 @@ public class ImageDttParameters { ...@@ -890,6 +897,7 @@ public class ImageDttParameters {
@Override @Override
public ImageDttParameters clone() throws CloneNotSupportedException { public ImageDttParameters clone() throws CloneNotSupportedException {
ImageDttParameters idp = new ImageDttParameters(); ImageDttParameters idp = new ImageDttParameters();
idp.gpu_mode_debug = this.gpu_mode_debug;
idp.corr_mode_debug = this.corr_mode_debug; idp.corr_mode_debug = this.corr_mode_debug;
idp.mix_corr_poly = this.mix_corr_poly; idp.mix_corr_poly = this.mix_corr_poly;
idp.min_poly_strength = this.min_poly_strength; idp.min_poly_strength = this.min_poly_strength;
......
...@@ -51,7 +51,6 @@ import com.elphel.imagej.common.DoubleGaussianBlur; ...@@ -51,7 +51,6 @@ import com.elphel.imagej.common.DoubleGaussianBlur;
import com.elphel.imagej.common.ShowDoubleFloatArrays; import com.elphel.imagej.common.ShowDoubleFloatArrays;
import com.elphel.imagej.correction.CorrectionColorProc; import com.elphel.imagej.correction.CorrectionColorProc;
import com.elphel.imagej.correction.EyesisCorrections; import com.elphel.imagej.correction.EyesisCorrections;
import com.elphel.imagej.gpu.GPUTileProcessor;
import com.elphel.imagej.jp4.JP46_Reader_camera; import com.elphel.imagej.jp4.JP46_Reader_camera;
import com.elphel.imagej.tileprocessor.GeometryCorrection.CorrVector; import com.elphel.imagej.tileprocessor.GeometryCorrection.CorrVector;
import com.elphel.imagej.x3d.export.WavefrontExport; import com.elphel.imagej.x3d.export.WavefrontExport;
...@@ -7145,7 +7144,8 @@ public class QuadCLTCPU { ...@@ -7145,7 +7144,8 @@ public class QuadCLTCPU {
debugLevel); debugLevel);
tp.clt_3d_passes.add(bgnd_data); tp.clt_3d_passes.add(bgnd_data);
// if (show_init_refine) // if (show_init_refine)
if ((debugLevel > -2) && clt_parameters.show_first_bg) { // if ((debugLevel > -2) && clt_parameters.show_first_bg) {
if ((debugLevel > -3) && clt_parameters.show_first_bg) {
tp.showScan( tp.showScan(
tp.clt_3d_passes.get(0), // CLTPass3d scan, tp.clt_3d_passes.get(0), // CLTPass3d scan,
"bgnd_data-"+tp.clt_3d_passes.size()); "bgnd_data-"+tp.clt_3d_passes.size());
...@@ -9412,14 +9412,14 @@ public class QuadCLTCPU { ...@@ -9412,14 +9412,14 @@ public class QuadCLTCPU {
) )
{ {
final boolean new_mode = false; final boolean new_mode = false;
boolean dbg_gpu_transition = true;
final int tilesX = tp.getTilesX(); final int tilesX = tp.getTilesX();
final int tilesY = tp.getTilesY(); final int tilesY = tp.getTilesY();
ShowDoubleFloatArrays sdfa_instance = null; ShowDoubleFloatArrays sdfa_instance = null;
if (clt_parameters.debug_filters && (debugLevel > -1)) if ((clt_parameters.debug_filters && (debugLevel > -1)) || dbg_gpu_transition)
// if ((debugLevel > -1)) // if ((debugLevel > -1))
sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging? sdfa_instance = new ShowDoubleFloatArrays(); // just for debugging?
...@@ -9514,7 +9514,7 @@ public class QuadCLTCPU { ...@@ -9514,7 +9514,7 @@ public class QuadCLTCPU {
for (int tileY = 0; tileY < tilesY; tileY++){ for (int tileY = 0; tileY < tilesY; tileY++){
for (int tileX = 0; tileX < tilesX; tileX++){ for (int tileX = 0; tileX < tilesX; tileX++){
texture_tiles_bgnd[tileY][tileX]= null; texture_tiles_bgnd[tileY][tileX]= null;
if ((texture_tiles[tileY][tileX] != null) && if ((texture_tiles[tileY][tileX] != null) && // null pointer
bgnd_tiles[tileY * tilesX + tileX]) { bgnd_tiles[tileY * tilesX + tileX]) {
if (bgnd_tiles_grown2[tileY * tilesX + tileX]) { if (bgnd_tiles_grown2[tileY * tilesX + tileX]) {
texture_tiles_bgnd[tileY][tileX]= texture_tiles[tileY][tileX]; texture_tiles_bgnd[tileY][tileX]= texture_tiles[tileY][tileX];
...@@ -9628,6 +9628,7 @@ public class QuadCLTCPU { ...@@ -9628,6 +9628,7 @@ public class QuadCLTCPU {
CLTPass3d scan = tp.clt_3d_passes.get(scanIndex); CLTPass3d scan = tp.clt_3d_passes.get(scanIndex);
boolean [] borderTiles = scan.border_tiles; boolean [] borderTiles = scan.border_tiles;
double [][][][] texture_tiles = scan.texture_tiles; double [][][][] texture_tiles = scan.texture_tiles;
// only place that uses updateSelection()
scan.updateSelection(); // update .selected field (all selected, including border) and Rectangle bounds scan.updateSelection(); // update .selected field (all selected, including border) and Rectangle bounds
if (scan.getTextureBounds() == null) { // not used in lwir if (scan.getTextureBounds() == null) { // not used in lwir
System.out.println("getPassImage(): Empty image!"); System.out.println("getPassImage(): Empty image!");
...@@ -9857,6 +9858,17 @@ public class QuadCLTCPU { ...@@ -9857,6 +9858,17 @@ public class QuadCLTCPU {
z_correction +=clt_parameters.z_corr_map.get(image_name); z_correction +=clt_parameters.z_corr_map.get(image_name);
} }
final double disparity_corr = (z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/z_correction); final double disparity_corr = (z_correction == 0) ? 0.0 : geometryCorrection.getDisparityFromZ(1.0/z_correction);
double [][][][][] clt_corr_partial = null;
if (clt_parameters.img_dtt.gpu_mode_debug) {
clt_corr_combo = null;
clt_corr_partial = new double [tilesY][tilesX][][][];
for (int i = 0; i < tilesY; i++){
for (int j = 0; j < tilesX; j++){
clt_corr_partial[i][j] = null;
}
}
}
image_dtt.clt_aberrations_quad_corr( image_dtt.clt_aberrations_quad_corr(
clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others clt_parameters.img_dtt, // final ImageDttParameters imgdtt_params, // Now just extra correlation parameters, later will include, most others
...@@ -9867,7 +9879,7 @@ public class QuadCLTCPU { ...@@ -9867,7 +9879,7 @@ public class QuadCLTCPU {
saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null
// correlation results - final and partial // correlation results - final and partial
clt_corr_combo, // [tp.tilesY][tp.tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate clt_corr_combo, // [tp.tilesY][tp.tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null, // clt_corr_partial, // [tp.tilesY][tp.tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate clt_corr_partial, // null, // clt_corr_partial, // [tp.tilesY][tp.tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
null, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate null, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
// Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate // Use it with disparity_maps[scan_step]? clt_mismatch, // [tp.tilesY][tp.tilesX][pair]{dx,dy,weight}[(2*transform_size-1)*(2*transform_size-1)] // transpose unapplied. null - do not calculate
disparity_map, // [12][tp.tilesY * tp.tilesX] disparity_map, // [12][tp.tilesY * tp.tilesX]
...@@ -9897,7 +9909,7 @@ public class QuadCLTCPU { ...@@ -9897,7 +9909,7 @@ public class QuadCLTCPU {
null, // final GeometryCorrection geometryCorrection_main, // if not null correct this camera (aux) to the coordinates of the main null, // final GeometryCorrection geometryCorrection_main, // if not null correct this camera (aux) to the coordinates of the main
clt_kernels, // final double [][][][][][] clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around) clt_kernels, // final double [][][][][][] clt_kernels, // [channel_in_quad][color][tileY][tileX][band][pixel] , size should match image (have 1 tile around)
clt_parameters.kernel_step, clt_parameters.kernel_step,
/// image_dtt.transform_size, /// image_dtt.transform_size,
clt_parameters.clt_window, clt_parameters.clt_window,
shiftXY, // shiftXY, //
disparity_corr, // final double disparity_corr, // disparity at infinity disparity_corr, // final double disparity_corr, // disparity at infinity
...@@ -9920,6 +9932,32 @@ public class QuadCLTCPU { ...@@ -9920,6 +9932,32 @@ public class QuadCLTCPU {
scan_rslt.is_measured = true; scan_rslt.is_measured = true;
scan_rslt.is_combo = false; scan_rslt.is_combo = false;
scan_rslt.resetProcessed(); scan_rslt.resetProcessed();
if (clt_corr_partial!=null){ // only to debug matching gpu/cpu
if (debugLevel > -3){ // -1
String [] allColorNames = {"red","blue","green","combo"};
String [] titles = new String[clt_corr_partial.length];
for (int i = 0; i < titles.length; i++){
titles[i]=allColorNames[i % allColorNames.length]+"_"+(i / allColorNames.length);
}
double [][] corr_rslt_partial = image_dtt.corr_partial_dbg(
clt_corr_partial,
2*image_dtt.transform_size - 1, //final int corr_size,
4, // final int pairs,
4, // final int colors,
clt_parameters.corr_border_contrast,
threadsMax,
debugLevel);
// titles.length = 15, corr_rslt_partial.length=16!
System.out.println("corr_rslt_partial.length = "+corr_rslt_partial.length+", titles.length = "+titles.length);
(new ShowDoubleFloatArrays()).showArrays( // out of boundary 15
corr_rslt_partial,
tilesX*(2*image_dtt.transform_size),
tilesY*(2*image_dtt.transform_size),
true,
image_name+sAux()+"-PART_CORR-GPU-D"+clt_parameters.disparity);
}
}
return scan_rslt; return scan_rslt;
} }
......
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