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
f2987dd0
Commit
f2987dd0
authored
Jan 14, 2017
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dct'
parents
3dd608b9
96038858
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1717 additions
and
475 deletions
+1717
-475
CorrectionColorProc.java
src/main/java/CorrectionColorProc.java
+219
-219
EyesisCorrectionParameters.java
src/main/java/EyesisCorrectionParameters.java
+135
-24
EyesisCorrections.java
src/main/java/EyesisCorrections.java
+7
-4
EyesisDCT.java
src/main/java/EyesisDCT.java
+1036
-130
Eyesis_Correction.java
src/main/java/Eyesis_Correction.java
+119
-10
ImageDtt.java
src/main/java/ImageDtt.java
+180
-88
showDoubleFloatArrays.java
src/main/java/showDoubleFloatArrays.java
+21
-0
No files found.
src/main/java/CorrectionColorProc.java
View file @
f2987dd0
...
@@ -100,7 +100,7 @@ public class CorrectionColorProc {
...
@@ -100,7 +100,7 @@ public class CorrectionColorProc {
}
}
//public void showArrays(double[][] pixels, int width, int height, boolean asStack, String title) {
//public void showArrays(double[][] pixels, int width, int height, boolean asStack, String title) {
...
@@ -138,7 +138,7 @@ public class CorrectionColorProc {
...
@@ -138,7 +138,7 @@ public class CorrectionColorProc {
/* Convert to YPbPr */
/* Convert to YPbPr */
double
Y
,
Pb
,
Pr
;
double
Y
,
Pb
,
Pr
;
// double Kg=1.0-colorProcParameters.kr-colorProcParameters.kb;
// double Kg=1.0-colorProcParameters.kr-colorProcParameters.kb;
double
Sb
=
0.5
/(
1.0
-
colorProcParameters
.
kb
)*
colorProcParameters
.
saturationBlue
;
double
Sb
=
0.5
/(
1.0
-
colorProcParameters
.
kb
)*
colorProcParameters
.
saturationBlue
;
double
Sr
=
0.5
/(
1.0
-
colorProcParameters
.
kr
)*
colorProcParameters
.
saturationRed
;
double
Sr
=
0.5
/(
1.0
-
colorProcParameters
.
kr
)*
colorProcParameters
.
saturationRed
;
double
Yr
,
Yg
,
Yb
,
Wr
,
Wg
,
Wb
,
S
;
double
Yr
,
Yg
,
Yb
,
Wr
,
Wg
,
Wb
,
S
;
...
@@ -271,7 +271,7 @@ public class CorrectionColorProc {
...
@@ -271,7 +271,7 @@ public class CorrectionColorProc {
stack
.
addSlice
(
"Pr"
,
fpixels_pr
);
stack
.
addSlice
(
"Pr"
,
fpixels_pr
);
stack
.
addSlice
(
"Pb"
,
fpixels_pb
);
stack
.
addSlice
(
"Pb"
,
fpixels_pb
);
stack
.
addSlice
(
"Y"
,
fpixels_y
);
stack
.
addSlice
(
"Y"
,
fpixels_y
);
stack
.
addSlice
(
"Y0"
,
fpixels_y0
);
// not filtered by low-pass, preliminary (for comap
rison only)
stack
.
addSlice
(
"Y0"
,
fpixels_y0
);
// not filtered by low-pass, preliminary (for compa
rison only)
if
(
debugLevel
>
2
)
{
if
(
debugLevel
>
2
)
{
stack
.
addSlice
(
"Yr"
,
fpixels_yR
);
stack
.
addSlice
(
"Yr"
,
fpixels_yR
);
stack
.
addSlice
(
"Yg"
,
fpixels_yG
);
stack
.
addSlice
(
"Yg"
,
fpixels_yG
);
...
...
src/main/java/EyesisCorrectionParameters.java
View file @
f2987dd0
This diff is collapsed.
Click to expand it.
src/main/java/EyesisCorrections.java
View file @
f2987dd0
...
@@ -1390,7 +1390,8 @@ public class EyesisCorrections {
...
@@ -1390,7 +1390,8 @@ public class EyesisCorrections {
/* ======================================================================== */
/* ======================================================================== */
private
boolean
fixSliceSequence
(
// private boolean fixSliceSequence (
public
boolean
fixSliceSequence
(
// for EyesisDCT
ImageStack
stack
,
ImageStack
stack
,
int
debugLevel
){
int
debugLevel
){
int
i
,
j
;
int
i
,
j
;
...
@@ -2234,7 +2235,8 @@ public class EyesisCorrections {
...
@@ -2234,7 +2235,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
);
...
@@ -2253,7 +2255,8 @@ public class EyesisCorrections {
...
@@ -2253,7 +2255,8 @@ public class EyesisCorrections {
correctionsParameters
.
JPEG_quality
);
correctionsParameters
.
JPEG_quality
);
}
}
private
void
saveAndShow
(
void
saveAndShow
(
// public void saveAndShow(
ImagePlus
imp
,
ImagePlus
imp
,
EyesisCorrectionParameters
.
CorrectionParameters
correctionsParameters
,
EyesisCorrectionParameters
.
CorrectionParameters
correctionsParameters
,
boolean
save
,
boolean
save
,
...
@@ -2261,7 +2264,7 @@ public class EyesisCorrections {
...
@@ -2261,7 +2264,7 @@ public class EyesisCorrections {
saveAndShow
(
imp
,
correctionsParameters
,
save
,
show
,
-
1
);
saveAndShow
(
imp
,
correctionsParameters
,
save
,
show
,
-
1
);
}
}
private
void
saveAndShow
(
void
saveAndShow
(
ImagePlus
imp
,
ImagePlus
imp
,
EyesisCorrectionParameters
.
CorrectionParameters
correctionsParameters
,
EyesisCorrectionParameters
.
CorrectionParameters
correctionsParameters
,
boolean
save
,
boolean
save
,
...
...
src/main/java/EyesisDCT.java
View file @
f2987dd0
This diff is collapsed.
Click to expand it.
src/main/java/Eyesis_Correction.java
View file @
f2987dd0
...
@@ -499,6 +499,8 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
...
@@ -499,6 +499,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
();
...
@@ -2790,6 +2792,7 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
...
@@ -2790,6 +2792,7 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
DEBUG_LEVEL
);
DEBUG_LEVEL
);
}
}
// System.out.println("dct_dc.length="+dct_dc.length+" dct_ac.length="+dct_ac.length);
// System.out.println("dct_dc.length="+dct_dc.length+" dct_ac.length="+dct_ac.length);
if
(
DEBUG_LEVEL
>
0
){
SDFA_INSTANCE
.
showArrays
(
dct_ac
,
SDFA_INSTANCE
.
showArrays
(
dct_ac
,
tilesX
*
DCT_PARAMETERS
.
dct_size
,
tilesX
*
DCT_PARAMETERS
.
dct_size
,
tilesY
*
DCT_PARAMETERS
.
dct_size
,
tilesY
*
DCT_PARAMETERS
.
dct_size
,
...
@@ -2800,6 +2803,7 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
...
@@ -2800,6 +2803,7 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
tilesY
,
tilesY
,
true
,
true
,
DBG_IMP
.
getTitle
()+
"-DCT_DC"
);
DBG_IMP
.
getTitle
()+
"-DCT_DC"
);
}
double
[][]
idct_data
=
new
double
[
dctdc_data
.
length
][];
double
[][]
idct_data
=
new
double
[
dctdc_data
.
length
][];
for
(
int
chn
=
0
;
chn
<
idct_data
.
length
;
chn
++){
for
(
int
chn
=
0
;
chn
<
idct_data
.
length
;
chn
++){
idct_data
[
chn
]
=
image_dtt
.
lapped_idctdc
(
idct_data
[
chn
]
=
image_dtt
.
lapped_idctdc
(
...
@@ -2815,8 +2819,110 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
...
@@ -2815,8 +2819,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
;
...
@@ -3431,6 +3537,9 @@ private Panel panel1,panel2,panel3,panel4,panel5,panel5a, panel6,panel7,panelPos
...
@@ -3431,6 +3537,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 @
f2987dd0
This diff is collapsed.
Click to expand it.
src/main/java/showDoubleFloatArrays.java
View file @
f2987dd0
...
@@ -175,7 +175,28 @@ import ij.process.*;
...
@@ -175,7 +175,28 @@ import ij.process.*;
}
}
}
}
}
}
public
ImageStack
makeStack
(
double
[][]
pixels
,
int
width
,
int
height
)
{
return
makeStack
(
pixels
,
width
,
height
,
null
);
}
public
ImageStack
makeStack
(
double
[][]
pixels
,
int
width
,
int
height
,
String
[]
titles
)
{
float
[]
fpixels
;
ImageStack
array_stack
=
new
ImageStack
(
width
,
height
);
for
(
int
i
=
0
;
i
<
pixels
.
length
;
i
++)
if
(
pixels
[
i
]!=
null
)
{
if
(
pixels
[
i
].
length
!=(
width
*
height
)){
System
.
out
.
println
(
"showArrays(): pixels["
+
i
+
"].length="
+
pixels
[
i
].
length
+
" != width (+"
+
width
+
") * height("
+
height
+
")="
+(
width
*
height
));
return
null
;
}
fpixels
=
new
float
[
pixels
[
i
].
length
];
for
(
int
j
=
0
;
j
<
fpixels
.
length
;
j
++)
fpixels
[
j
]=(
float
)
pixels
[
i
][
j
];
if
(
titles
!=
null
){
array_stack
.
addSlice
(
titles
[
i
],
fpixels
);
}
else
{
array_stack
.
addSlice
(
"chn-"
+
i
,
fpixels
);
}
}
return
array_stack
;
}
public
ImagePlus
[]
makeArrays
(
double
[][]
pixels
,
int
width
,
int
height
,
String
title
)
{
public
ImagePlus
[]
makeArrays
(
double
[][]
pixels
,
int
width
,
int
height
,
String
title
)
{
int
i
,
j
;
int
i
,
j
;
...
...
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