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
15cff9c7
Commit
15cff9c7
authored
Nov 10, 2020
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generated statistics from mixed synthetic noise
parent
a74958ee
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1561 additions
and
161 deletions
+1561
-161
CLTParameters.java
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
+36
-3
InterNoiseParameters.java
.../java/com/elphel/imagej/cameras/InterNoiseParameters.java
+91
-0
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+350
-1
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+3
-3
IntersceneLmaParameters.java
.../elphel/imagej/tileprocessor/IntersceneLmaParameters.java
+24
-0
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+295
-82
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+296
-47
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+25
-20
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+441
-5
No files found.
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
View file @
15cff9c7
package
com
.
elphel
.
imagej
.
cameras
;
/**
**
** CLTParameters - Class for handling multiple configuration parameters
**
** Copyright (C) 2017-2020 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** CLTParameters.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
//import static jcuda.driver.JCudaDriver.cuMemcpyDtoH;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -875,8 +903,8 @@ public class CLTParameters {
public
LwirReaderParameters
lwir
=
new
LwirReaderParameters
();
public
OpticalFlowParameters
ofp
=
new
OpticalFlowParameters
();
public
IntersceneLmaParameters
ilp
=
new
IntersceneLmaParameters
();
public
InterNoiseParameters
inp
=
new
InterNoiseParameters
();
public
HashMap
<
String
,
Double
>
z_corr_map
=
new
HashMap
<
String
,
Double
>();
//old one
public
HashMap
<
String
,
Double
>
infinity_distace_map
=
new
HashMap
<
String
,
Double
>();
//new one
public
static
String
Z_CORR_PREFIX
=
"z_corr."
;
...
...
@@ -1729,6 +1757,7 @@ public class CLTParameters {
lwir
.
setProperties
(
prefix
+
"_lwir"
,
properties
);
ofp
.
setProperties
(
prefix
+
"_ofp_"
,
properties
);
ilp
.
setProperties
(
prefix
+
"_ilp_"
,
properties
);
inp
.
setProperties
(
prefix
+
"_inp_"
,
properties
);
}
...
...
@@ -2554,6 +2583,7 @@ public class CLTParameters {
lwir
.
getProperties
(
prefix
+
"_lwir"
,
properties
);
ofp
.
getProperties
(
prefix
+
"_ofp_"
,
properties
);
ilp
.
getProperties
(
prefix
+
"_ilp_"
,
properties
);
inp
.
getProperties
(
prefix
+
"_inp_"
,
properties
);
}
public
boolean
showJDialog
()
{
...
...
@@ -3528,9 +3558,11 @@ public class CLTParameters {
gd
.
addTab
(
"O-Flow"
,
"parameters for the interscene Optical FLow calculations"
);
this
.
ofp
.
dialogQuestions
(
gd
);
gd
.
addTab
(
"Int
ra
-LMA"
,
"parameters for the interscene LMA fitting"
);
gd
.
addTab
(
"Int
er
-LMA"
,
"parameters for the interscene LMA fitting"
);
this
.
ilp
.
dialogQuestions
(
gd
);
gd
.
addTab
(
"Inter-Noise"
,
"parameters for the interscene noise testing"
);
this
.
inp
.
dialogQuestions
(
gd
);
gd
.
addTab
(
"Debug"
,
"Other debug images"
);
gd
.
addMessage
(
"--- Other debug images ---"
);
...
...
@@ -4330,6 +4362,7 @@ public class CLTParameters {
this
.
lwir
.
dialogAnswers
(
gd
);
this
.
ofp
.
dialogAnswers
(
gd
);
this
.
ilp
.
dialogAnswers
(
gd
);
this
.
inp
.
dialogAnswers
(
gd
);
this
.
debug_initial_discriminate
=
gd
.
getNextBoolean
();
this
.
dbg_migrate
=
gd
.
getNextBoolean
();
...
...
src/main/java/com/elphel/imagej/cameras/InterNoiseParameters.java
0 → 100644
View file @
15cff9c7
package
com
.
elphel
.
imagej
.
cameras
;
/**
**
** InterNoiseParameters - Class for handling configuration parameters
** to measure disparity map calculation with images degraded by the artificially
** introduced noise.
** related to the interscene LMA
**
** Copyright (C) 2020 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** InterNoiseParameters.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
import
java.util.Properties
;
import
com.elphel.imagej.common.GenericJTabbedDialog
;
public
class
InterNoiseParameters
{
public
double
noise_sigma
=
1.5
;
public
double
noise_scale
=
0.01
;
public
double
initial_offset
=
1.0
;
public
boolean
ref_only
=
false
;
// also see imgdtt_params.dbg_pair_mask to switch between all pairs (63) and binocular only (1)
public
int
noise_debug_level
=
-
1
;
// Noise testing debug level
public
void
dialogQuestions
(
GenericJTabbedDialog
gd
)
{
gd
.
addMessage
(
"Additive noise parameters"
);
gd
.
addMessage
(
"LMA other parameters"
);
gd
.
addNumericField
(
"Noise Gaussian sigma"
,
this
.
noise_sigma
,
3
,
5
,
"pix"
,
"Blur noise with 2D Gaussian"
);
gd
.
addNumericField
(
"Scale noise"
,
this
.
noise_scale
,
6
,
8
,
""
,
"Scale noise relative to the average value of the color component."
);
gd
.
addNumericField
(
"Offset target disparity"
,
this
.
initial_offset
,
3
,
5
,
"pix"
,
"Offset target disparity before attempting to correlate and refine."
);
gd
.
addCheckbox
(
"Reference scene only"
,
this
.
ref_only
,
"Process only reference scene (intra-scene, no inter-scene accumulation)."
);
gd
.
addNumericField
(
"Debug level"
,
this
.
noise_debug_level
,
0
,
3
,
""
,
"Debug level of interscene noise testing."
);
}
public
void
dialogAnswers
(
GenericJTabbedDialog
gd
)
{
this
.
noise_sigma
=
gd
.
getNextNumber
();
this
.
noise_scale
=
gd
.
getNextNumber
();
this
.
initial_offset
=
gd
.
getNextNumber
();
this
.
ref_only
=
gd
.
getNextBoolean
();
this
.
noise_debug_level
=
(
int
)
gd
.
getNextNumber
();
}
public
void
setProperties
(
String
prefix
,
Properties
properties
){
properties
.
setProperty
(
prefix
+
"noise_sigma"
,
this
.
noise_sigma
+
""
);
properties
.
setProperty
(
prefix
+
"noise_scale"
,
this
.
noise_scale
+
""
);
properties
.
setProperty
(
prefix
+
"initial_offset"
,
this
.
initial_offset
+
""
);
properties
.
setProperty
(
prefix
+
"ref_only"
,
this
.
ref_only
+
""
);
properties
.
setProperty
(
prefix
+
"noise_debug_level"
,
this
.
noise_debug_level
+
""
);
}
public
void
getProperties
(
String
prefix
,
Properties
properties
){
if
(
properties
.
getProperty
(
prefix
+
"noise_sigma"
)!=
null
)
this
.
noise_sigma
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"noise_sigma"
));
if
(
properties
.
getProperty
(
prefix
+
"noise_scale"
)!=
null
)
this
.
noise_scale
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"noise_scale"
));
if
(
properties
.
getProperty
(
prefix
+
"initial_offset"
)!=
null
)
this
.
initial_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"initial_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"ref_only"
)!=
null
)
this
.
ref_only
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ref_only"
));
if
(
properties
.
getProperty
(
prefix
+
"noise_debug_level"
)!=
null
)
this
.
noise_debug_level
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"noise_debug_level"
));
}
@Override
public
InterNoiseParameters
clone
()
throws
CloneNotSupportedException
{
InterNoiseParameters
inp
=
new
InterNoiseParameters
();
inp
.
noise_sigma
=
this
.
noise_sigma
;
inp
.
noise_scale
=
this
.
noise_scale
;
inp
.
initial_offset
=
this
.
initial_offset
;
inp
.
ref_only
=
this
.
ref_only
;
inp
.
noise_debug_level
=
this
.
noise_debug_level
;
return
inp
;
}
}
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
15cff9c7
...
...
@@ -59,6 +59,7 @@ import java.nio.file.Paths;
import
java.nio.file.SimpleFileVisitor
;
import
java.nio.file.attribute.BasicFileAttributes
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.EnumSet
;
...
...
@@ -75,6 +76,7 @@ import com.elphel.imagej.calibration.PixelMapping;
import
com.elphel.imagej.cameras.CLTParameters
;
import
com.elphel.imagej.cameras.ColorProcParameters
;
import
com.elphel.imagej.cameras.EyesisCorrectionParameters
;
import
com.elphel.imagej.cameras.ThermalColor
;
import
com.elphel.imagej.common.DoubleFHT
;
import
com.elphel.imagej.common.DoubleGaussianBlur
;
import
com.elphel.imagej.common.GenericJTabbedDialog
;
...
...
@@ -704,6 +706,9 @@ private Panel panel1,
addButton
(
"Inter LMA"
,
panelClt5
,
color_stop
);
addButton
(
"Inter Series"
,
panelClt5
,
color_process
);
addButton
(
"Inter Accumulate"
,
panelClt5
,
color_process
);
addButton
(
"Inter Noise"
,
panelClt5
,
color_process
);
addButton
(
"Noise Stats"
,
panelClt5
,
color_process
);
addButton
(
"Colorize Depth"
,
panelClt5
,
color_process
);
plugInFrame
.
add
(
panelClt5
);
}
...
...
@@ -5126,13 +5131,36 @@ private Panel panel1,
interSeriesLMA
();
return
;
/* ======================================================================== */
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Inter Accumulate"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
CLT_PARAMETERS
.
batch_run
=
true
;
intersceneAccumulate
();
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Inter Noise"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
CLT_PARAMETERS
.
batch_run
=
true
;
intersceneNoise
();
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Noise Stats"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
CLT_PARAMETERS
.
batch_run
=
true
;
intersceneNoiseStats
();
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Colorize Depth"
))
{
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
CLT_PARAMETERS
.
batch_run
=
true
;
coloriseDepthMap
();
return
;
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"Inter LMA"
))
{
...
...
@@ -6793,6 +6821,327 @@ private Panel panel1,
return
true
;
}
public
boolean
intersceneNoise
()
{
long
startTime
=
System
.
nanoTime
();
// load needed sensor and kernels files
if
(!
prepareRigImages
())
return
false
;
String
configPath
=
getSaveCongigPath
();
if
(
configPath
.
equals
(
"ABORT"
))
return
false
;
setAllProperties
(
PROPERTIES
);
// batchRig may save properties with the model. Extrinsics will be updated, others should be set here
if
(
DEBUG_LEVEL
>
-
2
){
System
.
out
.
println
(
"++++++++++++++ Testing Interscene processing ++++++++++++++"
);
}
if
(
CLT_PARAMETERS
.
useGPU
())
{
// only init GPU instances if it is used
if
(
GPU_TILE_PROCESSOR
==
null
)
{
try
{
GPU_TILE_PROCESSOR
=
new
GPUTileProcessor
(
CORRECTION_PARAMETERS
.
tile_processor_gpu
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Failed to initialize GPU class"
);
// TODO Auto-generated catch block
e
.
printStackTrace
();
return
false
;
}
//final int debugLevel);
}
if
(
CLT_PARAMETERS
.
useGPU
(
false
)
&&
(
QUAD_CLT
!=
null
)
&&
(
GPU_QUAD
==
null
))
{
// if GPU main is needed
try
{
GPU_QUAD
=
GPU_TILE_PROCESSOR
.
new
GpuQuad
(
QUAD_CLT
,
4
,
3
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Failed to initialize GpuQuad class"
);
// TODO Auto-generated catch block
e
.
printStackTrace
();
return
false
;
}
//final int debugLevel);
QUAD_CLT
.
setGPU
(
GPU_QUAD
);
}
}
try
{
TWO_QUAD_CLT
.
intersceneNoise
(
QUAD_CLT
,
// QuadCLT quadCLT_main,
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS
,
//EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS
,
//EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CHANNEL_GAINS_PARAMETERS
,
//CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS
,
//EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS
,
// EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
PROPERTIES
,
// Properties properties,
THREADS_MAX
,
//final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS
,
//final boolean updateStatus,
DEBUG_LEVEL
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
//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
);
}
System
.
out
.
println
(
"batchRig(): Processing finished at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
)+
" sec, --- Free memory="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
return
true
;
}
public
boolean
intersceneNoiseStats
()
{
long
startTime
=
System
.
nanoTime
();
// load needed sensor and kernels files
if
(!
prepareRigImages
())
return
false
;
String
configPath
=
getSaveCongigPath
();
if
(
configPath
.
equals
(
"ABORT"
))
return
false
;
setAllProperties
(
PROPERTIES
);
// batchRig may save properties with the model. Extrinsics will be updated, others should be set here
if
(
DEBUG_LEVEL
>
-
2
){
System
.
out
.
println
(
"++++++++++++++ Testing Interscene processing ++++++++++++++"
);
}
if
(
CLT_PARAMETERS
.
useGPU
())
{
// only init GPU instances if it is used
if
(
GPU_TILE_PROCESSOR
==
null
)
{
try
{
GPU_TILE_PROCESSOR
=
new
GPUTileProcessor
(
CORRECTION_PARAMETERS
.
tile_processor_gpu
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Failed to initialize GPU class"
);
// TODO Auto-generated catch block
e
.
printStackTrace
();
return
false
;
}
//final int debugLevel);
}
if
(
CLT_PARAMETERS
.
useGPU
(
false
)
&&
(
QUAD_CLT
!=
null
)
&&
(
GPU_QUAD
==
null
))
{
// if GPU main is needed
try
{
GPU_QUAD
=
GPU_TILE_PROCESSOR
.
new
GpuQuad
(
QUAD_CLT
,
4
,
3
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Failed to initialize GpuQuad class"
);
// TODO Auto-generated catch block
e
.
printStackTrace
();
return
false
;
}
//final int debugLevel);
QUAD_CLT
.
setGPU
(
GPU_QUAD
);
}
}
try
{
TWO_QUAD_CLT
.
intersceneNoiseStats
(
QUAD_CLT
,
// QuadCLT quadCLT_main,
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
DEBAYER_PARAMETERS
,
//EyesisCorrectionParameters.DebayerParameters debayerParameters,
COLOR_PROC_PARAMETERS
,
//EyesisCorrectionParameters.ColorProcParameters colorProcParameters,
CHANNEL_GAINS_PARAMETERS
,
//CorrectionColorProc.ColorGainsParameters channelGainParameters,
RGB_PARAMETERS
,
//EyesisCorrectionParameters.RGBParameters rgbParameters,
EQUIRECTANGULAR_PARAMETERS
,
// EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
PROPERTIES
,
// Properties properties,
THREADS_MAX
,
//final int threadsMax, // maximal number of threads to launch
UPDATE_STATUS
,
//final boolean updateStatus,
DEBUG_LEVEL
);
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
//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
);
}
System
.
out
.
println
(
"batchRig(): Processing finished at "
+
IJ
.
d2s
(
0.000000001
*(
System
.
nanoTime
()-
startTime
),
3
)+
" sec, --- Free memory="
+
Runtime
.
getRuntime
().
freeMemory
()+
" (of "
+
Runtime
.
getRuntime
().
totalMemory
()+
")"
);
return
true
;
}
public
boolean
coloriseDepthMap
()
{
ImagePlus
imp_sel
=
WindowManager
.
getCurrentImage
();
if
(
imp_sel
==
null
){
IJ
.
showMessage
(
"Error"
,
"No images selected"
);
return
false
;
}
double
disparity0
=
0.75
;
double
disparity_max
=
75.0
;
// pix
boolean
show_dialog2
=
false
;
boolean
linear_disparity
=
false
;
int
legend_width
=
0
;
int
legend_gap
=
5
;
GenericJTabbedDialog
gd0
=
new
GenericJTabbedDialog
(
"Ln mode"
);
gd0
.
addNumericField
(
"disparity0"
,
disparity0
,
5
,
8
,
"pix"
,
"Disparity to swict from linear to log. ) - skip log mode"
);
gd0
.
addNumericField
(
"Maximal disparity"
,
disparity_max
,
5
,
8
,
"pix"
,
"Fixed maximal disparity (0 - auto"
);
gd0
.
addCheckbox
(
"Linear disparity legend"
,
linear_disparity
);
gd0
.
addNumericField
(
"Legend width"
,
legend_width
,
0
,
3
,
""
,
"Optional disparity legend vertical bar width"
);
gd0
.
addNumericField
(
"Legend gap"
,
legend_gap
,
0
,
3
,
""
,
"Optional disparity legend vertical bar gap"
);
gd0
.
addCheckbox
(
"Show second dialog"
,
show_dialog2
);
gd0
.
showDialog
();
if
(
gd0
.
wasCanceled
())
return
false
;
disparity0
=
gd0
.
getNextNumber
();
disparity_max
=
gd0
.
getNextNumber
();
linear_disparity
=
gd0
.
getNextBoolean
();
legend_width
=
(
int
)
gd0
.
getNextNumber
();
legend_gap
=
(
int
)
gd0
.
getNextNumber
();
show_dialog2
=
gd0
.
getNextBoolean
();
boolean
log_mode
=
disparity0
>
0.0
;
int
current_slice
=
imp_sel
.
getCurrentSlice
();
ImageStack
imageStack
=
imp_sel
.
getStack
();
float
[]
fpixels
=
(
float
[])
imageStack
.
getPixels
(
current_slice
);
int
width
=
imp_sel
.
getWidth
();
int
height
=
imp_sel
.
getHeight
();
String
title
=
imp_sel
.
getShortTitle
();
// getTitle();
double
[]
dpixels
;
int
width0
=
width
;
if
(
legend_width
<=
0
)
{
dpixels
=
new
double
[
fpixels
.
length
];
for
(
int
i
=
0
;
i
<
fpixels
.
length
;
i
++)
{
double
d
=
fpixels
[
i
];
dpixels
[
i
]
=
d
;
}
}
else
{
width
+=
legend_width
+
legend_gap
;
dpixels
=
new
double
[
height
*
width
];
Arrays
.
fill
(
dpixels
,
Double
.
NaN
);
double
mx
=
disparity_max
;
for
(
int
y
=
0
;
y
<
height
;
y
++)
{
for
(
int
x
=
0
;
x
<
width0
;
x
++)
{
double
d
=
fpixels
[
x
+
y
*
width0
];
dpixels
[
x
+
y
*
width
]
=
d
;
if
(
d
>
mx
)
{
mx
=
d
;
}
}
}
if
(
disparity_max
>
0
)
{
mx
=
disparity_max
;
}
if
(
linear_disparity
)
{
for
(
int
y
=
0
;
y
<
height
;
y
++)
{
double
d
=
(
mx
*
y
)
/
height
;
for
(
int
i
=
0
;
i
<
legend_width
;
i
++)
{
dpixels
[
width0
+
legend_gap
+
i
+
y
*
width
]
=
d
;
}
}
}
}
double
mn
=
fpixels
[
0
];
double
mx
=
mn
;
double
pwr
=
1.0
;
int
palette
=
2
;
for
(
int
i
=
0
;
i
<
fpixels
.
length
;
i
++)
{
double
d
=
dpixels
[
i
];
if
(
log_mode
)
{
if
(!
Double
.
isNaN
(
d
))
{
if
(
d
<
0.0
)
{
//
d
=
0.0
;
}
else
if
(
d
<
disparity0
)
{
d
=
d
/
disparity0
;
}
else
{
d
=
Math
.
log
(
d
/
disparity0
)
+
1.0
;
}
}
}
if
(!
Double
.
isNaN
(
d
))
{
if
(!(
d
<=
mx
))
mx
=
d
;
if
(!(
d
>=
mn
))
mn
=
d
;
}
dpixels
[
i
]
=
d
;
}
if
(
disparity_max
>
0
)
{
mn
=
0.0
;
double
d
=
disparity_max
;
if
(
d
<
0.0
)
{
//
d
=
0.0
;
}
else
if
(
d
<
disparity0
)
{
d
=
d
/
disparity0
;
}
else
{
d
=
Math
.
log
(
d
/
disparity0
)
+
1.0
;
}
mx
=
d
;
}
if
(
show_dialog2
)
{
GenericJTabbedDialog
gd
=
new
GenericJTabbedDialog
(
"Colorization"
+(
log_mode
?
" {log mode)"
:
""
));
gd
.
addNumericField
(
"min"
,
mn
,
5
,
8
,
""
,
"Minimal value to map"
);
gd
.
addNumericField
(
"max"
,
mx
,
5
,
8
,
""
,
"Maximal value to map"
);
gd
.
addNumericField
(
"pwr"
,
pwr
,
5
,
8
,
""
,
"Exponent power"
);
gd
.
addNumericField
(
"palette"
,
palette
,
0
,
3
,
""
,
"Palette index"
);
gd
.
showDialog
();
if
(
gd
.
wasCanceled
())
return
false
;
mn
=
gd
.
getNextNumber
();
mx
=
gd
.
getNextNumber
();
pwr
=
gd
.
getNextNumber
();
palette
=
(
int
)
gd
.
getNextNumber
();
}
if
(
pwr
!=
1.0
)
{
if
(
mn
<
0
)
{
mn
=
0.0
;
}
mn
=
Math
.
pow
(
mn
,
pwr
);
mx
=
Math
.
pow
(
mx
,
pwr
);
for
(
int
i
=
0
;
i
<
dpixels
.
length
;
i
++)
{
if
(
dpixels
[
i
]
<
0
)
{
dpixels
[
i
]
=
0.0
;
}
else
{
dpixels
[
i
]
=
Math
.
pow
(
dpixels
[
i
],
pwr
);
}
}
}
if
(!
linear_disparity
&&
(
legend_width
>
0
)
)
{
for
(
int
y
=
0
;
y
<
height
;
y
++)
{
double
d
=
((
mx
-
mn
)
*
y
)
/
height
;
for
(
int
i
=
0
;
i
<
legend_width
;
i
++)
{
dpixels
[
width0
+
legend_gap
+
i
+
y
*
width
]
=
d
;
}
}
}
double
[][]
pseudo_pixels
=
new
double
[
3
]
[
dpixels
.
length
];
ThermalColor
tc
=
new
ThermalColor
(
palette
,
// public int lwir_palette = 0; // 0 - white - hot, 1 - black - hot, 2+ - colored
mn
,
mx
,
255.0
);
for
(
int
i
=
0
;
i
<
dpixels
.
length
;
i
++)
{
double
[]
rgb
=
tc
.
getRGB
(
dpixels
[
i
]);
pseudo_pixels
[
0
][
i
]
=
rgb
[
0
];
// red
pseudo_pixels
[
1
][
i
]
=
rgb
[
1
];
// green
pseudo_pixels
[
2
][
i
]
=
rgb
[
2
];
// blue
}
String
[]
rgb_titles
=
{
"red"
,
"green"
,
"blue"
};
ImageStack
stack
=
(
new
ShowDoubleFloatArrays
()).
makeStack
(
pseudo_pixels
,
// iclt_data,
width
,
// (tilesX + 0) * clt_parameters.transform_size,
height
,
// (tilesY + 0) * clt_parameters.transform_size,
rgb_titles
,
// or use null to get chn-nn slice names
true
);
// replace NaN with 0.0
ImagePlus
imp_pseudo
=
EyesisCorrections
.
convertRGBAFloatToRGBA32
(
stack
,
// ImageStack stackFloat, //r,g,b,a
// name+"ARGB"+suffix, // String title,
title
+
"-pseudo"
,
// String title,
0.0
,
// double r_min,
255.0
,
// double r_max,
0.0
,
// double g_min,
255.0
,
// double g_max,
0.0
,
// double b_min,
255.0
,
// double b_max,
0.0
,
// double alpha_min,
1.0
);
// double alpha_max)
imp_pseudo
.
getProcessor
().
resetMinAndMax
();
imp_pseudo
.
show
();
return
true
;
}
public
boolean
exportMLData
()
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
15cff9c7
...
...
@@ -1487,7 +1487,7 @@ public class ImageDtt extends ImageDttCPU {
for
(
int
i
=
0
;
i
<
debug_offsets
.
length
;
i
++)
for
(
int
j
=
0
;
j
<
debug_offsets
[
i
].
length
;
j
++)
{
debug_offsets
[
i
][
j
]
=
imgdtt_params
.
lma_dbg_offset
[
i
][
j
]*
imgdtt_params
.
lma_dbg_scale
;
}
//dbg_pair_mask
final
int
quad
=
4
;
// number of subcameras
// final int numcol = isMonochrome()?1:3;
...
...
@@ -1723,9 +1723,9 @@ public class ImageDtt extends ImageDttCPU {
if
(
fcorr_tiles
!=
null
)
{
fcorr_tiles
[
tileY
*
tilesX
+
tileX
]
=
fcorrs
;
// does not require corr_common_GPU()
}
if
((
disparity_map
!=
null
)
||
(
clt_corr_partial
!=
null
)
||
(
clt_mismatch
!=
null
))
{
int
used_pairs
=
pair_mask
;
// imgdtt_params.dbg_pair_mask; //TODO: use tile tasks
// int used_pairs = pair_mask; // imgdtt_params.dbg_pair_mask; //TODO: use tile tasks
int
used_pairs
=
pair_mask
&
imgdtt_params
.
dbg_pair_mask
;
// imgdtt_params.dbg_pair_mask; //TODO: use tile tasks
int
tile_lma_debug_level
=
((
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
))?
(
imgdtt_params
.
lma_debug_level
-
1
)
:
-
2
;
boolean
debugTile
=(
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
)
&&
(
globalDebugLevel
>
-
1
);
corr_common_GPU
(
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLmaParameters.java
View file @
15cff9c7
package
com
.
elphel
.
imagej
.
tileprocessor
;
/**
**
** IntersceneLmaParameters - Class for handling multiple configuration parameters
** related to the interscene LMA
**
** Copyright (C) 2020 Elphel, Inc.
**
** -----------------------------------------------------------------------------**
**
** IntersceneLmaParameters.java is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
** -----------------------------------------------------------------------------**
**
*/
import
java.util.Properties
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
15cff9c7
...
...
@@ -2263,7 +2263,7 @@ public class OpticalFlow {
scene_atr
,
// final double [] scene_atr, // camera orientation relative to world frame
scene_QuadClt
,
// final QuadCLT scene_QuadClt,
reference_QuadClt
);
// final QuadCLT reference_QuadClt)
scene_QuadClt
.
getG
puQuad
().
setInterTasks
(
scene_QuadClt
.
getG
PU
().
setInterTasks
(
scene_pXpYD
,
// final double [][] pXpYD, // per-tile array of pX,pY,disparity triplets (or nulls)
scene_QuadClt
.
getGeometryCorrection
(),
// final GeometryCorrection geometryCorrection,
scene_disparity_cor
,
// final double disparity_corr,
...
...
@@ -3114,10 +3114,11 @@ public class OpticalFlow {
}
public
void
IntersceneAccumulate
(
CLTParameters
clt_parameters
,
ColorProcParameters
colorProcParameters
,
QuadCLT
ref_scene
,
// ordered by increasing timestamps
int
debug_level
CLTParameters
clt_parameters
,
ColorProcParameters
colorProcParameters
,
QuadCLT
ref_scene
,
// ordered by increasing timestamps
double
[]
noise_sigma_level
,
int
debug_level
)
{
System
.
out
.
println
(
"IntersceneAccumulate(), scene timestamp="
+
ref_scene
.
getImageName
());
...
...
@@ -3130,10 +3131,11 @@ public class OpticalFlow {
scenes
[
indx_ref
]
=
ref_scene
;
for
(
int
i
=
0
;
i
<
sts
.
length
;
i
++)
{
scenes
[
i
]
=
ref_scene
.
spawnQuadCLT
(
scenes
[
i
]
=
ref_scene
.
spawnQuadCLT
WithNoise
(
// spawnQuadCLT
(
sts
[
i
],
clt_parameters
,
colorProcParameters
,
//
noise_sigma_level
,
// double [] noise_sigma_level,
threadsMax
,
-
1
);
// debug_level);
scenes
[
i
].
setDSRBG
(
...
...
@@ -3143,31 +3145,58 @@ public class OpticalFlow {
-
1
);
// debug_level); // int debugLevel)
}
final
double
[][]
combo_dsn
=
prepareInitialComboDS
(
clt_parameters
,
// final CLTParameters clt_parameters,
scenes
,
// final QuadCLT [] scenes,
indx_ref
,
// final int indx_ref,
debug_level
-
2
);
// final int debug_level);
final
double
[][]
combo_dsn_change
=
new
double
[
combo_dsn
.
length
+
1
][];
for
(
int
i
=
0
;
i
<
combo_dsn
.
length
;
i
++)
{
combo_dsn_change
[
i
]
=
combo_dsn
[
i
];
}
final
int
margin
=
8
;
final
int
tilesX
=
ref_scene
.
getTileProcessor
().
getTilesX
();
final
int
tilesY
=
ref_scene
.
getTileProcessor
().
getTilesY
();
//// final int tiles =tilesX * tilesY;
String
[]
combo_dsn_titles
=
{
"disp"
,
"strength"
,
"num_valid"
,
"change"
};
if
(
debug_level
>-
3
)
{
String
[]
dbg_titles
=
{
"disp"
,
"strength"
,
"num_valid"
};
(
new
ShowDoubleFloatArrays
()).
showArrays
(
combo_dsn
,
combo_dsn
_change
,
tilesX
,
tilesY
,
true
,