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
93c3e515
Commit
93c3e515
authored
Nov 12, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added sesnor correction to progected grid
parent
5fdebd94
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
6 deletions
+50
-6
Aberration_Calibration.java
src/main/java/Aberration_Calibration.java
+2
-2
Distortions.java
src/main/java/Distortions.java
+20
-2
EyesisAberrations.java
src/main/java/EyesisAberrations.java
+28
-2
No files found.
src/main/java/Aberration_Calibration.java
View file @
93c3e515
...
@@ -1142,12 +1142,12 @@ if (MORE_BUTTONS) {
...
@@ -1142,12 +1142,12 @@ if (MORE_BUTTONS) {
}
}
if
(
LENS_DISTORTIONS
.
fittingStrategy
!=
null
)
{
// trying to fix restore
if
(
(
LENS_DISTORTIONS
.
fittingStrategy
!=
null
)
&&
ABERRATIONS_PARAMETERS
.
autoFilter
)
{
// trying to fix restore
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"LENS_DISTORTIONS.fittingStrategy != null -> Extra after loading"
);
if
(
DEBUG_LEVEL
>
0
)
System
.
out
.
println
(
"LENS_DISTORTIONS.fittingStrategy != null -> Extra after loading"
);
int
minGridsNoPointer
=
1000
;
int
minGridsNoPointer
=
1000
;
int
[]
numImages
=
DISTORTION_CALIBRATION_DATA
.
filterImages
(
int
[]
numImages
=
DISTORTION_CALIBRATION_DATA
.
filterImages
(
false
,
// resetHinted,
false
,
// resetHinted,
2
,
// minPointers,
0
,
//
2, // minPointers,
0.4
,
// minGridPeriod,
0.4
,
// minGridPeriod,
true
,
// disableNoVignetting,
true
,
// disableNoVignetting,
minGridsNoPointer
);
//minGridsNoPointer);
minGridsNoPointer
);
//minGridsNoPointer);
...
...
src/main/java/Distortions.java
View file @
93c3e515
...
@@ -3042,9 +3042,27 @@ For each point in the image
...
@@ -3042,9 +3042,27 @@ For each point in the image
// get photometrics here
// get photometrics here
return result;
return result;
}
/**
* Apply sesnor correction to the projected grid (generated by estimateGridOnSensor())
* @param gridOnSensor array [v][u][0- x, 1 - y, 2 - targetAbsolute-u, 3 - targetAbsolute-v]
* @param subCamera channel number
* @return true if the correction was applied (in-place) false if no correction is available
*/
public boolean correctGridOnSensor(
double [][][] gridOnSensor,
int subCamera){
if (this.pixelCorrection==null) return false;
for (double [][] row:gridOnSensor) for (double [] cell:row) if ((cell!=null) && (cell.length>1)){
double [] corrXYARGB=interpolateCorrectionVector ( // vector of {corrX, corrY, alpha, flatfield_red, flatfield_green, flatfield_blue}
subCamera, //int chnNum,
cell[0], //double px,
cell[1]); //double py)
cell[0]+=corrXYARGB[0]; // measured-> corrected : subtract, projected->simulated:add;
cell[1]+=corrXYARGB[1];
}
return true;
}
}
/**
/**
src/main/java/EyesisAberrations.java
View file @
93c3e515
...
@@ -1074,6 +1074,7 @@ public class EyesisAberrations {
...
@@ -1074,6 +1074,7 @@ public class EyesisAberrations {
){
){
Distortions
.
DistortionCalibrationData
distortionCalibrationData
=
distortions
.
fittingStrategy
.
distortionCalibrationData
;
Distortions
.
DistortionCalibrationData
distortionCalibrationData
=
distortions
.
fittingStrategy
.
distortionCalibrationData
;
boolean
partialToReprojected
=
this
.
aberrationParameters
.
partialToReprojected
;
boolean
partialToReprojected
=
this
.
aberrationParameters
.
partialToReprojected
;
boolean
applySensorCorrection
=
this
.
aberrationParameters
.
partialCorrectSensor
;
// this.distortions is set to top level LENS_DISTORTIONS
// this.distortions is set to top level LENS_DISTORTIONS
if
(
distortions
==
null
){
if
(
distortions
==
null
){
String
msg
=
"Distortions instance does not exist, exiting"
;
String
msg
=
"Distortions instance does not exist, exiting"
;
...
@@ -1254,7 +1255,16 @@ public class EyesisAberrations {
...
@@ -1254,7 +1255,16 @@ public class EyesisAberrations {
Double
.
NaN
,
// goniometerAxial, - not used
Double
.
NaN
,
// goniometerAxial, - not used
distortions
.
fittingStrategy
.
distortionCalibrationData
.
gIP
[
numGridImage
].
getSetNumber
(),
//imageSet,
distortions
.
fittingStrategy
.
distortionCalibrationData
.
gIP
[
numGridImage
].
getSetNumber
(),
//imageSet,
true
);
//filterBorder)
true
);
//filterBorder)
hintTolerance
=
5.0
;
// TO DO:set from configurable parameter
hintTolerance
=
5.0
;
// TODO:set from configurable parameter
if
(
applySensorCorrection
){
boolean
applied
=
distortions
.
correctGridOnSensor
(
projectedGrid
,
distortions
.
fittingStrategy
.
distortionCalibrationData
.
gIP
[
numGridImage
].
channel
);
if
(
debugLevel
>
0
)
{
if
(
applied
)
System
.
out
.
println
(
"Applied sensor correction to the projected grid"
);
else
System
.
out
.
println
(
"No sesnor correction available to apply to the projected grid"
);
}
}
}
}
int
rslt
=
matchSimulatedPattern
.
calculateDistortions
(
int
rslt
=
matchSimulatedPattern
.
calculateDistortions
(
...
@@ -1276,7 +1286,7 @@ public class EyesisAberrations {
...
@@ -1276,7 +1286,7 @@ public class EyesisAberrations {
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"calculateDistortions failed, returned error code "
+
rslt
+
" iRetry="
+
iRetry
+
" (of "
+
MaxRetries
+
")"
);
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"calculateDistortions failed, returned error code "
+
rslt
+
" iRetry="
+
iRetry
+
" (of "
+
MaxRetries
+
")"
);
continue
;
continue
;
}
}
// now replace extracted grid X,Y with projected
:
// now replace extracted grid X,Y with projected
(need to add sensor correction)
if
(
projectedGrid
!=
null
){
if
(
projectedGrid
!=
null
){
int
numReplaced
=
matchSimulatedPattern
.
replaceGridXYWithProjected
(
projectedGrid
);
int
numReplaced
=
matchSimulatedPattern
.
replaceGridXYWithProjected
(
projectedGrid
);
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Replaced extracted XY with projected ones for "
+
numReplaced
+
" nodes"
);
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Replaced extracted XY with projected ones for "
+
numReplaced
+
" nodes"
);
...
@@ -4451,9 +4461,11 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
...
@@ -4451,9 +4461,11 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
public
boolean
autoRestoreSensorOverwriteOrientation
=
true
;
// overwrite camera parameters from sensor calibration files
public
boolean
autoRestoreSensorOverwriteOrientation
=
true
;
// overwrite camera parameters from sensor calibration files
public
boolean
autoReCalibrate
=
true
;
// Re-calibrate grids on autoload
public
boolean
autoReCalibrate
=
true
;
// Re-calibrate grids on autoload
public
boolean
autoReCalibrateIgnoreLaser
=
false
;
// "Ignore laser pointers on recalibrate"
public
boolean
autoReCalibrateIgnoreLaser
=
false
;
// "Ignore laser pointers on recalibrate"
public
boolean
autoFilter
=
true
;
public
boolean
noMessageBoxes
=
true
;
public
boolean
noMessageBoxes
=
true
;
public
boolean
overwriteResultFiles
=
false
;
public
boolean
overwriteResultFiles
=
false
;
public
boolean
partialToReprojected
=
true
;
// Use reprojected grid for partial kernel calculation (false - use extracted)
public
boolean
partialToReprojected
=
true
;
// Use reprojected grid for partial kernel calculation (false - use extracted)
public
boolean
partialCorrectSensor
=
true
;
// Apply sensor correction to the projected grid
public
int
seriesNumber
=
0
;
public
int
seriesNumber
=
0
;
public
boolean
allImages
;
public
boolean
allImages
;
public
String
sourcePrefix
=
""
;
public
String
sourcePrefix
=
""
;
...
@@ -4484,9 +4496,12 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
...
@@ -4484,9 +4496,12 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
properties
.
setProperty
(
prefix
+
"autoRestoreSensorOverwriteOrientation"
,
this
.
autoRestoreSensorOverwriteOrientation
+
""
);
properties
.
setProperty
(
prefix
+
"autoRestoreSensorOverwriteOrientation"
,
this
.
autoRestoreSensorOverwriteOrientation
+
""
);
properties
.
setProperty
(
prefix
+
"autoReCalibrate"
,
this
.
autoReCalibrate
+
""
);
properties
.
setProperty
(
prefix
+
"autoReCalibrate"
,
this
.
autoReCalibrate
+
""
);
properties
.
setProperty
(
prefix
+
"autoReCalibrateIgnoreLaser"
,
this
.
autoReCalibrateIgnoreLaser
+
""
);
properties
.
setProperty
(
prefix
+
"autoReCalibrateIgnoreLaser"
,
this
.
autoReCalibrateIgnoreLaser
+
""
);
properties
.
setProperty
(
prefix
+
"autoFilter"
,
this
.
autoFilter
+
""
);
properties
.
setProperty
(
prefix
+
"noMessageBoxes"
,
this
.
noMessageBoxes
+
""
);
properties
.
setProperty
(
prefix
+
"noMessageBoxes"
,
this
.
noMessageBoxes
+
""
);
properties
.
setProperty
(
prefix
+
"overwriteResultFiles"
,
this
.
overwriteResultFiles
+
""
);
properties
.
setProperty
(
prefix
+
"overwriteResultFiles"
,
this
.
overwriteResultFiles
+
""
);
properties
.
setProperty
(
prefix
+
"partialToReprojected"
,
this
.
partialToReprojected
+
""
);
properties
.
setProperty
(
prefix
+
"partialToReprojected"
,
this
.
partialToReprojected
+
""
);
properties
.
setProperty
(
prefix
+
"partialCorrectSensor"
,
this
.
partialCorrectSensor
+
""
);
properties
.
setProperty
(
prefix
+
"seriesNumber"
,
this
.
seriesNumber
+
""
);
properties
.
setProperty
(
prefix
+
"seriesNumber"
,
this
.
seriesNumber
+
""
);
properties
.
setProperty
(
prefix
+
"allImages"
,
this
.
allImages
+
""
);
properties
.
setProperty
(
prefix
+
"allImages"
,
this
.
allImages
+
""
);
...
@@ -4524,9 +4539,15 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
...
@@ -4524,9 +4539,15 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
this
.
autoRestoreSensorOverwriteOrientation
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"autoRestoreSensorOverwriteOrientation"
));
this
.
autoRestoreSensorOverwriteOrientation
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"autoRestoreSensorOverwriteOrientation"
));
if
(
properties
.
getProperty
(
prefix
+
"autoReCalibrate"
)!=
null
)
this
.
autoReCalibrate
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"autoReCalibrate"
));
if
(
properties
.
getProperty
(
prefix
+
"autoReCalibrate"
)!=
null
)
this
.
autoReCalibrate
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"autoReCalibrate"
));
if
(
properties
.
getProperty
(
prefix
+
"autoReCalibrateIgnoreLaser"
)!=
null
)
this
.
autoReCalibrateIgnoreLaser
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"autoReCalibrateIgnoreLaser"
));
if
(
properties
.
getProperty
(
prefix
+
"autoReCalibrateIgnoreLaser"
)!=
null
)
this
.
autoReCalibrateIgnoreLaser
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"autoReCalibrateIgnoreLaser"
));
if
(
properties
.
getProperty
(
prefix
+
"autoFilter"
)!=
null
)
this
.
autoFilter
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"autoFilter"
));
if
(
properties
.
getProperty
(
prefix
+
"noMessageBoxes"
)!=
null
)
this
.
noMessageBoxes
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"noMessageBoxes"
));
if
(
properties
.
getProperty
(
prefix
+
"noMessageBoxes"
)!=
null
)
this
.
noMessageBoxes
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"noMessageBoxes"
));
if
(
properties
.
getProperty
(
prefix
+
"overwriteResultFiles"
)!=
null
)
this
.
overwriteResultFiles
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"overwriteResultFiles"
));
if
(
properties
.
getProperty
(
prefix
+
"overwriteResultFiles"
)!=
null
)
this
.
overwriteResultFiles
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"overwriteResultFiles"
));
if
(
properties
.
getProperty
(
prefix
+
"partialToReprojected"
)!=
null
)
this
.
partialToReprojected
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"partialToReprojected"
));
if
(
properties
.
getProperty
(
prefix
+
"partialToReprojected"
)!=
null
)
this
.
partialToReprojected
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"partialToReprojected"
));
if
(
properties
.
getProperty
(
prefix
+
"partialCorrectSensor"
)!=
null
)
this
.
partialCorrectSensor
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"partialCorrectSensor"
));
if
(
properties
.
getProperty
(
prefix
+
"seriesNumber"
)!=
null
)
this
.
seriesNumber
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"seriesNumber"
));
if
(
properties
.
getProperty
(
prefix
+
"seriesNumber"
)!=
null
)
this
.
seriesNumber
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"seriesNumber"
));
if
(
properties
.
getProperty
(
prefix
+
"allImages"
)!=
null
)
this
.
allImages
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"allImages"
));
if
(
properties
.
getProperty
(
prefix
+
"allImages"
)!=
null
)
this
.
allImages
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"allImages"
));
if
(
properties
.
getProperty
(
prefix
+
"sourcePrefix"
)!=
null
)
this
.
sourcePrefix
=
properties
.
getProperty
(
prefix
+
"sourcePrefix"
);
if
(
properties
.
getProperty
(
prefix
+
"sourcePrefix"
)!=
null
)
this
.
sourcePrefix
=
properties
.
getProperty
(
prefix
+
"sourcePrefix"
);
...
@@ -4659,6 +4680,8 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
...
@@ -4659,6 +4680,8 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
gd
.
addCheckbox
(
"Supress non-essential message boxes"
,
this
.
noMessageBoxes
);
gd
.
addCheckbox
(
"Supress non-essential message boxes"
,
this
.
noMessageBoxes
);
gd
.
addCheckbox
(
"Overwrite result files if they exist"
,
this
.
overwriteResultFiles
);
gd
.
addCheckbox
(
"Overwrite result files if they exist"
,
this
.
overwriteResultFiles
);
gd
.
addCheckbox
(
"Use reprojected grids for partial kernel calculation (false - extracted grids)"
,
this
.
partialToReprojected
);
gd
.
addCheckbox
(
"Use reprojected grids for partial kernel calculation (false - extracted grids)"
,
this
.
partialToReprojected
);
gd
.
addCheckbox
(
"Apply sensor correction during for partial kernel calculation"
,
this
.
partialCorrectSensor
);
gd
.
addNumericField
(
"Fitting series number to use for image selection"
,
this
.
seriesNumber
,
0
);
gd
.
addNumericField
(
"Fitting series number to use for image selection"
,
this
.
seriesNumber
,
0
);
gd
.
addCheckbox
(
"Process all enabled image files (false - use selected fitting series)"
,
this
.
allImages
);
gd
.
addCheckbox
(
"Process all enabled image files (false - use selected fitting series)"
,
this
.
allImages
);
gd
.
addMessage
(
"===== Autoload options (when restoring configuration) ====="
);
gd
.
addMessage
(
"===== Autoload options (when restoring configuration) ====="
);
...
@@ -4666,6 +4689,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
...
@@ -4666,6 +4689,7 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
gd
.
addCheckbox
(
"Overwrite SFE parameters from the sensor calibration files (at auto-load)"
,
this
.
autoRestoreSensorOverwriteOrientation
);
gd
.
addCheckbox
(
"Overwrite SFE parameters from the sensor calibration files (at auto-load)"
,
this
.
autoRestoreSensorOverwriteOrientation
);
gd
.
addCheckbox
(
"Re-calibrate grids on autoload"
,
this
.
autoReCalibrate
);
gd
.
addCheckbox
(
"Re-calibrate grids on autoload"
,
this
.
autoReCalibrate
);
gd
.
addCheckbox
(
"Ignore laser pointers on recalibrate"
,
this
.
autoReCalibrateIgnoreLaser
);
gd
.
addCheckbox
(
"Ignore laser pointers on recalibrate"
,
this
.
autoReCalibrateIgnoreLaser
);
gd
.
addCheckbox
(
"Filter grids after restore"
,
this
.
autoFilter
);
gd
.
addMessage
(
"Calibration: "
+(((
this
.
calibrationPath
==
null
)
||
(
this
.
calibrationPath
.
length
()==
0
))?
"not configured "
:(
this
.
calibrationPath
+
" "
))+
gd
.
addMessage
(
"Calibration: "
+(((
this
.
calibrationPath
==
null
)
||
(
this
.
calibrationPath
.
length
()==
0
))?
"not configured "
:(
this
.
calibrationPath
+
" "
))+
((
currentConfigs
[
0
]!=
null
)?(
"(current: "
+
currentConfigs
[
0
]+
")"
):(
""
)
));
((
currentConfigs
[
0
]!=
null
)?(
"(current: "
+
currentConfigs
[
0
]+
")"
):(
""
)
));
...
@@ -4704,12 +4728,14 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
...
@@ -4704,12 +4728,14 @@ if (globalDebugLevel>2)globalDebugLevel=0; //***********************************
this
.
noMessageBoxes
=
gd
.
getNextBoolean
();
this
.
noMessageBoxes
=
gd
.
getNextBoolean
();
this
.
overwriteResultFiles
=
gd
.
getNextBoolean
();
this
.
overwriteResultFiles
=
gd
.
getNextBoolean
();
this
.
partialToReprojected
=
gd
.
getNextBoolean
();
this
.
partialToReprojected
=
gd
.
getNextBoolean
();
this
.
partialCorrectSensor
=
gd
.
getNextBoolean
();
this
.
seriesNumber
=
(
int
)
gd
.
getNextNumber
();
this
.
seriesNumber
=
(
int
)
gd
.
getNextNumber
();
this
.
allImages
=
gd
.
getNextBoolean
();
this
.
allImages
=
gd
.
getNextBoolean
();
this
.
autoRestore
=
gd
.
getNextBoolean
();
this
.
autoRestore
=
gd
.
getNextBoolean
();
this
.
autoRestoreSensorOverwriteOrientation
=
gd
.
getNextBoolean
();
this
.
autoRestoreSensorOverwriteOrientation
=
gd
.
getNextBoolean
();
this
.
autoReCalibrate
=
gd
.
getNextBoolean
();
this
.
autoReCalibrate
=
gd
.
getNextBoolean
();
this
.
autoReCalibrateIgnoreLaser
=
gd
.
getNextBoolean
();
this
.
autoReCalibrateIgnoreLaser
=
gd
.
getNextBoolean
();
this
.
autoFilter
=
gd
.
getNextBoolean
();
if
(
gd
.
getNextBoolean
())
{
if
(
gd
.
getNextBoolean
())
{
if
(
currentConfigs
[
0
]!=
null
)
this
.
calibrationPath
=
currentConfigs
[
0
];
if
(
currentConfigs
[
0
]!=
null
)
this
.
calibrationPath
=
currentConfigs
[
0
];
...
...
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