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
5f0e3426
Commit
5f0e3426
authored
Jun 09, 2015
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more on 2-sensor focusing machine
parent
76bf54e4
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
236 additions
and
32 deletions
+236
-32
Aberration_Calibration.java
src/main/java/Aberration_Calibration.java
+85
-24
CalibrationHardwareInterface.java
src/main/java/CalibrationHardwareInterface.java
+10
-2
DistortionCalibrationData.java
src/main/java/DistortionCalibrationData.java
+61
-0
LensAdjustment.java
src/main/java/LensAdjustment.java
+72
-4
PatternParameters.java
src/main/java/PatternParameters.java
+8
-2
No files found.
src/main/java/Aberration_Calibration.java
View file @
5f0e3426
This diff is collapsed.
Click to expand it.
src/main/java/CalibrationHardwareInterface.java
View file @
5f0e3426
...
@@ -161,6 +161,8 @@ public class CalibrationHardwareInterface {
...
@@ -161,6 +161,8 @@ public class CalibrationHardwareInterface {
private
int
[][]
channelMap1
={
// ip index, channel number
private
int
[][]
channelMap1
={
// ip index, channel number
// {0,-1}}; // negative channel - single camera
// {0,-1}}; // negative channel - single camera
{
0
,
0
}};
// Try with 0
{
0
,
0
}};
// Try with 0
private
int
[][]
channelMap2
={
// ip index, channel number
{
0
,
0
},{
0
,
1
}};
private
int
[][]
channelMap3
={
// ip index, channel number
private
int
[][]
channelMap3
={
// ip index, channel number
// {0,-1}}; // negative channel - single camera
// {0,-1}}; // negative channel - single camera
{
0
,
0
},{
1
,
0
},{
2
,
0
}};
{
0
,
0
},{
1
,
0
},{
2
,
0
}};
...
@@ -260,9 +262,15 @@ public class CalibrationHardwareInterface {
...
@@ -260,9 +262,15 @@ public class CalibrationHardwareInterface {
private
void
initDefaultMap
(
int
size
){
private
void
initDefaultMap
(
int
size
){
this
.
channelMap
=
new
int
[
size
][];
this
.
channelMap
=
new
int
[
size
][];
this
.
flipImages
=
new
boolean
[
size
];
this
.
flipImages
=
new
boolean
[
size
];
if
(
size
==
1
)
{
if
(
size
==
1
)
{
// single camera - old lens focusing
this
.
channelMap
[
0
]=
channelMap1
[
0
].
clone
();
this
.
channelMap
[
0
]=
channelMap1
[
0
].
clone
();
this
.
flipImages
[
0
]=
true
;
this
.
flipImages
[
0
]=
true
;
}
else
if
(
size
==
2
){
// New lens focusing machine
this
.
channelMap
[
0
]=
channelMap2
[
0
].
clone
();
this
.
flipImages
[
0
]=
true
;
// main sensor under test
this
.
channelMap
[
1
]=
channelMap2
[
1
].
clone
();
this
.
flipImages
[
1
]=
false
;
// extra sensor for location
}
else
if
(
size
==
3
){
}
else
if
(
size
==
3
){
for
(
int
i
=
0
;
i
<
size
;
i
++){
for
(
int
i
=
0
;
i
<
size
;
i
++){
this
.
flipImages
[
i
]=
false
;
this
.
flipImages
[
i
]=
false
;
...
@@ -1829,7 +1837,7 @@ public class CalibrationHardwareInterface {
...
@@ -1829,7 +1837,7 @@ public class CalibrationHardwareInterface {
public
String
[]
groups
={
"heater"
,
"fan"
,
"light"
,
"light1"
,
"light2"
};
public
String
[]
groups
={
"heater"
,
"fan"
,
"light"
,
"light1"
,
"light2"
};
public
int
debugLevel
=
1
;
public
int
debugLevel
=
1
;
private
String
powerIP
=
"192.168.0.80"
;
private
String
powerIP
=
"192.168.0.80"
;
private
double
lightsDelay
=
5
.0
;
private
double
lightsDelay
=
1
.0
;
private
final
String
urlFormat
=
"http://%s/insteon/index.php?cmd=%s&group=%s×tamp=%d"
;
private
final
String
urlFormat
=
"http://%s/insteon/index.php?cmd=%s&group=%s×tamp=%d"
;
private
final
String
rootElement
=
"Document"
;
private
final
String
rootElement
=
"Document"
;
public
boolean
powerConrtolEnabled
=
false
;
public
boolean
powerConrtolEnabled
=
false
;
...
...
src/main/java/DistortionCalibrationData.java
View file @
5f0e3426
...
@@ -3123,6 +3123,67 @@ import org.apache.commons.configuration.XMLConfiguration;
...
@@ -3123,6 +3123,67 @@ import org.apache.commons.configuration.XMLConfiguration;
}
}
return
this
.
sensorMasks
;
return
this
.
sensorMasks
;
}
}
/**
* Create round mask inside the actual one, with the provided center. Blur result with the same sigma as original
* @param chn sensor number
* @param xCenter X of the center (before decimation)
* @param yCenter Y of the center (before decimation)
* @return this channel mask, also sets the round mask instead of the original
*/
public
double
[]
roundOffMask
(
int
chn
,
double
xCenter
,
double
yCenter
){
int
dWidth
=
(
eyesisCameraParameters
.
sensorWidth
-
1
)/
eyesisCameraParameters
.
decimateMasks
+
1
;
int
dHeight
=
(
eyesisCameraParameters
.
sensorHeight
-
1
)/
eyesisCameraParameters
.
decimateMasks
+
1
;
DoubleGaussianBlur
gb
=
new
DoubleGaussianBlur
();
int
iXC
=(
int
)
Math
.
round
(
xCenter
/
eyesisCameraParameters
.
decimateMasks
);
int
iYC
=(
int
)
Math
.
round
(
yCenter
/
eyesisCameraParameters
.
decimateMasks
);
// int dcW=eyesisCameraParameters.sensorWidth/eyesisCameraParameters.decimateMasks;
// int dcH=eyesisCameraParameters.sensorHeight/eyesisCameraParameters.decimateMasks;
double
r0
=
iXC
;
r0
=
Math
.
min
(
r0
,
iYC
);
r0
=
Math
.
min
(
r0
,
dWidth
-
iXC
);
r0
=
Math
.
min
(
r0
,
dHeight
-
iYC
);
int
ir02
=(
int
)
Math
.
round
(
r0
*
r0
);
System
.
out
.
println
(
"iXC="
+
iXC
);
System
.
out
.
println
(
"iYC="
+
iYC
);
System
.
out
.
println
(
"initial ir02="
+
ir02
+
"("
+
Math
.
sqrt
(
ir02
)+
")"
);
for
(
int
i
=
0
;
i
<
this
.
sensorMasks
[
chn
].
length
;
i
++)
if
(
this
.
sensorMasks
[
chn
][
i
]<
0.5
)
{
int
ix
=
(
i
%
dWidth
)
-
iXC
;
int
iy
=
(
i
/
dWidth
)
-
iYC
;
int
ir2
=
ix
*
ix
+
iy
*
iy
;
if
(
ir2
<
ir02
)
ir02
=
ir2
;
}
System
.
out
.
println
(
"second ir02="
+
ir02
+
"("
+
Math
.
sqrt
(
ir02
)+
")"
);
double
[]
mask
=
new
double
[
this
.
sensorMasks
[
chn
].
length
];
for
(
int
i
=
0
;
i
<
mask
.
length
;
i
++)
{
int
ix
=
(
i
%
dWidth
)
-
iXC
;
int
iy
=
(
i
/
dWidth
)
-
iYC
;
mask
[
i
]=((
ix
*
ix
+
iy
*
iy
)
>
ir02
)?
0.0
:
1.0
;
}
// blur result
double
[][]
preMask
=
preCalculateSingleImageMask
(
chn
,
eyesisCameraParameters
.
decimateMasks
,
eyesisCameraParameters
.
sensorWidth
,
eyesisCameraParameters
.
sensorHeight
,
eyesisCameraParameters
.
shrinkGridForMask
);
if
(
preMask
==
null
)
return
null
;
//nothing in this channel
double
rAverage
=
preMask
[
0
][
0
];
double
rAverageNum
=
preMask
[
0
][
1
];
if
(
rAverageNum
==
0.0
)
return
null
;
// nothing to blur/process for this channel
rAverage
/=
rAverageNum
;
// average distance to the fartherst node from the current
double
sigma
=
eyesisCameraParameters
.
maskBlurSigma
;
if
(
sigma
<
0
)
sigma
*=-
rAverage
;
gb
.
blurDouble
(
mask
,
dWidth
,
dHeight
,
sigma
/
eyesisCameraParameters
.
decimateMasks
,
sigma
/
eyesisCameraParameters
.
decimateMasks
,
0.01
);
for
(
int
i
=
0
;
i
<
mask
.
length
;
i
++){
this
.
sensorMasks
[
chn
][
i
]
=
Math
.
min
(
this
.
sensorMasks
[
chn
][
i
],
mask
[
i
]);
}
return
this
.
sensorMasks
[
chn
];
}
public
double
[]
calculateImageGridMask
(
int
imgNum
)
{
public
double
[]
calculateImageGridMask
(
int
imgNum
)
{
return
calculateImageGridMask
(
return
calculateImageGridMask
(
imgNum
,
imgNum
,
...
...
src/main/java/LensAdjustment.java
View file @
5f0e3426
This diff is collapsed.
Click to expand it.
src/main/java/PatternParameters.java
View file @
5f0e3426
...
@@ -888,6 +888,12 @@ import java.util.Properties;
...
@@ -888,6 +888,12 @@ import java.util.Properties;
if
(
nView
>=
this
.
photometricByView
[
station
].
length
){
// OOB 1// NUll pointer - need to run F-field first? (oob1 when grid had less than now
if
(
nView
>=
this
.
photometricByView
[
station
].
length
){
// OOB 1// NUll pointer - need to run F-field first? (oob1 when grid had less than now
nView
=
this
.
photometricByView
.
length
-
1
;
nView
=
this
.
photometricByView
.
length
-
1
;
}
}
if
(
index
>
this
.
photometricByView
[
station
][
nView
][
0
].
length
){
System
.
out
.
println
(
"getXYZMPE ("
+
u
+
","
+
v
+
","
+
station
+
","
+
channel
+
")"
);
System
.
out
.
println
(
"this.photometricByView[station][nView][0].length="
+
this
.
photometricByView
[
station
][
nView
][
0
].
length
);
System
.
out
.
println
(
"index="
+
index
+
" vView="
+
nView
);
System
.
out
.
println
();
}
double
[]
result
=
{
// null
double
[]
result
=
{
// null
this
.
gridGeometry
[
v1
][
u1
][
0
],
this
.
gridGeometry
[
v1
][
u1
][
0
],
...
@@ -895,7 +901,7 @@ import java.util.Properties;
...
@@ -895,7 +901,7 @@ import java.util.Properties;
// this.gridGeometry[v1][u1][2]+((this.stationZCorr!=null)?this.stationZCorr[v1][u1][station]:0.0), // per-station correction
// this.gridGeometry[v1][u1][2]+((this.stationZCorr!=null)?this.stationZCorr[v1][u1][station]:0.0), // per-station correction
this
.
gridGeometry
[
v1
][
u1
][
2
]+((
this
.
stationZCorr
!=
null
)?
this
.
stationZCorr
[
v1
][
u1
][
useStation
]:
0.0
),
// per-station correction
this
.
gridGeometry
[
v1
][
u1
][
2
]+((
this
.
stationZCorr
!=
null
)?
this
.
stationZCorr
[
v1
][
u1
][
useStation
]:
0.0
),
// per-station correction
this
.
gridGeometry
[
v1
][
u1
][
3
],
this
.
gridGeometry
[
v1
][
u1
][
3
],
this
.
photometricByView
[
station
][
nView
][
0
][
index
],
this
.
photometricByView
[
station
][
nView
][
0
][
index
],
// java.lang.ArrayIndexOutOfBoundsException: 14215
this
.
photometricByView
[
station
][
nView
][
1
][
index
],
this
.
photometricByView
[
station
][
nView
][
1
][
index
],
this
.
photometricByView
[
station
][
nView
][
2
][
index
],
this
.
photometricByView
[
station
][
nView
][
2
][
index
],
this
.
photometricByView
[
station
][
nView
][
3
][
index
],
this
.
photometricByView
[
station
][
nView
][
3
][
index
],
...
...
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