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
5578f549
Commit
5578f549
authored
Feb 18, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaking clt processing
parent
1b78d16a
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1214 additions
and
126 deletions
+1214
-126
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+14
-9
EyesisDCT.java
src/main/java/EyesisDCT.java
+745
-3
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+89
-0
GeometryCorrection.java
src/main/java/GeometryCorrection.java
+327
-102
ImageDtt.java
src/main/java/ImageDtt.java
+39
-12
No files found.
src/main/java/EyesisCorrectionParameters.java
View file @
5578f549
...
...
@@ -1882,7 +1882,7 @@ public class EyesisCorrectionParameters {
public
double
fat_zero
=
0.0
;
// modify phase correlation to prevent division by very small numbers
public
double
corr_sigma
=
0.8
;
// LPF correlarion sigma
public
boolean
norm_kern
=
true
;
// normalize kernels
public
boolean
gains_equalize
=
true
;
// equalize channel color gains among all cameras
public
double
novignetting_r
=
0.2644
;
// reg gain in the center of sensor calibration R (instead of vignetting)
public
double
novignetting_g
=
0.3733
;
// green gain in the center of sensor calibration G
public
double
novignetting_b
=
0.2034
;
// blue gain in the center of sensor calibration B
...
...
@@ -1908,9 +1908,11 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"fat_zero"
,
this
.
fat_zero
+
""
);
properties
.
setProperty
(
prefix
+
"corr_sigma"
,
this
.
corr_sigma
+
""
);
properties
.
setProperty
(
prefix
+
"norm_kern"
,
this
.
norm_kern
+
""
);
properties
.
setProperty
(
prefix
+
"gains_equalize"
,
this
.
gains_equalize
+
""
);
properties
.
setProperty
(
prefix
+
"novignetting_r"
,
this
.
novignetting_r
+
""
);
properties
.
setProperty
(
prefix
+
"novignetting_g"
,
this
.
novignetting_g
+
""
);
properties
.
setProperty
(
prefix
+
"novignetting_b"
,
this
.
novignetting_b
+
""
);
properties
.
setProperty
(
prefix
+
"scale_r"
,
this
.
scale_r
+
""
);
properties
.
setProperty
(
prefix
+
"scale_g"
,
this
.
scale_g
+
""
);
properties
.
setProperty
(
prefix
+
"scale_b"
,
this
.
scale_b
+
""
);
...
...
@@ -1933,6 +1935,7 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"fat_zero"
)!=
null
)
this
.
fat_zero
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"fat_zero"
));
if
(
properties
.
getProperty
(
prefix
+
"corr_sigma"
)!=
null
)
this
.
corr_sigma
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"corr_sigma"
));
if
(
properties
.
getProperty
(
prefix
+
"norm_kern"
)!=
null
)
this
.
norm_kern
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"norm_kern"
));
if
(
properties
.
getProperty
(
prefix
+
"gains_equalize"
)!=
null
)
this
.
gains_equalize
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"gains_equalize"
));
if
(
properties
.
getProperty
(
prefix
+
"novignetting_r"
)!=
null
)
this
.
novignetting_r
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"novignetting_r"
));
if
(
properties
.
getProperty
(
prefix
+
"novignetting_g"
)!=
null
)
this
.
novignetting_g
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"novignetting_g"
));
if
(
properties
.
getProperty
(
prefix
+
"novignetting_b"
)!=
null
)
this
.
novignetting_b
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"novignetting_b"
));
...
...
@@ -1959,6 +1962,7 @@ public class EyesisCorrectionParameters {
gd
.
addNumericField
(
"Modify phase correlation to prevent division by very small numbers"
,
this
.
fat_zero
,
4
);
gd
.
addNumericField
(
"LPF correlarion sigma "
,
this
.
corr_sigma
,
3
);
gd
.
addCheckbox
(
"Normalize kernels "
,
this
.
norm_kern
);
gd
.
addCheckbox
(
"Equalize gains between channels"
,
this
.
gains_equalize
);
gd
.
addNumericField
(
"Reg gain in the center of sensor calibration R (instead of vignetting)"
,
this
.
novignetting_r
,
4
);
gd
.
addNumericField
(
"Green gain in the center of sensor calibration G (instead of vignetting)"
,
this
.
novignetting_g
,
4
);
gd
.
addNumericField
(
"Blue gain in the center of sensor calibration B (instead of vignetting)"
,
this
.
novignetting_b
,
4
);
...
...
@@ -1986,6 +1990,7 @@ public class EyesisCorrectionParameters {
this
.
fat_zero
=
gd
.
getNextNumber
();
this
.
corr_sigma
=
gd
.
getNextNumber
();
this
.
norm_kern
=
gd
.
getNextBoolean
();
this
.
gains_equalize
=
gd
.
getNextBoolean
();
this
.
novignetting_r
=
gd
.
getNextNumber
();
this
.
novignetting_g
=
gd
.
getNextNumber
();
this
.
novignetting_b
=
gd
.
getNextNumber
();
...
...
src/main/java/EyesisDCT.java
View file @
5578f549
This diff is collapsed.
Click to expand it.
src/main/java/Eyesis_Correction.java
View file @
5578f549
...
...
@@ -494,6 +494,7 @@ private Panel panel1,
addButton
(
"Read CLT kernels"
,
panelClt1
,
color_process
);
addButton
(
"Reset CLT kernels"
,
panelClt1
,
color_stop
);
addButton
(
"CLT process files"
,
panelClt1
,
color_process
);
addButton
(
"CLT process sets"
,
panelClt1
,
color_process
);
add
(
panelClt1
);
}
pack
();
...
...
@@ -4218,9 +4219,97 @@ private Panel panel1,
true
,
PROPERTIES
);
}
return
;
}
else
if
(
label
.
equals
(
"CLT process sets"
))
{
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 CLT 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
(!
EYESIS_DCT
.
CLTKernelsAvailable
()){
if
(
DEBUG_LEVEL
>
0
){
System
.
out
.
println
(
"Reading CLT kernels"
);
}
EYESIS_DCT
.
readCLTKernels
(
CLT_PARAMETERS
,
THREADS_MAX
,
UPDATE_STATUS
,
// update status info
DEBUG_LEVEL
);
if
(
DEBUG_LEVEL
>
1
){
EYESIS_DCT
.
showCLTKernels
(
THREADS_MAX
,
UPDATE_STATUS
,
// update status info
DEBUG_LEVEL
);
}
}
///========================================
EYESIS_DCT
.
processCLTSets
(
CLT_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
;
// End of buttons code
}
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
...
...
src/main/java/GeometryCorrection.java
View file @
5578f549
This diff is collapsed.
Click to expand it.
src/main/java/ImageDtt.java
View file @
5578f549
...
...
@@ -701,8 +701,10 @@ public class ImageDtt {
chn
=
nTile
/
nTilesInChn
;
tileY
=(
nTile
%
nTilesInChn
)/
tilesX
;
tileX
=
nTile
%
tilesX
;
centerX
=
tileX
*
transform_size
-
transform_size
/
2
-
shiftX
;
centerY
=
tileY
*
transform_size
-
transform_size
/
2
-
shiftY
;
// centerX = tileX * transform_size - transform_size/2 - shiftX;
// centerY = tileY * transform_size - transform_size/2 - shiftY;
centerX
=
tileX
*
transform_size
+
transform_size
/
2
-
shiftX
;
centerY
=
tileY
*
transform_size
+
transform_size
/
2
-
shiftY
;
double
[]
fract_shiftXY
=
extract_correct_tile
(
// return a pair of resudual offsets
imade_data
,
...
...
@@ -715,10 +717,10 @@ public class ImageDtt {
chn
,
centerX
,
// center of aberration-corrected (common model) tile, X
centerY
,
//
(
globalDebugLevel
>
-
1
)
&&
(
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
)
&&
(
chn
==
2
),
// external tile compare
(
globalDebugLevel
>
0
)
&&
(
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
)
&&
(
chn
==
2
),
// external tile compare
no_deconvolution
,
transpose
);
if
((
globalDebugLevel
>
-
1
)
&&
(
debug_tileX
==
tileX
)
&&
(
debug_tileY
==
tileY
)
&&
(
chn
==
2
))
{
if
((
globalDebugLevel
>
0
)
&&
(
debug_tileX
==
tileX
)
&&
(
debug_tileY
==
tileY
)
&&
(
chn
==
2
))
{
showDoubleFloatArrays
sdfa_instance
=
new
showDoubleFloatArrays
();
// just for debugging?
String
[]
titles
=
{
"CC"
,
"SC"
,
"CS"
,
"SS"
};
sdfa_instance
.
showArrays
(
clt_data
[
chn
][
tileY
][
tileX
],
transform_size
,
transform_size
,
true
,
"pre-shifted_x"
+
tileX
+
"_y"
+
tileY
,
titles
);
...
...
@@ -740,7 +742,7 @@ public class ImageDtt {
// (globalDebugLevel > 0) && (tileX == debug_tileX) && (tileY == debug_tileY)); // external tile compare
((
globalDebugLevel
>
0
)
&&
(
chn
==
0
)
&&
(
tileX
>=
debug_tileX
-
2
)
&&
(
tileX
<=
debug_tileX
+
2
)
&&
(
tileY
>=
debug_tileY
-
2
)
&&
(
tileY
<=
debug_tileY
+
2
)));
if
((
globalDebugLevel
>
-
1
)
&&
(
debug_tileX
==
tileX
)
&&
(
debug_tileY
==
tileY
))
{
if
((
globalDebugLevel
>
0
)
&&
(
debug_tileX
==
tileX
)
&&
(
debug_tileY
==
tileY
))
{
showDoubleFloatArrays
sdfa_instance
=
new
showDoubleFloatArrays
();
// just for debugging?
String
[]
titles
=
{
"CC"
,
"SC"
,
"CS"
,
"SS"
};
sdfa_instance
.
showArrays
(
clt_data
[
chn
][
tileY
][
tileX
],
transform_size
,
transform_size
,
true
,
"shifted_x"
+
tileX
+
"_y"
+
tileY
,
titles
);
...
...
@@ -863,10 +865,12 @@ public class ImageDtt {
final
int
tilesY
=
dct_data
.
length
;
final
int
tilesX
=
dct_data
[
0
].
length
;
final
int
width
=
(
tilesX
+
1
)*
dct_size
;
final
int
height
=
(
tilesY
+
1
)*
dct_size
;
// final int width= (tilesX+1)*dct_size;
// final int height= (tilesY+1)*dct_size;
final
int
width
=
tilesX
*
dct_size
;
final
int
height
=
tilesY
*
dct_size
;
final
double
debug_scale
=
1.0
/((
debug_mask
&
1
)
+
((
debug_mask
>>
1
)
&
1
)
+
((
debug_mask
>>
2
)
&
1
)
+
((
debug_mask
>>
3
)
&
1
));
if
(
globalDebugLevel
>
0
)
{
if
(
globalDebugLevel
>
-
1
)
{
System
.
out
.
println
(
"iclt_2d():tilesX= "
+
tilesX
);
System
.
out
.
println
(
"iclt_2d():tilesY= "
+
tilesY
);
System
.
out
.
println
(
"iclt_2d():width= "
+
width
);
...
...
@@ -903,6 +907,10 @@ public class ImageDtt {
double
[]
tile_mdct
;
int
tileY
,
tileX
;
int
n2
=
dct_size
*
2
;
int
n_half
=
dct_size
/
2
;
int
lastY
=
tilesY
-
1
;
int
lastX
=
tilesX
-
1
;
int
offset
=
n_half
*
(
dct_size
*
tilesX
)
+
n_half
;
for
(
int
nTile
=
ai
.
getAndIncrement
();
nTile
<
tiles_list
[
nser
.
get
()].
length
;
nTile
=
ai
.
getAndIncrement
())
{
tileX
=
tiles_list
[
nser
.
get
()][
nTile
][
0
];
tileY
=
tiles_list
[
nser
.
get
()][
nTile
][
1
];
...
...
@@ -916,14 +924,33 @@ public class ImageDtt {
tile_dct
=
dtt
.
dttt_iv
(
tile_in
,
idct_mode
,
dct_size
);
}
tile_mdct
=
dtt
.
unfold_tile
(
tile_dct
,
dct_size
,
dct_mode
);
// mode=0 - DCCT
if
((
tileY
>
0
)
&&
(
tileX
>
0
)
&&
(
tileY
<
lastY
)
&&
(
tileX
<
lastX
))
{
// fast, no extra checks
for
(
int
i
=
0
;
i
<
n2
;
i
++){
int
start_line
=
((
tileY
*
dct_size
+
i
)
*(
tilesX
+
1
)
+
tileX
)*
dct_size
;
// int start_line = ((tileY*dct_size + i) *(tilesX+1) + tileX)*dct_size;
int
start_line
=
((
tileY
*
dct_size
+
i
)
*
tilesX
+
tileX
)*
dct_size
-
offset
;
for
(
int
j
=
0
;
j
<
n2
;
j
++)
{
dpixels
[
start_line
+
j
]
+=
debug_scale
*
tile_mdct
[
n2
*
i
+
j
];
// add (cc+sc+cs+ss)/4
}
}
}
else
{
// be careful with margins
for
(
int
i
=
0
;
i
<
n2
;
i
++){
if
(
((
tileY
>
0
)
&&
(
tileY
<
lastY
))
||
((
tileY
==
0
)
&&
(
i
>=
n_half
))
||
((
tileY
==
lastY
)
&&
(
i
<
(
n2
-
n_half
))))
{
int
start_line
=
((
tileY
*
dct_size
+
i
)
*
tilesX
+
tileX
)*
dct_size
-
offset
;
for
(
int
j
=
0
;
j
<
n2
;
j
++)
{
if
(
((
tileX
>
0
)
&&
(
tileX
<
lastX
))
||
((
tileX
==
0
)
&&
(
j
>=
n_half
))
||
((
tileX
==
lastX
)
&&
(
j
<
(
n2
-
n_half
))))
{
dpixels
[
start_line
+
j
]
+=
debug_scale
*
tile_mdct
[
n2
*
i
+
j
];
// add (cc+sc+cs+ss)/4
}
}
}
}
}
}
}
}
};
}
...
...
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