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
56b7ed16
Commit
56b7ed16
authored
Jan 11, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
combining with vignetting correction
parent
f96b0aec
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
483 additions
and
110 deletions
+483
-110
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+13
-1
EyesisCorrections.java
src/main/java/EyesisCorrections.java
+3
-1
EyesisDCT.java
src/main/java/EyesisDCT.java
+359
-107
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+107
-0
ImageDtt.java
src/main/java/ImageDtt.java
+1
-1
No files found.
src/main/java/EyesisCorrectionParameters.java
View file @
56b7ed16
...
@@ -1800,6 +1800,9 @@ public class EyesisCorrectionParameters {
...
@@ -1800,6 +1800,9 @@ public class EyesisCorrectionParameters {
public
boolean
normalize
=
true
;
//normalize both sym and asym kernels (asym to have sum==1, sym to have sum = dct_size
public
boolean
normalize
=
true
;
//normalize both sym and asym kernels (asym to have sum==1, sym to have sum = dct_size
public
boolean
skip_sym
=
false
;
// do not apply symmetrical correction
public
boolean
skip_sym
=
false
;
// do not apply symmetrical correction
public
boolean
convolve_direct
=
false
;
// do not apply symmetrical correction
public
boolean
convolve_direct
=
false
;
// do not apply symmetrical correction
public
double
vignetting_max
=
0.4
;
// value in vignetting data to correspond to 1x in the kernel
public
double
vignetting_range
=
3.0
;
// do not try to correct vignetting less than vignetting_max/vignetting_range
public
DCTParameters
(
public
DCTParameters
(
int
dct_size
,
int
dct_size
,
...
@@ -1852,6 +1855,8 @@ public class EyesisCorrectionParameters {
...
@@ -1852,6 +1855,8 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"normalize"
,
this
.
normalize
+
""
);
properties
.
setProperty
(
prefix
+
"normalize"
,
this
.
normalize
+
""
);
properties
.
setProperty
(
prefix
+
"skip_sym"
,
this
.
skip_sym
+
""
);
properties
.
setProperty
(
prefix
+
"skip_sym"
,
this
.
skip_sym
+
""
);
properties
.
setProperty
(
prefix
+
"convolve_direct"
,
this
.
convolve_direct
+
""
);
properties
.
setProperty
(
prefix
+
"convolve_direct"
,
this
.
convolve_direct
+
""
);
properties
.
setProperty
(
prefix
+
"vignetting_max"
,
this
.
vignetting_max
+
""
);
properties
.
setProperty
(
prefix
+
"vignetting_range"
,
this
.
vignetting_range
+
""
);
}
}
public
void
getProperties
(
String
prefix
,
Properties
properties
){
public
void
getProperties
(
String
prefix
,
Properties
properties
){
...
@@ -1887,6 +1892,8 @@ public class EyesisCorrectionParameters {
...
@@ -1887,6 +1892,8 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"normalize"
)!=
null
)
this
.
normalize
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"normalize"
));
if
(
properties
.
getProperty
(
prefix
+
"normalize"
)!=
null
)
this
.
normalize
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"normalize"
));
if
(
properties
.
getProperty
(
prefix
+
"skip_sym"
)!=
null
)
this
.
skip_sym
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"skip_sym"
));
if
(
properties
.
getProperty
(
prefix
+
"skip_sym"
)!=
null
)
this
.
skip_sym
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"skip_sym"
));
if
(
properties
.
getProperty
(
prefix
+
"convolve_direct"
)!=
null
)
this
.
convolve_direct
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"convolve_direct"
));
if
(
properties
.
getProperty
(
prefix
+
"convolve_direct"
)!=
null
)
this
.
convolve_direct
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"convolve_direct"
));
if
(
properties
.
getProperty
(
prefix
+
"vignetting_max"
)!=
null
)
this
.
vignetting_max
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"vignetting_max"
));
if
(
properties
.
getProperty
(
prefix
+
"vignetting_range"
)!=
null
)
this
.
vignetting_range
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"vignetting_range"
));
}
}
public
boolean
showDialog
()
{
public
boolean
showDialog
()
{
...
@@ -1923,7 +1930,10 @@ public class EyesisCorrectionParameters {
...
@@ -1923,7 +1930,10 @@ public class EyesisCorrectionParameters {
gd
.
addCheckbox
(
"Normalize both sym and asym kernels "
,
this
.
normalize
);
gd
.
addCheckbox
(
"Normalize both sym and asym kernels "
,
this
.
normalize
);
gd
.
addCheckbox
(
"Do not apply symmetrical (DCT) correction "
,
this
.
skip_sym
);
gd
.
addCheckbox
(
"Do not apply symmetrical (DCT) correction "
,
this
.
skip_sym
);
gd
.
addCheckbox
(
"Convolve directly with symmetrical kernel (debug feature) "
,
this
.
convolve_direct
);
gd
.
addCheckbox
(
"Convolve directly with symmetrical kernel (debug feature) "
,
this
.
convolve_direct
);
gd
.
addNumericField
(
"Value (max) in vignetting data to correspond to 1x in the kernel"
,
this
.
vignetting_max
,
3
);
gd
.
addNumericField
(
"Do not try to correct vignetting smaller than this fraction of max"
,
this
.
vignetting_range
,
3
);
WindowTools
.
addScrollBars
(
gd
);
gd
.
showDialog
();
gd
.
showDialog
();
if
(
gd
.
wasCanceled
())
return
false
;
if
(
gd
.
wasCanceled
())
return
false
;
...
@@ -1958,7 +1968,9 @@ public class EyesisCorrectionParameters {
...
@@ -1958,7 +1968,9 @@ public class EyesisCorrectionParameters {
this
.
kernel_chn
=
(
int
)
gd
.
getNextNumber
();
this
.
kernel_chn
=
(
int
)
gd
.
getNextNumber
();
this
.
normalize
=
gd
.
getNextBoolean
();
this
.
normalize
=
gd
.
getNextBoolean
();
this
.
skip_sym
=
gd
.
getNextBoolean
();
this
.
skip_sym
=
gd
.
getNextBoolean
();
this
.
convolve_direct
=
gd
.
getNextBoolean
();
this
.
convolve_direct
=
gd
.
getNextBoolean
();
this
.
vignetting_max
=
gd
.
getNextNumber
();
this
.
vignetting_range
=
gd
.
getNextNumber
();
// MASTER_DEBUG_LEVEL= (int) gd.getNextNumber();
// MASTER_DEBUG_LEVEL= (int) gd.getNextNumber();
return
true
;
return
true
;
}
}
...
...
src/main/java/EyesisCorrections.java
View file @
56b7ed16
...
@@ -2234,7 +2234,8 @@ public class EyesisCorrections {
...
@@ -2234,7 +2234,8 @@ public class EyesisCorrections {
return
mask
;
return
mask
;
}
}
/* ======================================================================== */
/* ======================================================================== */
private
void
saveAndShow
(
// private void saveAndShow(
public
void
saveAndShow
(
ImagePlus
imp
,
ImagePlus
imp
,
EyesisCorrectionParameters
.
CorrectionParameters
correctionsParameters
){
EyesisCorrectionParameters
.
CorrectionParameters
correctionsParameters
){
saveAndShowEnable
(
imp
,
correctionsParameters
,
true
,
true
);
saveAndShowEnable
(
imp
,
correctionsParameters
,
true
,
true
);
...
@@ -2254,6 +2255,7 @@ public class EyesisCorrections {
...
@@ -2254,6 +2255,7 @@ public class EyesisCorrections {
}
}
private
void
saveAndShow
(
private
void
saveAndShow
(
// public void saveAndShow(
ImagePlus
imp
,
ImagePlus
imp
,
EyesisCorrectionParameters
.
CorrectionParameters
correctionsParameters
,
EyesisCorrectionParameters
.
CorrectionParameters
correctionsParameters
,
boolean
save
,
boolean
save
,
...
...
src/main/java/EyesisDCT.java
View file @
56b7ed16
This diff is collapsed.
Click to expand it.
src/main/java/Eyesis_Correction.java
View file @
56b7ed16
...
@@ -462,6 +462,8 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
...
@@ -462,6 +462,8 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
addButton
(
"Select kernels image"
,
panelDct1
,
color_configure
);
addButton
(
"Select kernels image"
,
panelDct1
,
color_configure
);
addButton
(
"Create DCT kernels"
,
panelDct1
,
color_process
);
addButton
(
"Create DCT kernels"
,
panelDct1
,
color_process
);
addButton
(
"Read DCT kernels"
,
panelDct1
,
color_process
);
addButton
(
"Read DCT kernels"
,
panelDct1
,
color_process
);
addButton
(
"Setup DCT parameters"
,
panelDct1
,
color_configure
);
addButton
(
"DCT process files"
,
panelDct1
,
color_process
);
add
(
panelDct1
);
add
(
panelDct1
);
}
}
pack
();
pack
();
...
@@ -2781,8 +2783,110 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
...
@@ -2781,8 +2783,110 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
true
,
true
,
DBG_IMP
.
getTitle
()+
"-IDCTDC"
);
DBG_IMP
.
getTitle
()+
"-IDCTDC"
);
return
;
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Setup DCT parameters"
))
{
DCT_PARAMETERS
.
showDialog
();
return
;
/* ======================================================================== */
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"DCT process files"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
if
(
EYESIS_DCT
==
null
){
EYESIS_DCT
=
new
EyesisDCT
(
EYESIS_CORRECTIONS
,
CORRECTION_PARAMETERS
,
DCT_PARAMETERS
);
if
(
DEBUG_LEVEL
>
0
){
System
.
out
.
println
(
"Created new EyesisDCT instance, will need to read DCT kernels"
);
}
}
String
configPath
=
null
;
if
(
EYESIS_CORRECTIONS
.
correctionsParameters
.
saveSettings
)
{
configPath
=
EYESIS_CORRECTIONS
.
correctionsParameters
.
selectResultsDirectory
(
true
,
true
);
if
(
configPath
==
null
){
String
msg
=
"No results directory selected, command aborted"
;
System
.
out
.
println
(
"Warning: "
+
msg
);
IJ
.
showMessage
(
"Warning"
,
msg
);
return
;
}
configPath
+=
Prefs
.
getFileSeparator
()+
"autoconfig"
;
try
{
saveTimestampedProperties
(
configPath
,
// full path or null
null
,
// use as default directory if path==null
true
,
PROPERTIES
);
}
catch
(
Exception
e
){
String
msg
=
"Failed to save configuration to "
+
configPath
+
", command aborted"
;
System
.
out
.
println
(
"Error: "
+
msg
);
IJ
.
showMessage
(
"Error"
,
msg
);
return
;
}
}
EYESIS_CORRECTIONS
.
initSensorFiles
(
DEBUG_LEVEL
);
int
numChannels
=
EYESIS_CORRECTIONS
.
getNumChannels
();
NONLIN_PARAMETERS
.
modifyNumChannels
(
numChannels
);
CHANNEL_GAINS_PARAMETERS
.
modifyNumChannels
(
numChannels
);
/*
if (CORRECTION_PARAMETERS.deconvolve && (NONLIN_PARAMETERS.noiseGainPower!=0)) {
EYESIS_CORRECTIONS.updateImageNoiseGains(
NONLIN_PARAMETERS, //EyesisCorrectionParameters.NonlinParameters nonlinParameters,
CONVOLVE_FFT_SIZE, //int fftSize, // 128 - fft size, kernel size should be size/2
THREADS_MAX, // int threadsMax, // maximal number of threads to launch
UPDATE_STATUS, // boolean updateStatus,
DEBUG_LEVEL); //int globalDebugLevel){
}
*/
if
(!
EYESIS_DCT
.
DCTKernelsAvailable
()){
if
(
DEBUG_LEVEL
>
0
){
System
.
out
.
println
(
"Reading/converting DCT kernels"
);
}
EYESIS_DCT
.
readDCTKernels
(
DCT_PARAMETERS
,
CONVOLVE_FFT_SIZE
/
2
,
THREADS_MAX
,
UPDATE_STATUS
,
// update status info
DEBUG_LEVEL
);
if
(
DEBUG_LEVEL
>
1
){
EYESIS_DCT
.
showKernels
();
// show restored kernels
}
}
// EYESIS_CORRECTIONS.processChannelImages(
EYESIS_DCT
.
processDCTChannelImages
(
// SPLIT_PARAMETERS, // EyesisCorrectionParameters.SplitParameters splitParameters,
DCT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS
,
//EyesisCorrectionParameters.DebayerParameters debayerParameters,
NONLIN_PARAMETERS
,
//EyesisCorrectionParameters.NonlinParameters nonlinParameters,
COLOR_PROC_PARAMETERS
,
//EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CHANNEL_GAINS_PARAMETERS
,
//CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS
,
//EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS
,
// EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
CONVOLVE_FFT_SIZE
,
//int convolveFFTSize, // 128 - fft size, kernel size should be size/2
THREADS_MAX
,
//final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS
,
//final boolean updateStatus,
DEBUG_LEVEL
);
//final int debugLevel);
if
(
configPath
!=
null
)
{
saveTimestampedProperties
(
// save config again
configPath
,
// full path or null
null
,
// use as default directory if path==null
true
,
PROPERTIES
);
}
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"DCT test 3"
))
{
}
else
if
(
label
.
equals
(
"DCT test 3"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
int
n
=
32
;
int
n
=
32
;
...
@@ -3397,6 +3501,9 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
...
@@ -3397,6 +3501,9 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
EYESIS_DCT
.
createDCTKernels
(
EYESIS_DCT
.
createDCTKernels
(
DCT_PARAMETERS
,
DCT_PARAMETERS
,
/*
EYESIS_CORRECTIONS.pixelMapping,
*/
CONVOLVE_FFT_SIZE
/
2
,
CONVOLVE_FFT_SIZE
/
2
,
THREADS_MAX
,
THREADS_MAX
,
UPDATE_STATUS
,
// update status info
UPDATE_STATUS
,
// update status info
...
...
src/main/java/ImageDtt.java
View file @
56b7ed16
...
@@ -529,7 +529,7 @@ public class ImageDtt {
...
@@ -529,7 +529,7 @@ public class ImageDtt {
}
}
if
((
tileY
==
debug_tileY
)
&&
(
tileX
==
debug_tileX
)
&&
(
color
==
2
))
{
if
((
dct_kernels
!=
null
)
&&
(
tileY
==
debug_tileY
)
&&
(
tileX
==
debug_tileX
)
&&
(
color
==
2
))
{
double
[][]
dbg_tile
=
{
double
[][]
dbg_tile
=
{
dct_kernels
.
st_direct
[
color
][
kernelTileY
][
kernelTileX
],
dct_kernels
.
st_direct
[
color
][
kernelTileY
][
kernelTileX
],
dct_kernels
.
st_kernels
[
color
][
kernelTileY
][
kernelTileX
],
dct_kernels
.
st_kernels
[
color
][
kernelTileY
][
kernelTileX
],
...
...
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