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
d33f7855
Commit
d33f7855
authored
Jun 15, 2019
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented multi-size strategies, bug fix
parent
96c4558f
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
380 additions
and
183 deletions
+380
-183
DistortionCalibrationData.java
.../elphel/imagej/calibration/DistortionCalibrationData.java
+88
-22
Distortions.java
src/main/java/com/elphel/imagej/calibration/Distortions.java
+44
-17
FittingStrategy.java
...n/java/com/elphel/imagej/calibration/FittingStrategy.java
+248
-144
No files found.
src/main/java/com/elphel/imagej/calibration/DistortionCalibrationData.java
View file @
d33f7855
...
@@ -1490,19 +1490,46 @@ if (sfiles == null) {
...
@@ -1490,19 +1490,46 @@ if (sfiles == null) {
public
void
listImageSet
(
public
void
listImageSet
(
int
mode
,
int
mode
,
int
[]
numPoints
,
int
[]
numPoints
,
// All arrays may be twice long, then 1 - EO, second - LWIR
double
[]
setRMS
,
double
[]
setRMS
,
boolean
[]
hasNaNInSet
){
boolean
[]
hasNaNInSet
){
if
((
this
.
gIS
==
null
)
||
(
this
.
gIS
.
length
==
0
)){
if
((
this
.
gIS
==
null
)
||
(
this
.
gIS
.
length
==
0
)){
return
;
return
;
}
}
boolean
showXYZ
=
true
;
boolean
hasLwir
=
false
;
if
(
numPoints
!=
null
)
{
hasLwir
=
numPoints
.
length
>
this
.
gIS
.
length
;
// twice longer
}
else
if
(
setRMS
!=
null
)
{
hasLwir
=
setRMS
.
length
>
this
.
gIS
.
length
;
// twice longer
}
else
if
(
hasNaNInSet
!=
null
)
{
hasLwir
=
hasNaNInSet
.
length
>
this
.
gIS
.
length
;
// twice longer
}
String
header
=
"#\ttimestamp"
;
String
header
=
"#\ttimestamp"
;
if
(
this
.
eyesisCameraParameters
.
numStations
>
1
)
header
+=
"\tStation"
;
if
(
this
.
eyesisCameraParameters
.
numStations
>
1
)
header
+=
"\tStation"
;
// header+="\tAxial\tTilt\thorPhi\thorPsi\tX\tY\tZ\tMotor2\tMotor3";
// header+="\tAxial\tTilt\thorPhi\thorPsi\tX\tY\tZ\tMotor2\tMotor3";
header
+=
"\tAxial\tTilt\tdTilt\tInter\tMotor2\tMotor3"
;
header
+=
"\tAxial\tTilt\tdTilt\tInter"
;
if
(
numPoints
!=
null
)
header
+=
"\tNumPoints"
;
if
(
showXYZ
)
{
header
+=
"\tGXY0\tGXY1\tGXY2"
;
}
header
+=
"\tMotor2\tMotor3"
;
if
(
numPoints
!=
null
)
{
if
(
hasLwir
)
{
header
+=
"\tNumPointsEO\tNumPointsLWIR"
;
}
else
{
header
+=
"\tNumPoints"
;
}
}
header
+=
"\tEnabled\tMatched"
;
header
+=
"\tEnabled\tMatched"
;
if
(
setRMS
!=
null
)
header
+=
"\tRMS\tWeight"
;
if
(
setRMS
!=
null
)
{
if
(
hasLwir
)
{
header
+=
"\tRMS-EO\tRMS-LWIR\tWeight"
;
}
else
{
header
+=
"\tRMS\tWeight"
;
}
}
for
(
int
n
=
0
;
n
<
this
.
gIS
[
0
].
imageSet
.
length
;
n
++)
header
+=
"\t"
+
n
;
for
(
int
n
=
0
;
n
<
this
.
gIS
[
0
].
imageSet
.
length
;
n
++)
header
+=
"\t"
+
n
;
StringBuffer
sb
=
new
StringBuffer
();
StringBuffer
sb
=
new
StringBuffer
();
...
@@ -1553,12 +1580,25 @@ if (sfiles == null) {
...
@@ -1553,12 +1580,25 @@ if (sfiles == null) {
sb
.
append
(
"\t"
+(
Double
.
isNaN
(
dTilt
)?
"---"
:
IJ
.
d2s
(
dTilt
,
3
)));
sb
.
append
(
"\t"
+(
Double
.
isNaN
(
dTilt
)?
"---"
:
IJ
.
d2s
(
dTilt
,
3
)));
sb
.
append
(
"\t"
+(
Double
.
isNaN
(
firstInterAxisAngle
)?
"---"
:
IJ
.
d2s
(
firstInterAxisAngle
,
3
)));
sb
.
append
(
"\t"
+(
Double
.
isNaN
(
firstInterAxisAngle
)?
"---"
:
IJ
.
d2s
(
firstInterAxisAngle
,
3
)));
if
(
showXYZ
)
{
sb
.
append
(
String
.
format
(
"\t%.1f\t%.1f\t%.1f"
,
this
.
gIS
[
i
].
GXYZ
[
0
],
this
.
gIS
[
i
].
GXYZ
[
1
],
this
.
gIS
[
i
].
GXYZ
[
2
]));
}
if
(
this
.
gIS
[
i
].
motors
==
null
)
{
if
(
this
.
gIS
[
i
].
motors
==
null
)
{
sb
.
append
(
"\t"
+
"bug"
+
"\t"
+
"bug"
);
sb
.
append
(
"\t"
+
"bug"
+
"\t"
+
"bug"
);
}
else
{
}
else
{
sb
.
append
(
"\t"
+
this
.
gIS
[
i
].
motors
[
1
]+
"\t"
+
this
.
gIS
[
i
].
motors
[
2
]);
// null pointer here????
sb
.
append
(
"\t"
+
this
.
gIS
[
i
].
motors
[
1
]+
"\t"
+
this
.
gIS
[
i
].
motors
[
2
]);
// null pointer here????
}
}
if
(
numPoints
!=
null
)
sb
.
append
(
"\t"
+
numPoints
[
i
]);
if
(
numPoints
!=
null
)
{
if
(
hasLwir
)
{
sb
.
append
(
"\t"
+
numPoints
[
2
*
i
+
0
]);
sb
.
append
(
"\t"
+
numPoints
[
2
*
i
+
1
]);
}
else
{
sb
.
append
(
"\t"
+
numPoints
[
i
]);
}
}
int
numEnImages
=
0
;
int
numEnImages
=
0
;
for
(
int
n
=
0
;
n
<
this
.
gIS
[
i
].
imageSet
.
length
;
n
++)
if
(
this
.
gIS
[
i
].
imageSet
[
n
]!=
null
){
for
(
int
n
=
0
;
n
<
this
.
gIS
[
i
].
imageSet
.
length
;
n
++)
if
(
this
.
gIS
[
i
].
imageSet
[
n
]!=
null
){
if
(
this
.
gIS
[
i
].
imageSet
[
n
].
enabled
)
numEnImages
++;
if
(
this
.
gIS
[
i
].
imageSet
[
n
].
enabled
)
numEnImages
++;
...
@@ -1572,9 +1612,15 @@ if (sfiles == null) {
...
@@ -1572,9 +1612,15 @@ if (sfiles == null) {
}
}
sb
.
append
(
"\t"
+
matchedPointersInSet
);
sb
.
append
(
"\t"
+
matchedPointersInSet
);
if
(
setRMS
!=
null
)
{
if
(
setRMS
!=
null
)
{
if
(
hasLwir
)
{
sb
.
append
(
"\t"
+(((
hasNaNInSet
!=
null
)
&&
hasNaNInSet
[
2
*
i
+
0
])?
"*"
:
""
)+
IJ
.
d2s
(
setRMS
[
2
*
i
+
0
],
3
));
sb
.
append
(
"\t"
+(((
hasNaNInSet
!=
null
)
&&
hasNaNInSet
[
2
*
i
+
1
])?
"*"
:
""
)+
IJ
.
d2s
(
setRMS
[
2
*
i
+
1
],
3
));
//393
sb
.
append
(
"\t"
+
IJ
.
d2s
(
this
.
gIS
[
i
].
setWeight
,
3
));
}
else
{
sb
.
append
(
"\t"
+(((
hasNaNInSet
!=
null
)
&&
hasNaNInSet
[
i
])?
"*"
:
""
)+
IJ
.
d2s
(
setRMS
[
i
],
3
));
sb
.
append
(
"\t"
+(((
hasNaNInSet
!=
null
)
&&
hasNaNInSet
[
i
])?
"*"
:
""
)+
IJ
.
d2s
(
setRMS
[
i
],
3
));
sb
.
append
(
"\t"
+
IJ
.
d2s
(
this
.
gIS
[
i
].
setWeight
,
3
));
sb
.
append
(
"\t"
+
IJ
.
d2s
(
this
.
gIS
[
i
].
setWeight
,
3
));
}
}
}
switch
(
mode
)
{
switch
(
mode
)
{
case
0
:
case
0
:
for
(
int
n
=
0
;
n
<
this
.
gIS
[
i
].
imageSet
.
length
;
n
++){
for
(
int
n
=
0
;
n
<
this
.
gIS
[
i
].
imageSet
.
length
;
n
++){
...
@@ -3331,7 +3377,7 @@ if (sfiles == null) {
...
@@ -3331,7 +3377,7 @@ if (sfiles == null) {
return
small_sensors
;
return
small_sensors
;
}
}
public
boolean
isSmallSensor
(
int
numImg
)
{
public
boolean
isSmallSensor
(
int
numImg
)
{
if
((
this
.
gIP
!=
null
)
&&
(
numImg
<
this
.
gIP
.
length
)
&&
(
small_sensors
=
=
null
)){
if
((
this
.
gIP
!=
null
)
&&
(
numImg
<
this
.
gIP
.
length
)
&&
(
small_sensors
!
=
null
)){
return
small_sensors
[
this
.
gIP
[
numImg
].
getChannel
()];
return
small_sensors
[
this
.
gIP
[
numImg
].
getChannel
()];
}
}
return
false
;
return
false
;
...
@@ -3410,32 +3456,52 @@ if (sfiles == null) {
...
@@ -3410,32 +3456,52 @@ if (sfiles == null) {
}
}
return
n
;
return
n
;
}
}
// check if the channel is the first in group
public
boolean
firstInGroup
(
int
chn
)
{
if
(
chn
>=
24
)
return
(
chn
==
24
);
if
((
chn
==
getVnir0
())
||
(
chn
==
getLwir0
()))
return
true
;
int
[]
num
=
{
0
,
0
};
for
(
int
i
=
0
;
i
<
chn
;
i
++)
{
if
((
small_sensors
!=
null
)
&&
small_sensors
[
i
])
num
[
1
]++;
else
num
[
0
]++;
}
if
((
small_sensors
!=
null
)
&&
small_sensors
[
chn
])
return
(
num
[
1
]
==
1
);
else
return
(
num
[
0
]
==
1
);
}
public
String
getSubName
(
int
chn
)
{
public
String
getSubName
(
int
chn
,
boolean
full
)
{
int
groups
=
getSubGroups
();
int
groups
=
getSubGroups
();
if
(
groups
==
1
)
return
"sub"
;
// single camera
if
(
groups
==
1
)
return
full
?
"Single subcamera"
:
"sub"
;
// single camera
int
num_sub
=
getNumSubCameras
();
int
num_sub
=
getNumSubCameras
();
if
(
num_sub
==
26
)
{
// eyesis4pi-26
if
(
num_sub
==
26
)
{
// eyesis4pi-26
if
(
chn
==
0
)
return
"sub-head-0"
;
if
(
chn
==
0
)
return
full
?
"Camera head subcamera 0"
:
"sub-head-0"
;
if
(
chn
<
24
)
return
"sub-head-other"
;
if
(
chn
<
24
)
return
full
?
"Camera head other subcameras"
:
"sub-head-other"
;
return
"sub-bottom"
;
if
(
chn
==
24
)
return
full
?
"Camera bottom 0"
:
"sub-bottom-0"
;
return
full
?
"Camera bottom other"
:
"sub-bottom-other"
;
}
}
if
(
hasSmallSensors
())
{
if
(
hasSmallSensors
())
{
if
(
small_sensors
[
chn
])
{
// current is LWIR
if
(
small_sensors
[
chn
])
{
// current is LWIR
if
(
chn
!=
getLwir0
())
return
"sub-lwir-other"
;
if
(
chn
!=
getLwir0
())
return
full
?
"Subcamera LWIR other"
:
"sub-lwir-other"
;
if
(
getNumLwir
()
>
1
)
return
"sub-lwir0"
;
if
(
getNumLwir
()
>
1
)
return
full
?
"Subcamera LWIR 0"
:
"sub-lwir0"
;
return
"sub-lwir"
;
return
full
?
"Subcamera LWIR"
:
"sub-lwir"
;
}
else
{
// current is VNIR
}
else
{
// current is VNIR
if
(
chn
!=
getVnir0
())
return
"sub-vnir-other"
;
if
(
chn
!=
getVnir0
())
return
full
?
"Subcamera VNIR other"
:
"sub-vnir-other"
;
if
(
getNumVnir
()
>
1
)
return
"sub-vnir0"
;
if
(
getNumVnir
()
>
1
)
return
full
?
"Subcamera VNIR 0"
:
"sub-vnir0"
;
return
"sub-vnir"
;
return
full
?
"Subcamera VNIR"
:
"sub-vnir"
;
}
}
}
}
if
(
chn
!=
getVnir0
())
return
"sub-other"
;
if
(
chn
!=
getVnir0
())
return
full
?
"Subcamera other"
:
"sub-other"
;
return
"sub0"
;
return
full
?
"Subcamera 0"
:
"sub0"
;
}
}
// get subcamera index this one should copy parameters from (-1 if it is first in group
public
int
masterSub
(
int
chn
)
{
if
(
firstInGroup
(
chn
))
return
-
1
;
for
(
int
mchn
=
chn
-
1
;
mchn
>=
0
;
mchn
--)
{
if
(
firstInGroup
(
mchn
))
return
mchn
;
}
return
-
1
;
// should never get here
}
...
...
src/main/java/com/elphel/imagej/calibration/Distortions.java
View file @
d33f7855
...
@@ -780,9 +780,35 @@ public class Distortions {
...
@@ -780,9 +780,35 @@ public class Distortions {
int
[]
numPairs
=
calcNumPairs
();
int
[]
numPairs
=
calcNumPairs
();
int
[][]
imageSets
=
this
.
fittingStrategy
.
distortionCalibrationData
.
listImages
(
false
);
// true - only enabled images
int
[][]
imageSets
=
this
.
fittingStrategy
.
distortionCalibrationData
.
listImages
(
false
);
// true - only enabled images
int
[]
numSetPoints
=
new
int
[
imageSets
.
length
];
boolean
hasLWIR
=
this
.
fittingStrategy
.
distortionCalibrationData
.
hasSmallSensors
();
double
[]
rmsPerSet
=
new
double
[
imageSets
.
length
];
boolean
[]
hasNaNInSet
=
new
boolean
[
imageSets
.
length
];
int
[]
numSetPoints
=
new
int
[
imageSets
.
length
*(
hasLWIR
?
2
:
1
)];
double
[]
rmsPerSet
=
new
double
[
imageSets
.
length
*(
hasLWIR
?
2
:
1
)];
boolean
[]
hasNaNInSet
=
new
boolean
[
imageSets
.
length
*(
hasLWIR
?
2
:
1
)];
if
(
hasLWIR
)
{
for
(
int
setNum
=
0
;
setNum
<
imageSets
.
length
;
setNum
++){
double
[]
error2
=
{
0.0
,
0.0
};
int
[]
numInSet
=
{
0
,
0
};
hasNaNInSet
[
2
*
setNum
]=
false
;
hasNaNInSet
[
2
*
setNum
+
1
]=
false
;
for
(
int
imgInSet
=
0
;
imgInSet
<
imageSets
[
setNum
].
length
;
imgInSet
++)
{
int
imgNum
=
imageSets
[
setNum
][
imgInSet
];
int
isLwir
=
this
.
fittingStrategy
.
distortionCalibrationData
.
isSmallSensor
(
imgNum
)?
1
:
0
;
int
num
=
numPairs
[
imgNum
];
if
(
Double
.
isNaN
(
errors
[
imgNum
])){
hasNaNInSet
[
2
*
setNum
+
isLwir
]=
true
;
}
else
{
error2
[
isLwir
]+=
errors
[
imgNum
]*
errors
[
imgNum
]*
num
;
numInSet
[
isLwir
]+=
num
;
}
}
numSetPoints
[
2
*
setNum
+
0
]=
numInSet
[
0
];
rmsPerSet
[
2
*
setNum
+
0
]=
Math
.
sqrt
(
error2
[
0
]/
numInSet
[
0
]);
numSetPoints
[
2
*
setNum
+
1
]=
numInSet
[
1
];
rmsPerSet
[
2
*
setNum
+
1
]=
Math
.
sqrt
(
error2
[
1
]/
numInSet
[
1
]);
}
}
else
{
for
(
int
setNum
=
0
;
setNum
<
imageSets
.
length
;
setNum
++){
for
(
int
setNum
=
0
;
setNum
<
imageSets
.
length
;
setNum
++){
double
error2
=
0.0
;
double
error2
=
0.0
;
int
numInSet
=
0
;
int
numInSet
=
0
;
...
@@ -800,6 +826,7 @@ public class Distortions {
...
@@ -800,6 +826,7 @@ public class Distortions {
numSetPoints
[
setNum
]=
numInSet
;
numSetPoints
[
setNum
]=
numInSet
;
rmsPerSet
[
setNum
]=
Math
.
sqrt
(
error2
/
numInSet
);
rmsPerSet
[
setNum
]=
Math
.
sqrt
(
error2
/
numInSet
);
}
}
}
this
.
fittingStrategy
.
distortionCalibrationData
.
listImageSet
(
this
.
fittingStrategy
.
distortionCalibrationData
.
listImageSet
(
mode
,
mode
,
numSetPoints
,
numSetPoints
,
...
...
src/main/java/com/elphel/imagej/calibration/FittingStrategy.java
View file @
d33f7855
This diff is collapsed.
Click to expand it.
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