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
9c63f90b
Commit
9c63f90b
authored
Jun 15, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lwir-distort' of git.elphel.com:Elphel/imagej-elphel into lwir-distort
parents
7f44490f
3b485572
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1239 additions
and
687 deletions
+1239
-687
Aberration_Calibration.java
...com/elphel/imagej/calibration/Aberration_Calibration.java
+388
-398
DistortionCalibrationData.java
.../elphel/imagej/calibration/DistortionCalibrationData.java
+1
-0
Distortions.java
src/main/java/com/elphel/imagej/calibration/Distortions.java
+228
-46
EyesisAberrations.java
...java/com/elphel/imagej/calibration/EyesisAberrations.java
+13
-6
Goniometer.java
src/main/java/com/elphel/imagej/calibration/Goniometer.java
+18
-32
LensAdjustment.java
...in/java/com/elphel/imagej/calibration/LensAdjustment.java
+3
-2
MatchSimulatedPattern.java
.../com/elphel/imagej/calibration/MatchSimulatedPattern.java
+554
-199
EyesisCameraParameters.java
...ava/com/elphel/imagej/cameras/EyesisCameraParameters.java
+4
-0
LwirReaderParameters.java
...ain/java/com/elphel/imagej/lwir/LwirReaderParameters.java
+14
-4
ImagejJp4TiffMulti.java
...in/java/com/elphel/imagej/readers/ImagejJp4TiffMulti.java
+16
-0
No files found.
src/main/java/com/elphel/imagej/calibration/Aberration_Calibration.java
View file @
9c63f90b
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/calibration/DistortionCalibrationData.java
View file @
9c63f90b
...
...
@@ -96,6 +96,7 @@ import ij.text.TextWindow;
return
(
eyesisCameraParameters
==
null
)?
0
:
eyesisCameraParameters
.
getNumStations
();
}
public
double
getPixelSize
(
int
station
,
int
channel
)
{
return
this
.
eyesisCameraParameters
.
eyesisSubCameras
[
station
][
channel
].
getPixelSize
();
}
...
...
src/main/java/com/elphel/imagej/calibration/Distortions.java
View file @
9c63f90b
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/calibration/EyesisAberrations.java
View file @
9c63f90b
...
...
@@ -1248,10 +1248,16 @@ public class EyesisAberrations {
if
(
debugLevel
>
0
)
System
.
out
.
println
(
"Processing file #"
+(
imgNum
+
1
)+
" ( of "
+
files
.
length
+
") :"
+
files
[
imgNum
][
0
]);
ImagePlus
imp
=
new
ImagePlus
(
files
[
imgNum
][
0
]);
// read source file
JP4_INSTANCE
.
decodeProperiesFromInfo
(
imp
);
boolean
is_lwir
=
lwirReaderParameters
.
is_LWIR
(
imp
);
int
fft_size
=
is_lwir
?
distortionParameters
.
FFTSize_lwir
:
distortionParameters
.
FFTSize
;
int
fft_overlap
=
is_lwir
?
distortionParameters
.
FFTOverlap_lwir
:
distortionParameters
.
FFTOverlap
;
imp
.
setProperty
(
"MONOCHROME"
,
""
+
is_lwir
);
// boolean is_lwir = lwirReaderParameters.is_LWIR(imp);
int
sensor_type
=
LwirReaderParameters
.
sensorType
(
imp
);
// int fft_size = is_lwir ? distortionParameters.FFTSize_lwir : distortionParameters.FFTSize;
// int fft_overlap = is_lwir ? distortionParameters.FFTOverlap_lwir : distortionParameters.FFTOverlap;
int
fft_size
=
distortionParameters
.
getFFTSize
(
sensor_type
);
int
fft_overlap
=
distortionParameters
.
getFFTOverlap
(
sensor_type
);
imp
.
setProperty
(
"MONOCHROME"
,
""
+(
sensor_type
==
1
));
// pad image to full sensor size
int
numGridImage
=
fileIndices
[
imgNum
];
int
chn
=
distortions
.
fittingStrategy
.
distortionCalibrationData
.
gIP
[
numGridImage
].
getChannel
();
...
...
@@ -1261,7 +1267,8 @@ public class EyesisAberrations {
sensor_width_height
,
// eyesisCorrections.pixelMapping.sensors[srcChannel].getSensorWH(),
true
);
// boolean replicate);
// TODO: Add vignetting correction ?
MatchSimulatedPattern
matchSimulatedPattern
=
new
MatchSimulatedPattern
(
distortionParameters
.
FFTSize
);
// MatchSimulatedPattern matchSimulatedPattern= new MatchSimulatedPattern(distortionParameters.FFTSize);
MatchSimulatedPattern
matchSimulatedPattern
=
new
MatchSimulatedPattern
(
distortionParameters
.
getFFTSize
(
sensor_type
));
boolean
[]
correlationSizesUsed
=
null
;
float
[][]
simArray
=
null
;
...
...
@@ -1348,7 +1355,7 @@ public class EyesisAberrations {
fft_size
,
// FFT_SIZE, // int fft_size,
colorComponents
,
//COMPONENTS, // ColorComponents colorComponents,
PSF_subpixel
,
//PSF_SUBPIXEL, // int PSF_subpixel,
(
is_lwir
?
otfFilterParameters_lwir:
otfFilterParameters
),
(
(
sensor_type
==
1
)
?
otfFilterParameters_lwir:
otfFilterParameters
),
// otfFilterParameters, // OTF_FILTER, // OTFFilterParameters otfFilterParameters,
psfParameters
,
//PSF_PARS, // final PSFParameters psfParameters
psfParameters
.
minDefinedArea
,
//PSF_PARS.minDefinedArea, // final double minDefinedArea,
...
...
src/main/java/com/elphel/imagej/calibration/Goniometer.java
View file @
9c63f90b
...
...
@@ -632,6 +632,9 @@ horizontal axis:
int
nImg
=
indices
[
index
];
int
subCam
=
distortionCalibrationData
.
getImageChannel
(
images
[
nImg
]);
int
sensor_type
=
eyesisCameraParameters
.
getSensorType
(
subCam
);
// int stationNumber= distortionCalibrationData.getImageStation(numGridImage), // station number
double
timeStamp
=
distortionCalibrationData
.
getImageTimestamp
(
images
[
nImg
]);
...
...
@@ -673,7 +676,9 @@ horizontal axis:
if
(
this
.
debugLevel
>
1
)
lensDistortions
.
showHintGrid
(
hintGrid
);
MatchSimulatedPattern
matchSimulatedPattern
=
new
MatchSimulatedPattern
(
this
.
distortionParametersDefault
.
FFTSize
);
// new instance, all reset
/// MatchSimulatedPattern matchSimulatedPattern = new MatchSimulatedPattern(this.distortionParametersDefault.FFTSize); // new instance, all reset
MatchSimulatedPattern
matchSimulatedPattern
=
new
MatchSimulatedPattern
(
distortionParametersDefault
.
getFFTSize
(
sensor_type
));
// new instance, all reset
//sensort_type
// next 2 lines are not needed for the new instance, but can be
// used alternatively if keeping it
matchSimulatedPattern
.
invalidateFlatFieldForGrid
();
// Reset Flat Filed calibration - different image.
...
...
@@ -690,7 +695,7 @@ horizontal axis:
", initial number of pointers was "
+
numPointers
);
}
//matchSimulatedPatterns[numSensor].getChannel(images[numSensor])+" ");
MatchSimulatedPattern
.
DistortionParameters
distortionParameters
=
modifyDistortionParameters
();
MatchSimulatedPattern
.
DistortionParameters
distortionParameters
=
modifyDistortionParameters
(
sensor_type
);
SimulationPattern
.
SimulParameters
simulParameters
=
modifySimulParameters
();
boolean
noMessageBoxes
=
true
;
...
...
@@ -729,34 +734,13 @@ horizontal axis:
}
/*
* private showDoubleFloatArrays SDFA_INSTANCE= new showDoubleFloatArrays(); // just for debugging?
this.SDFA_INSTANCE.showArrays(gridXYZCorr, getGridWidth(), getGridHeight(), true, "Grid corrections", titles);
*
gd.addChoice( // ArrayIndexOutOfBoundsException: 21
this.distortionCalibrationData.getParameterName(parIndex)+
" ("+sValue+" "+
this.distortionCalibrationData.getParameterUnits(parIndex)+")"+
(this.distortionCalibrationData.isSubcameraParameter(parIndex)?(" s"+subCam):"com "),
this.definedModes, this.definedModes[this.parameterMode[numSeries][i]]);
*
* this.parameterMode[numSeries][i]=gd.getNextChoiceIndex();
PatternParameters patternParameters, // should not be null
boolean equalizeGreens,
int threadsMax,
boolean updateStatus,
int debug_level) {// debug level used inside loops
*
*
*/
public
MatchSimulatedPattern
.
DistortionParameters
modifyDistortionParameters
(){
public
MatchSimulatedPattern
.
DistortionParameters
modifyDistortionParameters
(
int
sensor_type
){
MatchSimulatedPattern
.
DistortionParameters
distortionParameters
=
this
.
distortionParametersDefault
.
clone
();
distortionParameters
.
refineInPlace
=
false
;
distortionParameters
.
correlationMaxOffset
=
this
.
goniometerParameters
.
maxCorr
;
distortionParameters
.
correlationSize
=
this
.
goniometerParameters
.
correlationSize
;
// distortionParameters.correlationSize = this.goniometerParameters.correlationSize;
distortionParameters
.
setCorrelationSize
(
this
.
goniometerParameters
.
correlationSize
,
sensor_type
);
distortionParameters
.
correlationGaussWidth
=
this
.
goniometerParameters
.
correlationGaussWidth
;
distortionParameters
.
refineCorrelations
=
false
;
distortionParameters
.
fastCorrelationOnFirstPass
=
true
;
...
...
@@ -767,7 +751,8 @@ horizontal axis:
distortionParameters
.
flatFieldExpand
=
this
.
goniometerParameters
.
flatFieldExpand
;
distortionParameters
.
numberExtrapolated
=
1
;
// measuring distortions -
distortionParameters
.
correlationMinInitialContrast
=
this
.
goniometerParameters
.
correlationMinInitialContrast
;
distortionParameters
.
minimalPatternCluster
=
this
.
goniometerParameters
.
minimalPatternCluster
;
// distortionParameters.minimalPatternCluster=this.goniometerParameters.minimalPatternCluster;
distortionParameters
.
setMinimalPatternCluster
(
this
.
goniometerParameters
.
minimalPatternCluster
,
sensor_type
);
distortionParameters
.
scaleMinimalInitialContrast
=
this
.
goniometerParameters
.
scaleMinimalInitialContrast
;
distortionParameters
.
searchOverlap
=
this
.
goniometerParameters
.
searchOverlap
;
return
distortionParameters
;
...
...
@@ -781,7 +766,7 @@ horizontal axis:
return
simulParameters
;
}
public
double
[]
estimateOrientation
(
public
double
[]
estimateOrientation
(
// FIXME: Does not use LWIR parameters, assumes EO!
ImagePlus
[]
images
,
// last acquire images with number of pointers
// detected>0
DistortionCalibrationData
distortionCalibrationData
,
...
...
@@ -792,6 +777,7 @@ horizontal axis:
int
threadsMax
,
boolean
updateStatus
,
int
debug_level
)
{
// debug level used inside loops
int
sensor_type
=
0
;
// EO
long
startTime
=
System
.
nanoTime
();
if
(
lensDistortions
==
null
)
{
String
msg
=
"lensDistortions is not initialized"
;
...
...
@@ -801,7 +787,7 @@ horizontal axis:
// remove unneeded, copied from updateFocusGrid() Now it is not needed?
SimulationPattern
.
SimulParameters
simulParameters
=
modifySimulParameters
();
MatchSimulatedPattern
.
DistortionParameters
distortionParameters
=
modifyDistortionParameters
();
MatchSimulatedPattern
.
DistortionParameters
distortionParameters
=
modifyDistortionParameters
(
sensor_type
);
int
numImages
=
0
;
for
(
int
i
=
0
;
i
<
images
.
length
;
i
++)
...
...
@@ -834,8 +820,8 @@ horizontal axis:
for
(
int
numSensor
=
0
;
numSensor
<
images
.
length
;
numSensor
++)
if
(
images
[
numSensor
]
!=
null
)
{
// reset matchSimulatedPattern, so it will start from scratch
this
.
matchSimulatedPatterns
[
numSensor
]
=
new
MatchSimulatedPattern
(
this
.
distortionParametersDefault
.
FFTSize
);
// new instance, all reset
// this.matchSimulatedPatterns[numSensor] = new MatchSimulatedPattern( this.distortionParametersDefault.FFTSize); // new instance, all reset
this
.
matchSimulatedPatterns
[
numSensor
]
=
new
MatchSimulatedPattern
(
distortionParametersDefault
.
getFFTSize
(
sensor_type
)
);
// new instance, all reset
// next 2 lines are not needed for the new instance, but can be
// used alternatively if keeping it
this
.
matchSimulatedPatterns
[
numSensor
].
invalidateFlatFieldForGrid
();
// Reset Flat Filed calibration - different image.
...
...
src/main/java/com/elphel/imagej/calibration/LensAdjustment.java
View file @
9c63f90b
...
...
@@ -63,8 +63,9 @@ public class LensAdjustment {
distortionParameters
.
refineInPlace
=
false
;
distortionParameters
.
correlationMaxOffset
=
focusMeasurementParameters
.
maxCorr
;
distortionParameters
.
correlationSize
=
focusMeasurementParameters
.
correlationSize
;
int
sensor_type
=
0
;
// EO
// distortionParameters.correlationSize=focusMeasurementParameters.correlationSize;
distortionParameters
.
setCorrelationSize
(
focusMeasurementParameters
.
correlationSize
,
sensor_type
);
distortionParameters
.
correlationGaussWidth
=
focusMeasurementParameters
.
correlationGaussWidth
;
distortionParameters
.
refineCorrelations
=
false
;
distortionParameters
.
fastCorrelationOnFirstPass
=
true
;
...
...
src/main/java/com/elphel/imagej/calibration/MatchSimulatedPattern.java
View file @
9c63f90b
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/cameras/EyesisCameraParameters.java
View file @
9c63f90b
...
...
@@ -1407,6 +1407,10 @@ import ij.gui.GenericDialog;
return
eyesisSubCameras
[
0
][
ncam
].
isLWIR
();
}
public
int
getSensorType
(
int
ncam
)
{
return
eyesisSubCameras
[
0
][
ncam
].
isLWIR
()?
1
:
0
;
}
/**
* Setting default camera geometry parameters for LWIR16 prototype system
* @return false if number of cameras is not 20
...
...
src/main/java/com/elphel/imagej/lwir/LwirReaderParameters.java
View file @
9c63f90b
...
...
@@ -44,6 +44,7 @@ public class LwirReaderParameters {
public
final
static
int
[]
FFC_GROUPS
=
{
1
,
2
,
4
};
public
static
final
String
[]
SENSOR_TYPES
=
{
"EO"
,
"LWIR"
};
public
static
final
String
SENSOR_TYPE
=
"SENSOR_TYPE"
;
protected
static
int
MAX_LWIR_WIDTH
=
1024
;
//
private
boolean
parameters_updated
=
false
;
protected
String
camera_name
=
"Talon"
;
// "LWIR16";
...
...
@@ -73,7 +74,6 @@ public class LwirReaderParameters {
protected
double
eo_gain_rg
=
0.7705
;
// 1.116; halogen/fluorescent
protected
double
eo_gain_bg
=
2.401
;
// 1.476;
protected
boolean
[]
selected_channels
=
{
true
,
true
,
true
,
true
,
true
,
true
,
true
,
true
};
protected
int
max_lwir_width
=
1024
;
//
/*
protected double [] eo_exp_corr = {1.0, 1.0, 1.0, 1.0};
protected double [] eo_gcorr_rbgb = {
...
...
@@ -145,11 +145,11 @@ public class LwirReaderParameters {
return
20
;
}
public
boolean
is_LWIR
(
int
width
)
{
return
width
<=
max_lwir_width
;
public
static
boolean
is_LWIR
(
int
width
)
{
return
width
<=
MAX_LWIR_WIDTH
;
}
public
boolean
is_LWIR
(
ImagePlus
imp
){
public
static
boolean
is_LWIR
(
ImagePlus
imp
){
// See if image has LwirReaderParameters.SENSOR_TYPE property, then use is_LWIR(String property_value),
// if not - use old width property
if
(
imp
.
getProperty
(
"WOI_WIDTH"
)==
null
)
{
...
...
@@ -160,6 +160,16 @@ public class LwirReaderParameters {
}
return
is_LWIR
(
imp
.
getWidth
());
}
public
static
int
sensorType
(
ImagePlus
imp
)
{
if
(
imp
.
getProperty
(
"WOI_WIDTH"
)==
null
)
{
EyesisTiff
.
decodeProperiesFromInfo
(
imp
);
}
if
(
imp
.
getProperty
(
SENSOR_TYPE
)!=
null
)
{
return
(
is_LWIR
((
String
)
imp
.
getProperty
(
SENSOR_TYPE
)))?
1
:
0
;
}
return
is_LWIR
(
imp
.
getWidth
())?
1
:
0
;
}
public
int
getDebugLevel
()
{
return
this
.
debug_level
;
...
...
src/main/java/com/elphel/imagej/readers/ImagejJp4TiffMulti.java
View file @
9c63f90b
...
...
@@ -51,6 +51,22 @@ public class ImagejJp4TiffMulti {
final
boolean
scale
,
final
String
std
)
throws
IOException
,
FormatException
// std - include non-elphel properties with prefix std
{
return
getMultiImages
(
urls
,
imps
,
0.0
,
// final double timeout_sec,
scale
,
std
);
}
public
ImagePlus
[]
getMultiImages
(
final
String
[]
urls
,
final
ImagePlus
[]
imps
,
final
double
timeout_sec
,
final
boolean
scale
,
final
String
std
)
throws
IOException
,
FormatException
// std - include non-elphel properties with prefix std
{
// final ImagePlus [] imps = new ImagePlus [urls.length];
LOGGER
.
error
(
"Please ignore 'File has length 0 and may be corrupt' - caused by bioformat reading memory file"
);
final
Thread
[]
threads
=
newThreadArray
(
MAX_THREADS
);
...
...
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