Commit 7c10a29b authored by Andrey Filippov's avatar Andrey Filippov

Editing for GPU debug export

parent 643febaa
......@@ -805,6 +805,8 @@ private Panel panel1,
addButton("Reset AUX Geometry", panelLWIR16, color_stop);
addButton("Generate Sym Vectors", panelLWIR16, color_configure);
addButton("Image Properties", panelLWIR16, color_conf_process);
addButton("GPU simulate", panelClt_GPU, color_conf_process);
plugInFrame.add(panelLWIR16);
}
......@@ -6095,12 +6097,12 @@ private Panel panel1,
QUAD_CLT, // QuadCLT quadCLT_main,
QUAD_CLT_AUX, // QuadCLT quadCLT_aux,
CLT_PARAMETERS, // EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters,
// DEBAYER_PARAMETERS, //EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
COLOR_PROC_PARAMETERS_AUX, //EyesisCorrectionParameters.ColorProcParameters colorProcParameters_aux,
RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters,
// RGB_PARAMETERS, //EyesisCorrectionParameters.RGBParameters rgbParameters,
THREADS_MAX, //final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, //final boolean updateStatus,
// UPDATE_STATUS, //final boolean updateStatus,
DEBUG_LEVEL);
} catch (Exception e) {
// TODO Auto-generated catch block
......
......@@ -91,7 +91,7 @@ public class GPUTileProcessor {
public static int DTT_SIZE_LOG2 = 3;
public static int DTT_SIZE = (1 << DTT_SIZE_LOG2);
static int THREADSX = DTT_SIZE;
public static int NUM_CAMS = 4;
public static int NUM_CAMS = 16; // 4; Now - maximal number of sensors
public static int NUM_PAIRS = 6; // top hor, bottom hor, left vert, right vert, main diagonal, other diagonal
public static int NUM_COLORS = 3;
// public static int IMG_WIDTH = 2592;
......
......@@ -374,6 +374,7 @@ public class GpuQuad{ // quad camera description
}
}
// Use NUM_CAMS = 16 gc.expandSensors(NUM_CAMS) here
public void setGeometryCorrection(GeometryCorrection gc,
boolean use_java_rByRDist) { // false - use newer GPU execCalcReverseDistortions
float [] fgc = gc.toFloatArray();
......@@ -1306,6 +1307,8 @@ public class GpuQuad{ // quad camera description
IJ.showMessage("Error", "No GPU kernel: GPU_IMCLT_ALL_kernel");
return;
}
//cuFuncSetAttribute(this.gpuTileProcessor.GPU_IMCLT_ALL_kernel, CU_FUNC_ATTRIBUTE_MAX_DYNAMIC_SHARED_SIZE_BYTES, 65536)
int apply_lpf = 1;
int tilesX = img_width / GPUTileProcessor.DTT_SIZE;
int tilesY = img_height / GPUTileProcessor.DTT_SIZE;
......@@ -1321,6 +1324,7 @@ public class GpuQuad{ // quad camera description
Pointer.to(new int[] { imclt_stride }) // const size_t dstride); // in floats (pixels)
);
cuCtxSynchronize();
// Call the kernel function
cuLaunchKernel(this.gpuTileProcessor.GPU_IMCLT_ALL_kernel,
GridFullWarps[0], GridFullWarps[1], GridFullWarps[2], // Grid dimension
......
......@@ -417,6 +417,26 @@ public class CorrVector{ // TODO: Update to non-quad (extract to a file first)?
this.geometryCorrection = geometryCorrection;
}
public CorrVector (
GeometryCorrection geometryCorrection,
GeometryCorrection sourceGeometryCorrection)
{
int num_sensors = geometryCorrection.getNumSensors();
this.symmVectorsSet = SymmVector.getSymmVectorsSet (num_sensors);
this.geometryCorrection = geometryCorrection;
this.vector = new double[getLength(num_sensors)];
CorrVector scv = sourceGeometryCorrection.getCorrVector();
int num_sens = geometryCorrection.getNumSensors();
int snum_sens = sourceGeometryCorrection.getNumSensors();
int min_num_sens = (snum_sens < num_sens) ? snum_sens : num_sens;
System.arraycopy(scv.vector, scv.getTiltIndex(), vector, getTiltIndex(), min_num_sens - 1);
System.arraycopy(scv.vector, scv.getAzimuthIndex(), vector, getAzimuthIndex(), min_num_sens - 1);
System.arraycopy(scv.vector, scv.getRollIndex(), vector, getRollIndex(), min_num_sens);
System.arraycopy(scv.vector, scv.getZoomIndex(), vector, getZoomIndex(), min_num_sens - 1);
System.arraycopy(scv.vector, scv.getIMUIndex(), vector, getIMUIndex(), CORR_IMU.length);
}
public CorrVector getCorrVector(
GeometryCorrection geometryCorrection,
double [] vector){// not used in lwir
......
......@@ -237,9 +237,9 @@ public class GeometryCorrection {
right, // [0], right[1], right[2], right[3], // [NUM_CAMS];
height, // [0], height[1], height[2], height[3], // [NUM_CAMS];
roll, // [0], roll[1], roll[2], roll[3], // [NUM_CAMS]; // degrees, CW (to target) - positive
// [NUM_CAMS][2]
pXY0, // [0][0], pXY0[0][1], pXY0[1][0], pXY0[1][1],
// [2][0], pXY0[2][1], pXY0[3][0], pXY0[3][1],
common_right, // mm right, camera center
common_forward, // mm forward (to target), camera center
common_height, // mm up, camera center
......@@ -284,47 +284,55 @@ public class GeometryCorrection {
doubles[i] = double_list.get(i);
}
return doubles;
/*
return new double[] {
pixelCorrectionWidth, // =2592; // virtual camera center is at (pixelCorrectionWidth/2, pixelCorrectionHeight/2)
pixelCorrectionHeight, // =1936;
line_time, // duration of one scan line readout (for ERS)
focalLength, // =FOCAL_LENGTH;
pixelSize, // = PIXEL_SIZE; //um
distortionRadius, // = DISTORTION_RADIUS; // mm - half width of the sensor
distortionC, // r^2
distortionB, // r^3
distortionA, // r^4 (normalized to focal length or to sensor half width?)
distortionA5, // r^5 (normalized to focal length or to sensor half width?)
distortionA6, // r^6 (normalized to focal length or to sensor half width?)
distortionA7, // r^7 (normalized to focal length or to sensor half width?)
distortionA8, // r^8 (normalized to focal length or to sensor half width?)
elevation, // degrees, up - positive;
heading, // degrees, CW (from top) - positive
forward[0], forward[1], forward[2], forward[3], // [NUM_CAMS];
right[0], right[1], right[2], right[3], // [NUM_CAMS];
height[0], height[1], height[2], height[3], // [NUM_CAMS];
roll[0], roll[1], roll[2], roll[3], // [NUM_CAMS]; // degrees, CW (to target) - positive
pXY0[0][0], pXY0[0][1], pXY0[1][0], pXY0[1][1],
pXY0[2][0], pXY0[2][1], pXY0[3][0], pXY0[3][1],
common_right, // mm right, camera center
common_forward, // mm forward (to target), camera center
common_height, // mm up, camera center
common_roll, // degrees CW (to target) camera as a whole
rXY[0][0], rXY[0][1], // [NUM_CAMS][2]; // XY pairs of the in a normal plane, relative to disparityRadius
rXY[1][0], rXY[1][1],
rXY[2][0], rXY[2][1],
rXY[3][0], rXY[3][1],
cameraRadius, // average distance from the "mass center" of the sensors to the sensors
disparityRadius, //=150.0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad
woi_tops[0],woi_tops[1],woi_tops[2],woi_tops[3]
// TODO: ADD camera_heights[0], camera_heights[1], camera_heights[2], camera_heights[3],
};
*/
}
public GeometryCorrection expandSensors(int num_cams) {
GeometryCorrection egc = new GeometryCorrection (num_cams);
// single
int min_nc = (numSensors < num_cams) ? numSensors : num_cams;
egc.pixelCorrectionWidth = pixelCorrectionWidth; // =2592; // virtual camera center is at (pixelCorrectionWidth/2, pixelCorrectionHeight/2)
egc.pixelCorrectionHeight = pixelCorrectionHeight; // =1936;
egc.line_time = line_time; // duration of one scan line readout (for ERS)
egc.focalLength = focalLength; // , // =FOCAL_LENGTH;
egc.pixelSize = pixelSize; // = PIXEL_SIZE; //um
egc.distortionRadius = distortionRadius; // = DISTORTION_RADIUS; // mm - half width of the sensor
egc.distortionC = distortionC; // r^2
egc.distortionB = distortionB; // r^3
egc.distortionA = distortionA; // r^4 (normalized to focal length or to sensor half width?)
egc.distortionA5 = distortionA5; // r^5 (normalized to focal length or to sensor half width?)
egc.distortionA6 = distortionA6; // r^6 (normalized to focal length or to sensor half width?)
egc.distortionA7 = distortionA7; // r^7 (normalized to focal length or to sensor half width?)
egc.distortionA8 = distortionA8; // r^8 (normalized to focal length or to sensor half width?)
egc.elevation = elevation; // degrees, up - positive;
egc.heading = heading; // degrees, CW (from top) - positive
egc.common_right = common_right; // mm right, camera center
egc.common_forward = common_forward; // mm forward (to target), camera center
egc.common_height = common_height; // mm up, camera center
egc.common_roll = common_roll; // degrees CW (to target) camera as a whole
egc.cameraRadius = cameraRadius; // average distance from the "mass center" of the sensors to the sensors
egc.disparityRadius = disparityRadius; //=150.0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad
System.arraycopy(forward, 0, egc.forward, 0, min_nc);
System.arraycopy(right, 0, egc.right, 0, min_nc);
System.arraycopy(height, 0, egc.height, 0, min_nc);
System.arraycopy(roll, 0, egc.roll, 0, min_nc);
System.arraycopy(woi_tops, 0, egc.woi_tops,0, min_nc);
for (int n = 0; n < min_nc; n++) {
egc.pXY0[n] = pXY0[n].clone();
}
CorrVector cv = new CorrVector (
egc, // GeometryCorrection geometryCorrection,
this); // GeometryCorrection sourceGeometryCorrection)
egc.setCorrVector(cv);
egc.rByRDist = rByRDist.clone();
return egc;
}
public int [] getWOITops() {// not used in lwir
return woi_tops;
}
......
......@@ -1469,7 +1469,9 @@ public class QuadCLTCPU {
geometryCorrection.setCorrVector(this.extrinsic_vect);
// geometryCorrection = new GeometryCorrection(this.extrinsic_vect);
}
//
if (is_aux) {
geometryCorrection.setRigOffsetFromProperies(prefix, properties);
}
......@@ -1631,7 +1633,13 @@ public class QuadCLTCPU {
System.out.println("=== Extrinsic corrections ===");
System.out.println(geometryCorrection.getCorrVector().toString());
}
double [] dbg_objects = geometryCorrection.toDoubleArray();
// double [] dbg_objects = geometryCorrection.toDoubleArray();
double [] dbg_double = geometryCorrection.toDoubleArray();
float [] dbg_float = geometryCorrection.toFloatArray();
System.out.println("toFloatArray().length="+geometryCorrection.toFloatArray().length);
System.out.println();
//listGeometryCorrection
return true;
}
......@@ -14166,18 +14174,18 @@ public class QuadCLTCPU {
) {
boolean need_diffs = false;
double [][] src_data = {
this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX:TwoQuadCLT.DSI_DISPARITY_MAIN],
this.dsi[is_aux?TwoQuadCLT.DSI_STRENGTH_AUX:TwoQuadCLT.DSI_STRENGTH_MAIN],
this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX_LMA:TwoQuadCLT.DSI_DISPARITY_MAIN_LMA],
this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX:TwoQuadCLT.DSI_DISPARITY_MAIN],
this.dsi[is_aux?TwoQuadCLT.DSI_STRENGTH_AUX:TwoQuadCLT.DSI_STRENGTH_MAIN],
this.dsi[is_aux?TwoQuadCLT.DSI_DISPARITY_AUX_LMA:TwoQuadCLT.DSI_DISPARITY_MAIN_LMA],
};
CLTPass3d pass = new CLTPass3d (this.tp, 0);
boolean [] selection = new boolean [src_data[0].length];
boolean [] selection_all = new boolean [src_data[0].length];
for (int i = 0; i < selection.length; i++) {
selection[i] = (src_data[1][i] > 0) && (Double.isNaN(src_data[2][i])); // that do not have LMA
selection_all[i] = (src_data[1][i] > 0);
}
for (int clust_radius = 00; clust_radius < 5; clust_radius++) {
pass.setTileOpDisparity(
......@@ -14194,22 +14202,24 @@ public class QuadCLTCPU {
100, // final int threadsMax, // maximal number of threads to launch
true, // final boolean updateStatus,
0); // final int debugLevel)
tp.showScan(
pass, // CLTPass3d scan,
getImageName()+"-MAP-FZ"+(clt_parameters.getGpuFatZero(isMonochrome()))+"-CLUST"+clust_radius);
tp.showLmaCmStrength(
pass, // CLTPass3d scan,
64, // int bins,
"Strength_lma_vs_cm_cr"+clust_radius+"-FZ"+(clt_parameters.getGpuFatZero(isMonochrome()))); // String title)
if (clust_radius == 0) {
tp.adjustLmaStrength (
clt_parameters.img_dtt, // ImageDttParameters imgdtt_params,
pass, // CLTPass3d scan,
1); // int debugLevel)
}
tp.showScan(
pass, // CLTPass3d scan,
getImageName()+"-MAP-FZ"+(clt_parameters.getGpuFatZero(isMonochrome()))+"-CLUST"+clust_radius);
tp.showLmaCmStrength(
pass, // CLTPass3d scan,
64, // int bins,
"Strength_lma_vs_cm_cr"+clust_radius+"-FZ"+(clt_parameters.getGpuFatZero(isMonochrome()))); // String title)
if (clust_radius == 0) {
tp.adjustLmaStrength (
clt_parameters.img_dtt, // ImageDttParameters imgdtt_params,
pass, // CLTPass3d scan,
1); // int debugLevel)
}
}
return;
}
// Generate files for testing GPU
}
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