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
cde73fef
Commit
cde73fef
authored
Jun 04, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented 'neck' parameters (rotating/shifting camera as a whole), old bug fixes
parent
782eb01a
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
807 additions
and
487 deletions
+807
-487
Aberration_Calibration.java
...com/elphel/imagej/calibration/Aberration_Calibration.java
+17
-9
DistortionCalibrationData.java
.../elphel/imagej/calibration/DistortionCalibrationData.java
+182
-205
Distortions.java
src/main/java/com/elphel/imagej/calibration/Distortions.java
+80
-1
FittingStrategy.java
...n/java/com/elphel/imagej/calibration/FittingStrategy.java
+63
-38
LensDistortionParameters.java
...m/elphel/imagej/calibration/LensDistortionParameters.java
+283
-152
PatternParameters.java
...java/com/elphel/imagej/calibration/PatternParameters.java
+9
-2
EyesisCameraParameters.java
...ava/com/elphel/imagej/cameras/EyesisCameraParameters.java
+173
-80
No files found.
src/main/java/com/elphel/imagej/calibration/Aberration_Calibration.java
View file @
cde73fef
...
@@ -109,7 +109,7 @@ public class Aberration_Calibration extends PlugInFrame implements ActionListene
...
@@ -109,7 +109,7 @@ public class Aberration_Calibration extends PlugInFrame implements ActionListene
private Panel panelGoniometer;
private Panel panelGoniometer;
private Panel panelPixelMapping, panelStereo,panelStereo1;
private Panel panelPixelMapping, panelStereo,panelStereo1;
private Panel panelLWIR;
private Panel panelLWIR;
private Panel panelLWIR16;
//
private Panel panelLWIR16;
private ShowDoubleFloatArrays SDFA_INSTANCE; // just for debugging?
private ShowDoubleFloatArrays SDFA_INSTANCE; // just for debugging?
JP46_Reader_camera JP4_INSTANCE;
JP46_Reader_camera JP4_INSTANCE;
...
@@ -508,6 +508,9 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
...
@@ -508,6 +508,9 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
0.0,
0.0,
0.0,
0.0,
0.0, 0.0, 2360, //double [] GXYZ // coordinates (in mm) of the goniometer horizontal axis closest to the moving one in target system
0.0, 0.0, 2360, //double [] GXYZ // coordinates (in mm) of the goniometer horizontal axis closest to the moving one in target system
0.0,
0.0,
0.0, 0.0,
2592, // int sensorWidth= 2592;
2592, // int sensorWidth= 2592;
1936, //int sensorHeight= 1936;
1936, //int sensorHeight= 1936;
2, //int shrinkGridForMask=2; //shrink detected grids by one point for/vert this number of times before calculating masks
2, //int shrinkGridForMask=2; //shrink detected grids by one point for/vert this number of times before calculating masks
...
@@ -692,14 +695,15 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
...
@@ -692,14 +695,15 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
panelRun = new Panel();
panelRun = new Panel();
panelRun.setLayout(new GridLayout(1, 0, 5, 5));
panelRun.setLayout(new GridLayout(1, 0, 5, 5));
addButton("Process Calibration Files",panelRun);
addButton("Process Calibration Files",panelRun);
addButton("Save",panelRun);
addButton("Save",
panelRun);
addButton("Save Selected",panelRun);
addButton("Save Selected",
panelRun);
addButton("Restore",panelRun,color_restore);
addButton("Restore",
panelRun,color_restore);
addButton("Restore no autoload",panelRun);
addButton("Restore no autoload",panelRun);
addButton("Restore SFE Latest",panelRun,color_restore);
addButton("Properties clear", panelRun, color_stop);
addButton("List SFE",panelRun,color_report);
addButton("Restore SFE Latest", panelRun, color_restore);
addButton("Stop",panelRun,color_stop);
addButton("List SFE", panelRun,color_report);
addButton("Abort",panelRun,color_stop);
addButton("Stop", panelRun,color_stop);
addButton("Abort", panelRun,color_stop);
add(panelRun);
add(panelRun);
...
@@ -1257,6 +1261,10 @@ if (MORE_BUTTONS) {
...
@@ -1257,6 +1261,10 @@ if (MORE_BUTTONS) {
} else if (label.equals("Restore") || label.equals("Restore no autoload")) {
} else if (label.equals("Restore") || label.equals("Restore no autoload")) {
restore(label.equals("Restore no autoload"));
restore(label.equals("Restore no autoload"));
return;
return;
/* ======================================================================== */
} else if (label.equals("Properties clear")) {
PROPERTIES=new Properties();
return;
/* ======================================================================== */
/* ======================================================================== */
} else if (label.equals("Process Calibration Files")) {
} else if (label.equals("Process Calibration Files")) {
processCalibrationFiles();
processCalibrationFiles();
...
@@ -5977,7 +5985,7 @@ if (MORE_BUTTONS) {
...
@@ -5977,7 +5985,7 @@ if (MORE_BUTTONS) {
return;
return;
}
}
GenericDialog gd=new GenericDialog ("Select list mode");
GenericDialog gd=new GenericDialog ("Select list mode");
gd.addNumericField("Mode 0 - pointers, 1 - shift/Rots, 2 - points/extra, 3 - rms", 3, 0);
gd.addNumericField("Mode 0 - pointers, 1 - shift/Rots, 2 - points/extra, 3 - rms
, 4 - image numbers
", 3, 0);
gd.showDialog();
gd.showDialog();
if (gd.wasCanceled()) return;
if (gd.wasCanceled()) return;
int listMode= (int) gd.getNextNumber();
int listMode= (int) gd.getNextNumber();
src/main/java/com/elphel/imagej/calibration/DistortionCalibrationData.java
View file @
cde73fef
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/calibration/Distortions.java
View file @
cde73fef
...
@@ -27,6 +27,7 @@ import java.awt.Point;
...
@@ -27,6 +27,7 @@ import java.awt.Point;
import
java.awt.Rectangle
;
import
java.awt.Rectangle
;
import
java.awt.geom.Point2D
;
import
java.awt.geom.Point2D
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
//import java.util.Arrays;
//import java.util.Arrays;
//import java.io.StringWriter;
//import java.io.StringWriter;
import
java.util.List
;
import
java.util.List
;
...
@@ -3321,10 +3322,12 @@ For each point in the image
...
@@ -3321,10 +3322,12 @@ For each point in the image
int
numSuccess
=
0
;
int
numSuccess
=
0
;
DistortionCalibrationData
dcd
=
fittingStrategy
.
distortionCalibrationData
;
DistortionCalibrationData
dcd
=
fittingStrategy
.
distortionCalibrationData
;
for
(
int
numGridImage
=
0
;
numGridImage
<
dcd
.
gIP
.
length
;
numGridImage
++)
{
for
(
int
numGridImage
=
0
;
numGridImage
<
dcd
.
gIP
.
length
;
numGridImage
++)
{
/*
if (numGridImage >= 1680) {
if (numGridImage >= 1680) {
System.out.println("Processing debug image "+numGridImage);
System.out.println("Processing debug image "+numGridImage);
System.out.println("Processing debug image "+numGridImage);
System.out.println("Processing debug image "+numGridImage);
}
}
*/
int
set_number
=
dcd
.
gIP
[
numGridImage
].
getSetNumber
();
int
set_number
=
dcd
.
gIP
[
numGridImage
].
getSetNumber
();
if
((
set_number
>=
start_set
)
&&
if
((
set_number
>=
start_set
)
&&
(
set_number
<=
end_set
)
&&
(
set_number
<=
end_set
)
&&
...
@@ -10747,17 +10750,31 @@ M * V = B
...
@@ -10747,17 +10750,31 @@ M * V = B
EyesisCameraParameters
eyesisCameraParameters
EyesisCameraParameters
eyesisCameraParameters
){
){
boolean
resetParametersToZero
=
false
;
boolean
resetParametersToZero
=
false
;
boolean
updateAllSubcameras
=
false
;
boolean
[]
parameterMask
=
new
boolean
[
distortionCalibrationData
.
getNumParameters
()];
boolean
[]
parameterMask
=
new
boolean
[
distortionCalibrationData
.
getNumParameters
()];
boolean
[]
channelMask
=
new
boolean
[
distortionCalibrationData
.
getNumSubCameras
()];
boolean
[]
channelMask
=
new
boolean
[
distortionCalibrationData
.
getNumSubCameras
()];
boolean
[]
stationMask
=
new
boolean
[
distortionCalibrationData
.
getNumStations
()];
boolean
[]
stationMask
=
new
boolean
[
distortionCalibrationData
.
getNumStations
()];
String
[]
source_stations
=
new
String
[
stationMask
.
length
+
1
];
source_stations
[
0
]
=
"---"
;
for
(
int
i
=
0
;
i
<
stationMask
.
length
;
i
++)
{
source_stations
[
i
+
1
]=
""
+
i
;
}
for
(
int
i
=
0
;
i
<
parameterMask
.
length
;
i
++)
parameterMask
[
i
]=
false
;
for
(
int
i
=
0
;
i
<
parameterMask
.
length
;
i
++)
parameterMask
[
i
]=
false
;
for
(
int
i
=
0
;
i
<
channelMask
.
length
;
i
++)
channelMask
[
i
]=
true
;
for
(
int
i
=
0
;
i
<
channelMask
.
length
;
i
++)
channelMask
[
i
]=
true
;
for
(
int
i
=
0
;
i
<
stationMask
.
length
;
i
++)
stationMask
[
i
]=
true
;
for
(
int
i
=
0
;
i
<
stationMask
.
length
;
i
++)
stationMask
[
i
]=
true
;
GenericDialog
gd
=
new
GenericDialog
(
"Update (new) image settings from known data"
);
GenericDialog
gd
=
new
GenericDialog
(
"Update (new) image settings from known data"
);
//
//
gd
.
addCheckbox
(
"Reset selected parameters to zero (false - update from camera parameters)"
,
resetParametersToZero
);
gd
.
addCheckbox
(
"Reset selected parameters to zero (false - update from camera parameters)"
,
resetParametersToZero
);
if
(
stationMask
.
length
>
1
)
{
gd
.
addChoice
(
"Copy selected parameters from tis station to all other stations"
,
source_stations
,
source_stations
[
0
]);
}
gd
.
addMessage
(
"Select which individual image parameters to be updated from the camera parameters (or reset to 0)"
);
gd
.
addMessage
(
"Select which individual image parameters to be updated from the camera parameters (or reset to 0)"
);
for
(
int
i
=
0
;
i
<
parameterMask
.
length
;
i
++)
gd
.
addCheckbox
(
i
+
": "
+
distortionCalibrationData
.
getParameterName
(
i
),
parameterMask
[
i
]);
gd
.
addCheckbox
(
"Update all subcamera parameters"
,
updateAllSubcameras
);
for
(
int
i
=
0
;
i
<
parameterMask
.
length
;
i
++)
{
gd
.
addCheckbox
(
i
+
": "
+
distortionCalibrationData
.
getParameterName
(
i
),
parameterMask
[
i
]);
}
gd
.
addMessage
(
"----------"
);
gd
.
addMessage
(
"----------"
);
gd
.
addMessage
(
"Select which channels (sub-cameras) to update"
);
gd
.
addMessage
(
"Select which channels (sub-cameras) to update"
);
for
(
int
i
=
0
;
i
<
channelMask
.
length
;
i
++)
gd
.
addCheckbox
(
"Subcamera "
+
i
,
channelMask
[
i
]);
for
(
int
i
=
0
;
i
<
channelMask
.
length
;
i
++)
gd
.
addCheckbox
(
"Subcamera "
+
i
,
channelMask
[
i
]);
...
@@ -10776,6 +10793,12 @@ M * V = B
...
@@ -10776,6 +10793,12 @@ M * V = B
gd
.
showDialog
();
gd
.
showDialog
();
if
(
gd
.
wasCanceled
())
return
false
;
if
(
gd
.
wasCanceled
())
return
false
;
resetParametersToZero
=
gd
.
getNextBoolean
();
resetParametersToZero
=
gd
.
getNextBoolean
();
int
source_station
=
-
1
;
if
(
stationMask
.
length
>
1
)
{
source_station
=
gd
.
getNextChoiceIndex
()
-
1
;
}
updateAllSubcameras
=
gd
.
getNextBoolean
();
for
(
int
i
=
0
;
i
<
parameterMask
.
length
;
i
++)
parameterMask
[
i
]=
gd
.
getNextBoolean
();
for
(
int
i
=
0
;
i
<
parameterMask
.
length
;
i
++)
parameterMask
[
i
]=
gd
.
getNextBoolean
();
for
(
int
i
=
0
;
i
<
channelMask
.
length
;
i
++)
channelMask
[
i
]=
gd
.
getNextBoolean
();
for
(
int
i
=
0
;
i
<
channelMask
.
length
;
i
++)
channelMask
[
i
]=
gd
.
getNextBoolean
();
if
(
stationMask
.
length
>
1
)
{
if
(
stationMask
.
length
>
1
)
{
...
@@ -10784,6 +10807,25 @@ M * V = B
...
@@ -10784,6 +10807,25 @@ M * V = B
boolean
updateFromTimestamps
=
gd
.
getNextBoolean
();
boolean
updateFromTimestamps
=
gd
.
getNextBoolean
();
boolean
allowClosest
=
gd
.
getNextBoolean
();
boolean
allowClosest
=
gd
.
getNextBoolean
();
boolean
reCenterVertically
=
gd
.
getNextBoolean
();
boolean
reCenterVertically
=
gd
.
getNextBoolean
();
if
(
updateAllSubcameras
)
{
resetParametersToZero
=
false
;
// just for safety
for
(
int
i
=
0
;
i
<
parameterMask
.
length
;
i
++)
{
parameterMask
[
i
]
|=
distortionCalibrationData
.
isSubcameraParameter
(
i
);
}
}
if
(
source_station
>=
0
)
{
updateOtherStations
(
eyesisCameraParameters
,
source_station
,
parameterMask
,
channelMask
,
stationMask
);
}
if
(
reCenterVertically
){
if
(
reCenterVertically
){
eyesisCameraParameters
.
recenterVertically
(
channelMask
,
stationMask
);
eyesisCameraParameters
.
recenterVertically
(
channelMask
,
stationMask
);
for
(
int
i
=
0
;
i
<
channelMask
.
length
;
i
++)
channelMask
[
i
]=
true
;
for
(
int
i
=
0
;
i
<
channelMask
.
length
;
i
++)
channelMask
[
i
]=
true
;
...
@@ -10904,6 +10946,38 @@ M * V = B
...
@@ -10904,6 +10946,38 @@ M * V = B
}
}
/**
* Update selected parameters from sourceStation to selected (stationMask) stations, filtered by channelMask
* @param eyesisCameraParameters
* @param sourceStation
* @param parameterMask
* @param channelMask
* @param stationMask
*/
public
void
updateOtherStations
(
EyesisCameraParameters
eyesisCameraParameters
,
int
sourceStation
,
boolean
[]
parameterMask
,
boolean
[]
channelMask
,
boolean
[]
stationMask
)
{
for
(
int
stationNumber
=
0
;
stationNumber
<
stationMask
.
length
;
stationNumber
++)
if
(
stationMask
[
stationNumber
])
{
for
(
int
subCam
=
0
;
subCam
<
channelMask
.
length
;
subCam
++)
if
(
channelMask
[
subCam
])
{
double
[]
oldVector
=
eyesisCameraParameters
.
getParametersVector
(
stationNumber
,
subCam
);
double
[]
newVector
=
eyesisCameraParameters
.
getParametersVector
(
sourceStation
,
subCam
);
for
(
int
j
=
0
;
j
<
oldVector
.
length
;
j
++)
if
(
parameterMask
[
j
]){
oldVector
[
j
]=
newVector
[
j
];
}
eyesisCameraParameters
.
setParametersVector
(
newVector
,
parameterMask
,
stationNumber
,
subCam
);
}
}
}
/**
/**
* Copies selected parameters from the camera parameters to per-image parameters (i.e. for new/previously disabled images)
* Copies selected parameters from the camera parameters to per-image parameters (i.e. for new/previously disabled images)
* @param distortionCalibrationData grid distortionCalibrationData
* @param distortionCalibrationData grid distortionCalibrationData
...
@@ -11078,6 +11152,10 @@ M * V = B
...
@@ -11078,6 +11152,10 @@ M * V = B
int
numSeries
=
allImages
?(-
1
):
this
.
fittingStrategy
.
currentSeriesNumber
;
int
numSeries
=
allImages
?(-
1
):
this
.
fittingStrategy
.
currentSeriesNumber
;
boolean
[]
selectedImages
=
fittingStrategy
.
selectedImages
(
numSeries
);
// all enabled
boolean
[]
selectedImages
=
fittingStrategy
.
selectedImages
(
numSeries
);
// all enabled
boolean
[]
selectedImagesDebug
=
null
;
boolean
[]
selectedImagesDebug
=
null
;
boolean
include_disabled
=
allImages
;
if
(
include_disabled
)
{
Arrays
.
fill
(
selectedImages
,
true
);
}
boolean
debugThis
=
false
;
boolean
debugThis
=
false
;
int
maxDebugImages
=
10
;
int
maxDebugImages
=
10
;
if
(
this
.
debugLevel
>
0
)
System
.
out
.
println
(
"updateCameraParametersFromCalculated("
+
allImages
+
")"
);
if
(
this
.
debugLevel
>
0
)
System
.
out
.
println
(
"updateCameraParametersFromCalculated("
+
allImages
+
")"
);
...
@@ -11108,6 +11186,7 @@ M * V = B
...
@@ -11108,6 +11186,7 @@ M * V = B
System
.
out
.
println
(
i
+
": "
+
fittingStrategy
.
distortionCalibrationData
.
getParameterName
(
i
)+
" = "
+
par
[
i
]);
System
.
out
.
println
(
i
+
": "
+
fittingStrategy
.
distortionCalibrationData
.
getParameterName
(
i
)+
" = "
+
par
[
i
]);
}
}
}
}
// System.out.println(numImg+"[21]: "+fittingStrategy.distortionCalibrationData.getParameterName(21)+" = "+par[21]);
}
}
if
(
this
.
debugLevel
>
1
)
System
.
out
.
println
(
"updateCameraParametersFromCalculated("
+
allImages
+
") for series="
+
numSeries
);
if
(
this
.
debugLevel
>
1
)
System
.
out
.
println
(
"updateCameraParametersFromCalculated("
+
allImages
+
") for series="
+
numSeries
);
// Next line is not needed anymore (will harm as will set orientationEstimated for all unselected sets)
// Next line is not needed anymore (will harm as will set orientationEstimated for all unselected sets)
...
...
src/main/java/com/elphel/imagej/calibration/FittingStrategy.java
View file @
cde73fef
...
@@ -669,6 +669,9 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -669,6 +669,9 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
*/
*/
public
int
buildParameterMap
(
int
numSeries
){
public
int
buildParameterMap
(
int
numSeries
){
return
buildParameterMap
(
numSeries
,
true
);
}
public
int
buildParameterMap
(
int
numSeries
,
boolean
mark_disabled
){
int
numPars
=
this
.
distortionCalibrationData
.
getNumParameters
();
int
numPars
=
this
.
distortionCalibrationData
.
getNumParameters
();
int
numImg
=
this
.
distortionCalibrationData
.
getNumImages
();
int
numImg
=
this
.
distortionCalibrationData
.
getNumImages
();
int
numTPars
=
this
.
parameterMode
[
numSeries
].
length
;
int
numTPars
=
this
.
parameterMode
[
numSeries
].
length
;
...
@@ -681,7 +684,11 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -681,7 +684,11 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
// int [][] tmpMap=new int[numTPars][3]; // temporary array parameterMap[][] (will be truncated)
// int [][] tmpMap=new int[numTPars][3]; // temporary array parameterMap[][] (will be truncated)
int
[][]
tmpMap
=
new
int
[
numPars
*
numImg
][
3
];
// temporary array parameterMap[][] (will be truncated)
int
[][]
tmpMap
=
new
int
[
numPars
*
numImg
][
3
];
// temporary array parameterMap[][] (will be truncated)
double
masterTS
=
this
.
distortionCalibrationData
.
getImageTimestamp
(
this
.
masterImages
[
numSeries
]);
// timestamp of the master image
double
masterTS
=
this
.
distortionCalibrationData
.
getImageTimestamp
(
this
.
masterImages
[
numSeries
]);
// timestamp of the master image
int
[]
masterVectorIndices
=
new
int
[
numTPars
];
int
[]
masterVectorIndices
=
new
int
[
numTPars
];
//[855]
// all but [4][21] are 0,[4][21] is 2 (modeSupercommon),
// [4][63,105,147,189,231,273,315,357,399,441,483,525,567,609,651,]=10
// [4][693]= 2 EO(==16)?
// [4][733,777,819]= 26
// iterate through all global/subcamera parameters
// iterate through all global/subcamera parameters
for
(
int
numTPar
=
0
;
numTPar
<
numTPars
;
numTPar
++)
if
(
this
.
parameterMode
[
numSeries
][
numTPar
]!=
modeFixed
){
// skip "fixed"
for
(
int
numTPar
=
0
;
numTPar
<
numTPars
;
numTPar
++)
if
(
this
.
parameterMode
[
numSeries
][
numTPar
]!=
modeFixed
){
// skip "fixed"
boolean
isCommon
=
boolean
isCommon
=
...
@@ -695,7 +702,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -695,7 +702,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
int
numPar
=
this
.
parameterList
[
numTPar
][
1
];
// number of per-image parameter for this total parameter index
int
numPar
=
this
.
parameterList
[
numTPar
][
1
];
// number of per-image parameter for this total parameter index
boolean
isSubCamera
=
this
.
distortionCalibrationData
.
isSubcameraParameter
(
numPar
);
boolean
isSubCamera
=
this
.
distortionCalibrationData
.
isSubcameraParameter
(
numPar
);
// is it "same as" ?
// is it "same as" ?
int
sameAs
=
this
.
parameterMode
[
numSeries
][
numTPar
]
-
this
.
definedModesAll
.
length
;
// number of subcamera to use
int
sameAs
=
this
.
parameterMode
[
numSeries
][
numTPar
]
-
this
.
definedModesAll
.
length
;
// number of subcamera to use
(this.definedModesAll.length==10)
int
numTParMaster
=
-
1
;
int
numTParMaster
=
-
1
;
int
vectorIndexMaster
=
-
1
;
int
vectorIndexMaster
=
-
1
;
if
(
sameAs
<
0
)
{
if
(
sameAs
<
0
)
{
...
@@ -713,20 +720,26 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -713,20 +720,26 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
vectorIndexMaster
=
masterVectorIndices
[
numTParMaster
];
// use as vectorIndex for slaves
vectorIndexMaster
=
masterVectorIndices
[
numTParMaster
];
// use as vectorIndex for slaves
}
}
if
(
this
.
debugLevel
>
2
)
System
.
out
.
println
(
"numTPar=
"
+
numTPar
+
" numSub="
+
numSub
+
" numPar="
+
numPar
+
" numTParMaster="
+
numTParMaster
);
if
(
this
.
debugLevel
>
2
)
System
.
out
.
println
(
"numTPa =
"
+
numTPar
+
" numSub="
+
numSub
+
" numPar="
+
numPar
+
" numTParMaster="
+
numTParMaster
);
// iterate through available images
// iterate through available images
for
(
int
numThisImg
=
0
;
numThisImg
<
numImg
;
numThisImg
++)
{
for
(
int
numThisImg
=
0
;
numThisImg
<
numImg
;
numThisImg
++)
{
if
((
selectedEnabledImages
[
numThisImg
])
&&
// if ((selectedEnabledImages[numThisImg]) &&
(!
isSubCamera
||
(
numSub
==
this
.
distortionCalibrationData
.
getImageSubcamera
(
numThisImg
)))
&&
// (!isSubCamera || (numSub==this.distortionCalibrationData.getImageSubcamera(numThisImg))) &&
// (this.reverseParameterMap[numThisImg][numPar]<0)){ // image used, this cell is not (yet) defined
if
((!
isSubCamera
||
(
numSub
==
this
.
distortionCalibrationData
.
getImageSubcamera
(
numThisImg
)))
&&
(
this
.
reverseParameterMap
[
numThisImg
][
numPar
]<
0
)){
// image used, this cell is not (yet) defined
(
this
.
reverseParameterMap
[
numThisImg
][
numPar
]<
0
)){
// image used, this cell is not (yet) defined
if
(
this
.
debugLevel
>
2
){
if
(
this
.
debugLevel
>
2
){
System
.
out
.
println
(
"buildParameterMap("
+
numSeries
+
"): numThisImg="
+
numThisImg
+
", numPar="
+
numPar
+
", vectorIndex="
+
vectorIndex
);
System
.
out
.
println
(
"buildParameterMap("
+
numSeries
+
"): numThisImg="
+
numThisImg
+
", numPar="
+
numPar
+
", vectorIndex="
+
vectorIndex
);
}
}
// is it "same as" ?
// is it "same as" ?
// "same as" is only applicable to subcamera parameters
if
(
vectorIndexMaster
>=
0
){
if
(
vectorIndexMaster
>=
0
){
if
(
mark_disabled
||
selectedEnabledImages
[
numThisImg
])
{
this
.
reverseParameterMap
[
numThisImg
][
numPar
]
=
vectorIndexMaster
;
this
.
reverseParameterMap
[
numThisImg
][
numPar
]
=
vectorIndexMaster
;
}
// does not look for same parameter in later images - leave it for the master?
// does not look for same parameter in later images - leave it for the master?
}
else
{
}
else
{
if
(
selectedEnabledImages
[
numThisImg
])
{
// assign it a new parameter
// assign it a new parameter
this
.
reverseParameterMap
[
numThisImg
][
numPar
]=
vectorIndex
;
this
.
reverseParameterMap
[
numThisImg
][
numPar
]=
vectorIndex
;
masterVectorIndices
[
numTPar
]
=
vectorIndex
;
masterVectorIndices
[
numTPar
]
=
vectorIndex
;
...
@@ -739,9 +752,14 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -739,9 +752,14 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
double
minDist
=
Math
.
abs
(
this
.
distortionCalibrationData
.
getImageTimestamp
(
numThisImg
)-
masterTS
);
double
minDist
=
Math
.
abs
(
this
.
distortionCalibrationData
.
getImageTimestamp
(
numThisImg
)-
masterTS
);
if
(
this
.
debugLevel
>
2
)
System
.
out
.
println
(
"vectorIndex="
+
vectorIndex
+
" numThisImg="
+
numThisImg
);
if
(
this
.
debugLevel
>
2
)
System
.
out
.
println
(
"vectorIndex="
+
vectorIndex
+
" numThisImg="
+
numThisImg
);
// see if same parameter in some other (later) image(s) is shared
// see if same parameter in some other (later) image(s) is shared
for
(
int
numOtherImg
=
numThisImg
+
1
;
numOtherImg
<
numImg
;
numOtherImg
++)
// for (int numOtherImg=numThisImg + 1; numOtherImg < numImg; numOtherImg++) {
if
((
selectedEnabledImages
[
numOtherImg
])
&&
// OOB 1
boolean
proc_disabled
=
mark_disabled
&&
(
isCommon
||
isStation
||
isGroup
);
(!
isSubCamera
||
(
numSub
==
this
.
distortionCalibrationData
.
getImageSubcamera
(
numOtherImg
)))
&&
for
(
int
numOtherImg
=
0
;
numOtherImg
<
numImg
;
numOtherImg
++)
{
// 06.03.2021: old way for enabled images - only assign to later images
// disabled or unselected images - assign to even earlier ones
if
((
selectedEnabledImages
[
numOtherImg
]
&&
(
numOtherImg
>
numThisImg
))
||
(
proc_disabled
&&
!
selectedEnabledImages
[
numOtherImg
]))
{
// if ((selectedEnabledImages[numOtherImg]) && // OOB 1
if
((!
isSubCamera
||
(
numSub
==
this
.
distortionCalibrationData
.
getImageSubcamera
(
numOtherImg
)))
&&
(
this
.
reverseParameterMap
[
numOtherImg
][
numPar
]<
0
)){
// image used, this cell is not (yet) defined
(
this
.
reverseParameterMap
[
numOtherImg
][
numPar
]<
0
)){
// image used, this cell is not (yet) defined
if
((
this
.
distortionCalibrationData
.
getImageTimestamp
(
numOtherImg
)==
thisTS
)
||
// same parameter same timestamp - same group even if is set differently
if
((
this
.
distortionCalibrationData
.
getImageTimestamp
(
numOtherImg
)==
thisTS
)
||
// same parameter same timestamp - same group even if is set differently
(
isStation
&&
(
this
.
distortionCalibrationData
.
gIP
[
numOtherImg
].
getStationNumber
()==
thisStation
))
||
// new
(
isStation
&&
(
this
.
distortionCalibrationData
.
gIP
[
numOtherImg
].
getStationNumber
()==
thisStation
))
||
// new
...
@@ -757,10 +775,15 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -757,10 +775,15 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
}
}
}
}
}
}
}
}
vectorIndex
++;
vectorIndex
++;
}
}
}
}
}
}
}
// second pass
}
}
// reverseParameterMap built, vectorIndex equals to the total number of parameters needed for fitting
// reverseParameterMap built, vectorIndex equals to the total number of parameters needed for fitting
...
@@ -1140,7 +1163,9 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -1140,7 +1163,9 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
" nSub="
+
nSub
+
" distortionCalibrationData.getImageSubcamera("
+
numImg
+
")="
+
distortionCalibrationData
.
getImageSubcamera
(
numImg
)+
" nSub="
+
nSub
+
" distortionCalibrationData.getImageSubcamera("
+
numImg
+
")="
+
distortionCalibrationData
.
getImageSubcamera
(
numImg
)+
" vector["
+
vPar
+
"]="
+
vector
[
vPar
]);
" vector["
+
vPar
+
"]="
+
vector
[
vPar
]);
}
}
if
((!
isSubCamera
)
||
(
nSub
==
this
.
distortionCalibrationData
.
getImageSubcamera
(
numImg
)))
{
// if ((!isSubCamera) || (nSub==this.distortionCalibrationData.getImageSubcamera(numImg))) {
if
((!
isSubCamera
)
||
(
nSub
==
this
.
distortionCalibrationData
.
getImageSubcamera
(
numImg
))
||
(
this
.
reverseParameterMap
[
numImg
][
nPar
]
==
vPar
))
{
// 06.03.2021
// this.distortionCalibrationData.pars[numImg][nPar]=vector[vPar];
// this.distortionCalibrationData.pars[numImg][nPar]=vector[vPar];
this
.
distortionCalibrationData
.
setParameterValue
(
numImg
,
nPar
,
vector
[
vPar
],
true
);
this
.
distortionCalibrationData
.
setParameterValue
(
numImg
,
nPar
,
vector
[
vPar
],
true
);
}
}
...
@@ -1170,7 +1195,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -1170,7 +1195,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
return
vector
;
return
vector
;
}
}
/**
/**
* Calculates which of all parameters for the particular sensor are to be adjusted (to reduce calcu
al
tions)
* Calculates which of all parameters for the particular sensor are to be adjusted (to reduce calcu
la
tions)
* @param numImg number of image
* @param numImg number of image
* @param vector parameters vector
* @param vector parameters vector
* @return mask vector to be used with the results of getImageParametersVector()
* @return mask vector to be used with the results of getImageParametersVector()
...
@@ -2334,7 +2359,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
...
@@ -2334,7 +2359,7 @@ I* - special case when the subcamera is being adjusted/replaced. How to deal wit
thisChoice
=
theseChoices
[
indx
];
thisChoice
=
theseChoices
[
indx
];
System
.
out
.
println
(
"selectStrategyStep(): this.parameterMode["
+
numSeries
+
"]["
+
i
+
"]="
+
this
.
parameterMode
[
numSeries
][
i
]+
" indx = "
+
indx
);
//
System.out.println("selectStrategyStep(): this.parameterMode["+numSeries+"]["+i+"]=" + this.parameterMode[numSeries][i]+" indx = "+indx);
}
}
gd
.
addChoice
(
// ArrayIndexOutOfBoundsException: 9
gd
.
addChoice
(
// ArrayIndexOutOfBoundsException: 9
(
this
.
distortionCalibrationData
.
isSubcameraParameter
(
parIndex
)?
""
:
"* "
)
+
(
this
.
distortionCalibrationData
.
isSubcameraParameter
(
parIndex
)?
""
:
"* "
)
+
...
...
src/main/java/com/elphel/imagej/calibration/LensDistortionParameters.java
View file @
cde73fef
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/calibration/PatternParameters.java
View file @
cde73fef
...
@@ -483,12 +483,19 @@ import ij.io.Opener;
...
@@ -483,12 +483,19 @@ import ij.io.Opener;
index
++;
index
++;
}
}
for
(
int
n
=
0
;
n
<
getNumGeometricChannels
();
n
++)
titles
[
n
]=
geometricTitles
[
n
];
for
(
int
n
=
0
;
n
<
getNumGeometricChannels
();
n
++)
titles
[
n
]=
geometricTitles
[
n
];
for
(
int
numStation
=
0
;
numStation
<
this
.
numStations
;
numStation
++)
{
for
(
int
numStation
=
0
;
numStation
<
this
.
numStations
;
numStation
++)
{
int
numStationSrc
=
numStation
;
if
(
numStationSrc
>=
this
.
photometricByView
.
length
)
{
System
.
out
.
println
(
"Station"
+
numStationSrc
+
" >= this.photometricByView.length, saving from the last known station"
);
numStationSrc
=
this
.
photometricByView
.
length
-
1
;
}
for
(
int
nView
=
0
;
nView
<
getNumViews
();
nView
++)
{
for
(
int
nView
=
0
;
nView
<
getNumViews
();
nView
++)
{
for
(
int
chn
=
0
;
chn
<
getNumPhotometricChannels
();
chn
++){
for
(
int
chn
=
0
;
chn
<
getNumPhotometricChannels
();
chn
++){
// int pixIndex=getNumGeometricChannels()+chn*this.getNumPhotometricChannels()();
// int pixIndex=getNumGeometricChannels()+chn*this.getNumPhotometricChannels()();
int
pixIndex
=
getNumGeometricChannels
()+
numZCorr
+(
nView
+
numStation
*
getNumViews
())
*
getNumPhotometricChannels
()+
chn
;
int
pixIndex
=
getNumGeometricChannels
()+
numZCorr
+(
nView
+
numStation
*
getNumViews
())
*
getNumPhotometricChannels
()+
chn
;
for
(
int
i
=
0
;
i
<
length
;
i
++)
pixels
[
pixIndex
][
i
]=
(
float
)
this
.
photometricByView
[
numStation
][
nView
][
chn
][
i
];
//OOB 8 //oob 12
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
pixels
[
pixIndex
][
i
]=
(
float
)
this
.
photometricByView
[
numStationSrc
][
nView
][
chn
][
i
];
//OOB 8 //oob 12
}
titles
[
pixIndex
]=
photometricTitles
[
chn
]+
nView
;
titles
[
pixIndex
]=
photometricTitles
[
chn
]+
nView
;
}
}
}
}
...
...
src/main/java/com/elphel/imagej/cameras/EyesisCameraParameters.java
View file @
cde73fef
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