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
ac185fe7
Commit
ac185fe7
authored
Aug 14, 2020
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring, combining with the GPU
parent
4a49fd62
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
12521 additions
and
11814 deletions
+12521
-11814
CLTParameters.java
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
+81
-14
Eyesis_Correction.java
.../java/com/elphel/imagej/correction/Eyesis_Correction.java
+50
-6
GPUTileProcessor.java
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java
+326
-171
AlignmentCorrection.java
.../com/elphel/imagej/tileprocessor/AlignmentCorrection.java
+6
-2
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+1
-3
ImageDttParameters.java
...a/com/elphel/imagej/tileprocessor/ImageDttParameters.java
+8
-8
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+900
-10969
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+11061
-0
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+88
-641
No files found.
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
View file @
ac185fe7
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/correction/Eyesis_Correction.java
View file @
ac185fe7
...
@@ -4906,7 +4906,7 @@ private Panel panel1,
...
@@ -4906,7 +4906,7 @@ private Panel panel1,
importAux
();
importAux
();
return
;
return
;
/* ======================================================================== */
/* ======================================================================== */
}
else
if
(
label
.
equals
(
"CLT 2*4 images"
))
{
}
else
if
(
label
.
equals
(
"CLT 2*4 images"
))
{
// never used
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
DEBUG_LEVEL
=
MASTER_DEBUG_LEVEL
;
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
EYESIS_CORRECTIONS
.
setDebug
(
DEBUG_LEVEL
);
getPairImages
();
getPairImages
();
...
@@ -5416,7 +5416,7 @@ private Panel panel1,
...
@@ -5416,7 +5416,7 @@ private Panel panel1,
return
true
;
return
true
;
}
}
public
boolean
getPairImages
()
{
public
boolean
getPairImages
()
{
// Never Used
if
(
QUAD_CLT
==
null
){
if
(
QUAD_CLT
==
null
){
QUAD_CLT
=
new
QuadCLT
(
QUAD_CLT
=
new
QuadCLT
(
QuadCLT
.
PREFIX
,
QuadCLT
.
PREFIX
,
...
@@ -5810,10 +5810,7 @@ private Panel panel1,
...
@@ -5810,10 +5810,7 @@ private Panel panel1,
if
(
GPU_QUAD
==
null
)
{
if
(
GPU_QUAD
==
null
)
{
try
{
try
{
GPU_QUAD
=
GPU_TILE_PROCESSOR
.
new
GpuQuad
(
GPU_QUAD
=
GPU_TILE_PROCESSOR
.
new
GpuQuad
(
2592
,
QUAD_CLT
,
1936
,
164
,
// final int kernels_hor,
123
,
// final int kernels_vert,
4
,
4
,
3
);
3
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -5822,6 +5819,7 @@ private Panel panel1,
...
@@ -5822,6 +5819,7 @@ private Panel panel1,
e
.
printStackTrace
();
e
.
printStackTrace
();
return
false
;
return
false
;
}
//final int debugLevel);
}
//final int debugLevel);
QUAD_CLT
.
setGPU
(
GPU_QUAD
);
}
}
// For now keep GPU_QUAD_AUX==null
// For now keep GPU_QUAD_AUX==null
...
@@ -6266,6 +6264,8 @@ private Panel panel1,
...
@@ -6266,6 +6264,8 @@ private Panel panel1,
public
boolean
batchLwir
()
{
public
boolean
batchLwir
()
{
long
startTime
=
System
.
nanoTime
();
long
startTime
=
System
.
nanoTime
();
// load needed sensor and kernels files
// load needed sensor and kernels files
if
(!
prepareRigImages
())
return
false
;
if
(!
prepareRigImages
())
return
false
;
String
configPath
=
getSaveCongigPath
();
String
configPath
=
getSaveCongigPath
();
...
@@ -6278,8 +6278,52 @@ private Panel panel1,
...
@@ -6278,8 +6278,52 @@ private Panel panel1,
/// if (COLOR_PROC_PARAMETERS_AUX == null) {
/// if (COLOR_PROC_PARAMETERS_AUX == null) {
/// COLOR_PROC_PARAMETERS_AUX = COLOR_PROC_PARAMETERS.clone();
/// COLOR_PROC_PARAMETERS_AUX = COLOR_PROC_PARAMETERS.clone();
/// }
/// }
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
);
}
if
(
CLT_PARAMETERS
.
useGPU
(
true
)
&&
(
QUAD_CLT_AUX
!=
null
)
&&
(
GPU_QUAD_AUX
==
null
))
{
// if GPU AUX is needed
try
{
GPU_QUAD_AUX
=
GPU_TILE_PROCESSOR
.
new
GpuQuad
(
//
QUAD_CLT_AUX
,
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_AUX
.
setGPU
(
GPU_QUAD_AUX
);
}
}
try
{
try
{
TWO_QUAD_CLT
.
batchLwirRig
(
TWO_QUAD_CLT
.
batchLwirRig
(
// GPU_QUAD, // GPUTileProcessor.GpuQuad gpuQuad_main, // may be null if GPU for MAIN is not use3d
// GPU_QUAD_AUX, // GPUTileProcessor.GpuQuad gpuQuad_aux, // may be null if GPU for AUX is not use3d
QUAD_CLT
,
// QuadCLT quadCLT_main,
QUAD_CLT
,
// QuadCLT quadCLT_main,
QUAD_CLT_AUX
,
// QuadCLT quadCLT_aux,
QUAD_CLT_AUX
,
// QuadCLT quadCLT_aux,
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
CLT_PARAMETERS
,
// EyesisCorrectionParameters.DCTParameters dct_parameters,
...
...
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java
View file @
ac185fe7
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/AlignmentCorrection.java
View file @
ac185fe7
...
@@ -48,7 +48,8 @@ public class AlignmentCorrection {
...
@@ -48,7 +48,8 @@ public class AlignmentCorrection {
static
final
int
INDEX_14_DISPARITY
=
0
;
static
final
int
INDEX_14_DISPARITY
=
0
;
static
final
double
DISP_SCALE
=
2.0
;
static
final
double
DISP_SCALE
=
2.0
;
QuadCLT
qc
;
QuadCLT
qc_gpu
;
// maybe will be used later?
QuadCLTCPU
qc
;
public
class
Sample
{
public
class
Sample
{
public
int
series
;
public
int
series
;
...
@@ -265,9 +266,12 @@ public class AlignmentCorrection {
...
@@ -265,9 +266,12 @@ public class AlignmentCorrection {
}
}
//System.arraycopy(dpixels, (tileY*width+tileX)*dct_size + i*width, tile_in, i*n2, n2);
//System.arraycopy(dpixels, (tileY*width+tileX)*dct_size + i*width, tile_in, i*n2, n2);
AlignmentCorrection
(
QuadCLT
qc
){
AlignmentCorrection
(
QuadCLT
CPU
qc
){
this
.
qc
=
qc
;
this
.
qc
=
qc
;
}
}
AlignmentCorrection
(
QuadCLT
qc
){
this
.
qc_gpu
=
qc
;
}
public
double
[][][]
infinityCorrection
(
public
double
[][][]
infinityCorrection
(
final
boolean
use_poly
,
final
boolean
use_poly
,
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
ac185fe7
...
@@ -2364,7 +2364,6 @@ public class ImageDtt {
...
@@ -2364,7 +2364,6 @@ public class ImageDtt {
final
double
[][][][]
clt_corr_combo
,
// [type][tilesY][tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
final
double
[][][][]
clt_corr_combo
,
// [type][tilesY][tilesX][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
// [type][tilesY][tilesX] should be set by caller
// [type][tilesY][tilesX] should be set by caller
// types: 0 - selected correlation (product+offset), 1 - sum
// types: 0 - selected correlation (product+offset), 1 - sum
final
double
[][][][][]
clt_corr_partial
,
// [tilesY][tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
final
double
[][][][][]
clt_corr_partial
,
// [tilesY][tilesX][quad]color][(2*transform_size-1)*(2*transform_size-1)] // if null - will not calculate
// [tilesY][tilesX] should be set by caller
// [tilesY][tilesX] should be set by caller
// When clt_mismatch is non-zero, no far objects extraction will be attempted
// When clt_mismatch is non-zero, no far objects extraction will be attempted
...
@@ -2374,7 +2373,6 @@ public class ImageDtt {
...
@@ -2374,7 +2373,6 @@ public class ImageDtt {
final
double
[][]
disparity_map
,
// [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
final
double
[][]
disparity_map
,
// [8][tilesY][tilesX], only [6][] is needed on input or null - do not calculate
// last 2 - contrast, avg/ "geometric average)
// last 2 - contrast, avg/ "geometric average)
final
double
[][][][]
texture_tiles
,
// [tilesY][tilesX]["RGBA".length()][]; null - will skip images combining
final
double
[][][][]
texture_tiles
,
// [tilesY][tilesX]["RGBA".length()][]; null - will skip images combining
final
int
width
,
final
int
width
,
final
double
corr_fat_zero
,
// add to denominator to modify phase correlation (same units as data1, data2). <0 - pure sum
final
double
corr_fat_zero
,
// add to denominator to modify phase correlation (same units as data1, data2). <0 - pure sum
final
boolean
corr_sym
,
final
boolean
corr_sym
,
...
@@ -3230,7 +3228,7 @@ public class ImageDtt {
...
@@ -3230,7 +3228,7 @@ public class ImageDtt {
disparity_map
[
DISPARITY_INDEX_POLY
]
[
tIndex
]
=
lma_disparity_strength
[
0
];
disparity_map
[
DISPARITY_INDEX_POLY
]
[
tIndex
]
=
lma_disparity_strength
[
0
];
// if enabled overwrite - replace DISPARITY_INDEX_CM and DISPARITY_STRENGTH_INDEX
// if enabled overwrite - replace DISPARITY_INDEX_CM and DISPARITY_STRENGTH_INDEX
if
(
imgdtt_params
.
mix_corr_poly
)
{
if
(
imgdtt_params
.
mix_corr_poly
)
{
//true
disp_str
[
0
]
=
lma_disparity_strength
[
0
];
disp_str
[
0
]
=
lma_disparity_strength
[
0
];
disp_str
[
1
]
=
lma_disparity_strength
[
1
];
disp_str
[
1
]
=
lma_disparity_strength
[
1
];
disparity_map
[
DISPARITY_INDEX_CM
]
[
tIndex
]
=
disp_str
[
0
];
disparity_map
[
DISPARITY_INDEX_CM
]
[
tIndex
]
=
disp_str
[
0
];
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDttParameters.java
View file @
ac185fe7
...
@@ -30,14 +30,14 @@ import com.elphel.imagej.common.GenericJTabbedDialog;
...
@@ -30,14 +30,14 @@ import com.elphel.imagej.common.GenericJTabbedDialog;
public
class
ImageDttParameters
{
public
class
ImageDttParameters
{
public
boolean
corr_mode_debug
=
true
;
public
boolean
corr_mode_debug
=
true
;
public
boolean
mix_corr_poly
=
true
;
public
boolean
mix_corr_poly
=
true
;
public
double
min_poly_strength
=
0.2
;
public
double
min_poly_strength
=
0.2
;
/// 0.1
public
double
max_poly_hwidth
=
2.5
;
// Maximal polynomial approximation half-width (in both directions)
public
double
max_poly_hwidth
=
2.5
;
// Maximal polynomial approximation half-width (in both directions)
public
double
poly_corr_scale
=
2.0
;
// Shift value if correlation maximum is wide in X than in Y to detect near objects (negative - far ones)
public
double
poly_corr_scale
=
2.0
;
//
/ 0.0 //
Shift value if correlation maximum is wide in X than in Y to detect near objects (negative - far ones)
public
double
poly_pwr
=
1.0
;
public
double
poly_pwr
=
1.0
;
public
double
poly_vasw_pwr
=
2.0
;
// raise value to this power and apply as weight (0 - disable)
public
double
poly_vasw_pwr
=
2.0
;
// raise value to this power and apply as weight (0 - disable)
public
double
corr_magic_scale_cm
=
1.0
;
//0.85; // reported correlation offset vs. actual one (not yet understood)
public
double
corr_magic_scale_cm
=
1.0
;
//
/ 1.0 //
0.85; // reported correlation offset vs. actual one (not yet understood)
public
double
corr_magic_scale_poly
=
1.0
;
// 0.95; // reported correlation offset vs. actual one (not yet understood)
public
double
corr_magic_scale_poly
=
1.0
;
//
/ 1.0 //
0.95; // reported correlation offset vs. actual one (not yet understood)
public
int
ortho_height
=
7
;
// height of non-zero weights for hor/vert correlation to compensate borders
public
int
ortho_height
=
7
;
// height of non-zero weights for hor/vert correlation to compensate borders
public
double
ortho_eff_height
=
2.58
;
// effective correlation stripe height to match strengths
public
double
ortho_eff_height
=
2.58
;
// effective correlation stripe height to match strengths
...
@@ -50,7 +50,7 @@ public class ImageDttParameters {
...
@@ -50,7 +50,7 @@ public class ImageDttParameters {
private
double
enhortho_scale
=
0.0
;
// 0.2; // multiply center correlation pixels (inside enhortho_width)
private
double
enhortho_scale
=
0.0
;
// 0.2; // multiply center correlation pixels (inside enhortho_width)
private
double
enhortho_scale_aux
=
0.0
;
// 0.2; // multiply center correlation pixels (inside enhortho_width)
private
double
enhortho_scale_aux
=
0.0
;
// 0.2; // multiply center correlation pixels (inside enhortho_width)
public
boolean
ly_poly
=
false
;
// Use polynomial when measuring mismatch (false - use center of mass)
public
boolean
ly_poly
=
false
;
// Use polynomial when measuring mismatch (false - use center of mass)
public
double
ly_crazy_poly
=
1.0
;
// Maximal allowed mismatch difference calculated as polynomial maximum
public
double
ly_crazy_poly
=
1.0
;
///2.0
// Maximal allowed mismatch difference calculated as polynomial maximum
public
boolean
ly_poly_backup
=
true
;
// Use CM offset measuremets if poly failed
public
boolean
ly_poly_backup
=
true
;
// Use CM offset measuremets if poly failed
public
boolean
fo_correct
=
true
;
// correct far objects by comparing orthogonal correlations
public
boolean
fo_correct
=
true
;
// correct far objects by comparing orthogonal correlations
...
@@ -111,7 +111,7 @@ public class ImageDttParameters {
...
@@ -111,7 +111,7 @@ public class ImageDttParameters {
public
double
lmas_lambda_initial
=
0.03
;
//
public
double
lmas_lambda_initial
=
0.03
;
//
public
double
lmas_rms_diff
=
0.0003
;
//
public
double
lmas_rms_diff
=
0.0003
;
//
public
int
lmas_num_iter
=
20
;
//
public
int
lmas_num_iter
=
20
;
//
/10
// Filtering and strength calculation
// Filtering and strength calculation
public
double
lmas_max_rel_rms
=
0.3
;
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
public
double
lmas_max_rel_rms
=
0.3
;
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
public
double
lmas_min_strength
=
0.7
;
// minimal composite strength (sqrt(average amp squared over absolute RMS)
public
double
lmas_min_strength
=
0.7
;
// minimal composite strength (sqrt(average amp squared over absolute RMS)
...
@@ -141,8 +141,8 @@ public class ImageDttParameters {
...
@@ -141,8 +141,8 @@ public class ImageDttParameters {
public
double
lma_half_width
=
2.0
;
//
public
double
lma_half_width
=
2.0
;
//
public
double
lma_cost_wy
=
0.0
;
// cost of parallel-to-disparity correction
public
double
lma_cost_wy
=
0.0
;
/// 0.00050
// cost of parallel-to-disparity correction
public
double
lma_cost_wxy
=
0.0
;
// cost of ortho-to-disparity correction
public
double
lma_cost_wxy
=
0.0
;
/// 0.00100
// cost of ortho-to-disparity correction
public
double
lma_lambda_initial
=
0.03
;
//
public
double
lma_lambda_initial
=
0.03
;
//
public
double
lma_lambda_scale_good
=
0.5
;
//
public
double
lma_lambda_scale_good
=
0.5
;
//
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
ac185fe7
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
0 → 100644
View file @
ac185fe7
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
ac185fe7
This diff is collapsed.
Click to expand it.
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