Commit 77f4edc9 authored by Andrey Filippov's avatar Andrey Filippov

previous changes, not committed before

parent c500f3ad
......@@ -118,101 +118,6 @@ public class EyesisDCT {
return kernels != null;
}
/// public boolean CLTKernelsAvailable(){
/// return clt_kernels != null;
/// }
/// public boolean geometryCorrectionAvailable(){
/// return geometryCorrection != null;
/// }
/***
public boolean initGeometryCorrection(int debugLevel){
geometryCorrection = new GeometryCorrection();
PixelMapping.SensorData [] sensors = eyesisCorrections.pixelMapping.sensors;
// verify that all sensors have the same distortion parameters
int numSensors = sensors.length;
for (int i = 1; i < numSensors; i++){
if ( (sensors[0].focalLength != sensors[i].focalLength) ||
(sensors[0].distortionC != sensors[i].distortionC) ||
(sensors[0].distortionB != sensors[i].distortionB) ||
(sensors[0].distortionA != sensors[i].distortionA) ||
(sensors[0].distortionA5 != sensors[i].distortionA5) ||
(sensors[0].distortionA6 != sensors[i].distortionA6) ||
(sensors[0].distortionA7 != sensors[i].distortionA7) ||
(sensors[0].distortionA8 != sensors[i].distortionA8) ||
(sensors[0].distortionRadius != sensors[i].distortionRadius) ||
(sensors[0].pixelCorrectionWidth != sensors[i].pixelCorrectionWidth) ||
(sensors[0].pixelCorrectionHeight != sensors[i].pixelCorrectionHeight) ||
(sensors[0].pixelSize != sensors[i].pixelSize)){
System.out.println("initGeometryCorrection(): All sensors have to have the same distortion model, but channels 0 and "+i+" mismatch");
return false;
}
}
// set common distportion parameters
geometryCorrection.setDistortion(
sensors[0].focalLength,
sensors[0].distortionC,
sensors[0].distortionB,
sensors[0].distortionA,
sensors[0].distortionA5,
sensors[0].distortionA6,
sensors[0].distortionA7,
sensors[0].distortionA8,
sensors[0].distortionRadius,
sensors[0].pixelCorrectionWidth, // virtual camera center is at (pixelCorrectionWidth/2, pixelCorrectionHeight/2)
sensors[0].pixelCorrectionHeight,
sensors[0].pixelSize);
// set other/individual sensor parameters
for (int i = 1; i < numSensors; i++){
if ( (sensors[0].theta != sensors[i].theta) || // elevation
(sensors[0].heading != sensors[i].heading)){
System.out.println("initGeometryCorrection(): All sensors have to have the same elevation and heading, but channels 0 and "+i+" mismatch");
return false;
}
}
double [] forward = new double[numSensors];
double [] right = new double[numSensors];
double [] height = new double[numSensors];
double [] roll = new double[numSensors];
double [][] pXY0 = new double[numSensors][2];
for (int i = 0; i < numSensors; i++){
forward[i] = sensors[i].forward;
right[i] = sensors[i].right;
height[i] = sensors[i].height;
roll[i] = sensors[i].psi;
pXY0[i][0] = sensors[i].px0;
pXY0[i][1] = sensors[i].py0;
}
geometryCorrection.setSensors(
numSensors,
sensors[0].theta,
sensors[0].heading,
forward,
right,
height,
roll,
pXY0);
geometryCorrection.planeProjectLenses(); // project all lenses to the common plane
// calcualte reverse distortion as a table to be linear intr4epolated
geometryCorrection.calcReverseDistortionTable();
if (numSensors == 4){
geometryCorrection.adustSquare();
System.out.println("Adjusted camera to orient X Y along the sides of a square");
} else {
System.out.println("============= Cannot adustSquare() as it requires exactly 4 sensors, "+numSensors+" provided ==========");
return false;
}
// Print parameters
if (debugLevel > 0){
geometryCorrection.listGeometryCorrection(debugLevel > 1);
}
//listGeometryCorrection
return true;
}
*/
public DCTKernels calculateDCTKernel (
final ImageStack kernelStack, // first stack with 3 colors/slices convolution kernels
final int kernelSize, // 64
......
......@@ -523,6 +523,7 @@ private Panel panel1,
addButton("CLT disparity scan", panelClt2, color_conf_process);
addButton("CLT reset fine corr", panelClt2, color_stop);
addButton("CLT reset extrinsic corr", panelClt2, color_stop);
addButton("CLT show geometry", panelClt2, color_configure);
addButton("CLT show fine corr", panelClt2, color_configure);
addButton("CLT apply fine corr", panelClt2, color_process);
addButton("CLT test fine corr", panelClt2, color_process);
......@@ -4613,6 +4614,18 @@ private Panel panel1,
}
QUAD_CLT.resetExtrinsicCorr(CLT_PARAMETERS);
return;
} else if (label.equals("CLT show geometry")) {
if (QUAD_CLT == null){
QUAD_CLT = new QuadCLT (
PROPERTIES,
EYESIS_CORRECTIONS,
CORRECTION_PARAMETERS);
if (DEBUG_LEVEL > 0){
System.out.println("Created new QuadCLT instance, will need to read CLT kernels");
}
}
QUAD_CLT.listGeometryCorrection(true);
return;
} else if (label.equals("CLT show fine corr")) {
if (QUAD_CLT == null){
QUAD_CLT = new QuadCLT (
......
......@@ -61,20 +61,20 @@ public class GeometryCorrection {
public int numSensors = 4;
public double [] forward = null;
public double [] right = null;
public double [] height = null;
public double [] roll = null; // degrees, CW (to target) - positive
private double [] forward = null;
private double [] right = null;
private double [] height = null;
private double [] roll = null; // degrees, CW (to target) - positive
public double [][] pXY0 = null; // sensor center XY in pixels
public double common_right; // mm right, camera center
public double common_forward; // mm forward (to target), camera center
public double common_height; // mm up, camera center
public double common_roll; // degrees CW (to target) camera as a whole
public double [][] XYZ_he; // all cameras coordinates transformed to eliminate heading and elevation (rolls preserved)
public double [][] XYZ_her = null; // XYZ of the lenses in a corrected CCS (adjusted for to elevation, heading, common_roll)
public double [][] rXY = null; // XY pairs of the in a normal plane, relative to disparityRadius
public double [][] rXY_ideal = {{-0.5, -0.5}, {0.5,-0.5}, {-0.5, 0.5}, {0.5,0.5}};
private double common_right; // mm right, camera center
private double common_forward; // mm forward (to target), camera center
private double common_height; // mm up, camera center
private double common_roll; // degrees CW (to target) camera as a whole
private double [][] XYZ_he; // all cameras coordinates transformed to eliminate heading and elevation (rolls preserved)
private double [][] XYZ_her = null; // XYZ of the lenses in a corrected CCS (adjusted for to elevation, heading, common_roll)
private double [][] rXY = null; // XY pairs of the in a normal plane, relative to disparityRadius
private double [][] rXY_ideal = {{-0.5, -0.5}, {0.5,-0.5}, {-0.5, 0.5}, {0.5,0.5}};
public double cameraRadius=0; // average distance from the "mass center" of the sensors to the sensors
public double disparityRadius=0; // distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad camera (~=150mm)?
......
......@@ -116,6 +116,14 @@ public class QuadCLT {
}
}
public void listGeometryCorrection(boolean full){
GeometryCorrection gc = geometryCorrection;
if (gc == null) { // if it was not yet created
gc = new GeometryCorrection(this.extrinsic_corr);
}
gc.listGeometryCorrection(full);
}
public void getProperties(){ // restore
for (int n = 0; n < fine_corr.length; n++){
for (int d = 0; d < fine_corr[n].length; d++){
......@@ -3661,7 +3669,7 @@ public class QuadCLT {
clt_parameters.shift_x, // final int shiftX, // shift image horizontally (positive - right) - just for testing
clt_parameters.shift_y, // final int shiftY, // shift image vertically (positive - down)
-1234, // clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileX, // -1234, // clt_parameters.tileX, // final int debug_tileX,
clt_parameters.tileY, // final int debug_tileY, -1234 will cause port coordinates debug images
(clt_parameters.dbg_mode & 64) != 0, // no fract shift
(clt_parameters.dbg_mode & 128) != 0, // no convolve
......
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