Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
77f4edc9
Commit
77f4edc9
authored
Dec 22, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
previous changes, not committed before
parent
c500f3ad
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
112 deletions
+38
-112
EyesisDCT.java
src/main/java/EyesisDCT.java
+0
-95
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+14
-1
GeometryCorrection.java
src/main/java/GeometryCorrection.java
+14
-14
QuadCLT.java
src/main/java/QuadCLT.java
+10
-2
No files found.
src/main/java/EyesisDCT.java
View file @
77f4edc9
...
@@ -118,101 +118,6 @@ public class EyesisDCT {
...
@@ -118,101 +118,6 @@ public class EyesisDCT {
return
kernels
!=
null
;
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
(
public
DCTKernels
calculateDCTKernel
(
final
ImageStack
kernelStack
,
// first stack with 3 colors/slices convolution kernels
final
ImageStack
kernelStack
,
// first stack with 3 colors/slices convolution kernels
final
int
kernelSize
,
// 64
final
int
kernelSize
,
// 64
...
...
src/main/java/Eyesis_Correction.java
View file @
77f4edc9
...
@@ -519,10 +519,11 @@ private Panel panel1,
...
@@ -519,10 +519,11 @@ private Panel panel1,
panelClt2
=
new
Panel
();
panelClt2
=
new
Panel
();
panelClt2
.
setLayout
(
new
GridLayout
(
1
,
0
,
5
,
5
));
// rows, columns, vgap, hgap
panelClt2
.
setLayout
(
new
GridLayout
(
1
,
0
,
5
,
5
));
// rows, columns, vgap, hgap
addButton
(
"Setup CLT parameters"
,
panelClt2
,
color_configure
);
addButton
(
"Setup CLT parameters"
,
panelClt2
,
color_configure
);
addButton
(
"CLT 4 images"
,
panelClt2
,
color_conf_process
);
addButton
(
"CLT 4 images"
,
panelClt2
,
color_conf_process
);
addButton
(
"CLT disparity scan"
,
panelClt2
,
color_conf_process
);
addButton
(
"CLT disparity scan"
,
panelClt2
,
color_conf_process
);
addButton
(
"CLT reset fine corr"
,
panelClt2
,
color_stop
);
addButton
(
"CLT reset fine corr"
,
panelClt2
,
color_stop
);
addButton
(
"CLT reset extrinsic 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 show fine corr"
,
panelClt2
,
color_configure
);
addButton
(
"CLT apply fine corr"
,
panelClt2
,
color_process
);
addButton
(
"CLT apply fine corr"
,
panelClt2
,
color_process
);
addButton
(
"CLT test fine corr"
,
panelClt2
,
color_process
);
addButton
(
"CLT test fine corr"
,
panelClt2
,
color_process
);
...
@@ -4613,6 +4614,18 @@ private Panel panel1,
...
@@ -4613,6 +4614,18 @@ private Panel panel1,
}
}
QUAD_CLT
.
resetExtrinsicCorr
(
CLT_PARAMETERS
);
QUAD_CLT
.
resetExtrinsicCorr
(
CLT_PARAMETERS
);
return
;
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"
))
{
}
else
if
(
label
.
equals
(
"CLT show fine corr"
))
{
if
(
QUAD_CLT
==
null
){
if
(
QUAD_CLT
==
null
){
QUAD_CLT
=
new
QuadCLT
(
QUAD_CLT
=
new
QuadCLT
(
...
...
src/main/java/GeometryCorrection.java
View file @
77f4edc9
...
@@ -61,20 +61,20 @@ public class GeometryCorrection {
...
@@ -61,20 +61,20 @@ public class GeometryCorrection {
public
int
numSensors
=
4
;
public
int
numSensors
=
4
;
p
ublic
double
[]
forward
=
null
;
p
rivate
double
[]
forward
=
null
;
p
ublic
double
[]
right
=
null
;
p
rivate
double
[]
right
=
null
;
p
ublic
double
[]
height
=
null
;
p
rivate
double
[]
height
=
null
;
p
ublic
double
[]
roll
=
null
;
// degrees, CW (to target) - positive
p
rivate
double
[]
roll
=
null
;
// degrees, CW (to target) - positive
public
double
[][]
pXY0
=
null
;
// sensor center XY in pixels
public
double
[][]
pXY0
=
null
;
// sensor center XY in pixels
p
ublic
double
common_right
;
// mm right, camera center
p
rivate
double
common_right
;
// mm right, camera center
p
ublic
double
common_forward
;
// mm forward (to target), camera center
p
rivate
double
common_forward
;
// mm forward (to target), camera center
p
ublic
double
common_height
;
// mm up, camera center
p
rivate
double
common_height
;
// mm up, camera center
p
ublic
double
common_roll
;
// degrees CW (to target) camera as a whole
p
rivate
double
common_roll
;
// degrees CW (to target) camera as a whole
p
ublic
double
[][]
XYZ_he
;
// all cameras coordinates transformed to eliminate heading and elevation (rolls preserved)
p
rivate
double
[][]
XYZ_he
;
// all cameras coordinates transformed to eliminate heading and elevation (rolls preserved)
p
ublic
double
[][]
XYZ_her
=
null
;
// XYZ of the lenses in a corrected CCS (adjusted for to elevation, heading, common_roll)
p
rivate
double
[][]
XYZ_her
=
null
;
// XYZ of the lenses in a corrected CCS (adjusted for to elevation, heading, common_roll)
p
ublic
double
[][]
rXY
=
null
;
// XY pairs of the in a normal plane, relative to disparityRadius
p
rivate
double
[][]
rXY
=
null
;
// XY pairs of the in a normal plane, relative to disparityRadius
p
ublic
double
[][]
rXY_ideal
=
{{-
0.5
,
-
0.5
},
{
0.5
,-
0.5
},
{-
0.5
,
0.5
},
{
0.5
,
0.5
}};
p
rivate
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
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)?
public
double
disparityRadius
=
0
;
// distance between cameras to normalize disparity units to. sqrt(2)*disparityRadius for quad camera (~=150mm)?
...
...
src/main/java/QuadCLT.java
View file @
77f4edc9
...
@@ -114,7 +114,15 @@ public class QuadCLT {
...
@@ -114,7 +114,15 @@ public class QuadCLT {
String
name
=
prefix
+
"extrinsic_corr_"
+
GeometryCorrection
.
CORR_NAMES
[
i
];
String
name
=
prefix
+
"extrinsic_corr_"
+
GeometryCorrection
.
CORR_NAMES
[
i
];
properties
.
setProperty
(
name
,
gc
.
getCorrVector
().
toArray
()[
i
]+
""
);
properties
.
setProperty
(
name
,
gc
.
getCorrVector
().
toArray
()[
i
]+
""
);
}
}
}
}
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
public
void
getProperties
(){
// restore
for
(
int
n
=
0
;
n
<
fine_corr
.
length
;
n
++){
for
(
int
n
=
0
;
n
<
fine_corr
.
length
;
n
++){
...
@@ -3661,7 +3669,7 @@ public class QuadCLT {
...
@@ -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_x
,
// final int shiftX, // shift image horizontally (positive - right) - just for testing
clt_parameters
.
shift_y
,
// final int shiftY, // shift image vertically (positive - down)
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
.
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
&
64
)
!=
0
,
// no fract shift
(
clt_parameters
.
dbg_mode
&
128
)
!=
0
,
// no convolve
(
clt_parameters
.
dbg_mode
&
128
)
!=
0
,
// no convolve
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment