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
901f0a49
Commit
901f0a49
authored
Sep 06, 2020
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugging field calibration with GPU
parent
dd8f74c3
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1339 additions
and
325 deletions
+1339
-325
CLTParameters.java
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
+7
-2
GPUTileProcessor.java
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java
+20
-3
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+697
-131
ImageDttCPU.java
...ain/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
+3
-2
QuadCLT.java
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
+507
-158
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+105
-26
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+0
-3
No files found.
src/main/java/com/elphel/imagej/cameras/CLTParameters.java
View file @
901f0a49
...
...
@@ -167,7 +167,7 @@ public class CLTParameters {
public
boolean
inf_restore_disp
=
true
;
// Add disparity back to d{x,y}[i] (debug feature)
// Lazy eye parameters
public
boolean
ly_lma_ers
=
true
;
// Use 2020 LMA-based measurement of mismatch
public
boolean
ly_lma_ers
=
true
;
// Use 2020 LMA-based measurement of mismatch
(GPU-supported)
public
double
ly_gt_strength
=
0.18
;
// use some configurable parameters
public
boolean
ly_gt_use_wnd
=
true
;
//
public
double
ly_gt_rms
=
0.2
;
// split small source samples to FG/BG if all aux tile RMS exceeds this value
...
...
@@ -797,6 +797,7 @@ public class CLTParameters {
public
boolean
gpu_use_aux
=
false
;
// accelerate tile processor for the aux (lwir) quad camera
public
boolean
gpu_use_aux_macro
=
false
;
// accelerate tile processor for the aux (lwir) quad camera in macro mode
public
boolean
gpu_use_aux_adjust
=
false
;
// accelerate tile processor for the aux (lwir) quad camera for field calibration
public
boolean
gpu_debug_accum
=
false
;
// debug multi-tile TD accumulation
public
boolean
replaceWeakOutliers
=
true
;
// false;
...
...
@@ -1600,6 +1601,7 @@ public class CLTParameters {
properties
.
setProperty
(
prefix
+
"gpu_use_aux"
,
this
.
gpu_use_aux
+
""
);
properties
.
setProperty
(
prefix
+
"gpu_use_aux_macro"
,
this
.
gpu_use_aux_macro
+
""
);
properties
.
setProperty
(
prefix
+
"gpu_use_aux_adjust"
,
this
.
gpu_use_aux_adjust
+
""
);
properties
.
setProperty
(
prefix
+
"gpu_debug_accum"
,
this
.
gpu_debug_accum
+
""
);
properties
.
setProperty
(
prefix
+
"debug_initial_discriminate"
,
this
.
debug_initial_discriminate
+
""
);
properties
.
setProperty
(
prefix
+
"dbg_migrate"
,
this
.
dbg_migrate
+
""
);
...
...
@@ -2387,6 +2389,7 @@ public class CLTParameters {
if
(
properties
.
getProperty
(
prefix
+
"gpu_use_aux"
)!=
null
)
this
.
gpu_use_aux
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"gpu_use_aux"
));
if
(
properties
.
getProperty
(
prefix
+
"gpu_use_aux_macro"
)!=
null
)
this
.
gpu_use_aux_macro
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"gpu_use_aux_macro"
));
if
(
properties
.
getProperty
(
prefix
+
"gpu_use_aux_adjust"
)!=
null
)
this
.
gpu_use_aux_adjust
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"gpu_use_aux_adjust"
));
if
(
properties
.
getProperty
(
prefix
+
"gpu_debug_accum"
)!=
null
)
this
.
gpu_debug_accum
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"gpu_debug_accum"
));
if
(
properties
.
getProperty
(
prefix
+
"debug_initial_discriminate"
)!=
null
)
this
.
debug_initial_discriminate
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"debug_initial_discriminate"
));
if
(
properties
.
getProperty
(
prefix
+
"dbg_migrate"
)!=
null
)
this
.
dbg_migrate
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"dbg_migrate"
));
...
...
@@ -2612,7 +2615,7 @@ public class CLTParameters {
gd
.
addTab
(
"Lazy eye"
,
"Lazy eye parameters"
);
gd
.
addCheckbox
(
"Use 2020 LMA-based measurement of mismatch
"
,
this
.
ly_lma_ers
);
gd
.
addCheckbox
(
"Use 2020 LMA-based measurement of mismatch
(GPU-supported)"
,
this
.
ly_lma_ers
);
gd
.
addMessage
(
"--- main-to-aux depth map parameters ---"
);
gd
.
addNumericField
(
"Minimal reference (main) channel correlation strength"
,
this
.
ly_gt_strength
,
3
);
gd
.
addCheckbox
(
"Use window for AUX tiles to reduce weight of the hi-res tiles near low-res tile boundaries"
,
this
.
ly_gt_use_wnd
);
...
...
@@ -3337,6 +3340,7 @@ public class CLTParameters {
gd
.
addCheckbox
(
"Accelerate tile processor for the aux (lwir) quad camera"
,
this
.
gpu_use_aux
);
gd
.
addCheckbox
(
"Accelerate tile processor for the aux (lwir) quad camera in macro mode"
,
this
.
gpu_use_aux_macro
);
gd
.
addCheckbox
(
"Accelerate tile processor for the aux (lwir) quad camera for field calibration"
,
this
.
gpu_use_aux_adjust
);
gd
.
addCheckbox
(
"Debug multi-tile TD accumulation"
,
this
.
gpu_debug_accum
);
gd
.
addTab
(
"LWIR"
,
"parameters for LWIR/EO 8-camera rig"
);
this
.
lwir
.
dialogQuestions
(
gd
);
...
...
@@ -4097,6 +4101,7 @@ public class CLTParameters {
this
.
gpu_use_aux
=
gd
.
getNextBoolean
();
this
.
gpu_use_aux_macro
=
gd
.
getNextBoolean
();
this
.
gpu_use_aux_adjust
=
gd
.
getNextBoolean
();
this
.
gpu_debug_accum
=
gd
.
getNextBoolean
();
this
.
lwir
.
dialogAnswers
(
gd
);
...
...
src/main/java/com/elphel/imagej/gpu/GPUTileProcessor.java
View file @
901f0a49
...
...
@@ -222,6 +222,18 @@ public class GPUTileProcessor {
}
}
}
public
float
[][]
getDispDist
(){
return
disp_dist
;
}
public
float
[][]
getXY
(
boolean
use_aux
){
return
use_aux
?
xy_aux
:
xy
;
}
public
int
getTileY
(){
return
ty
;
}
public
int
getTileX
(){
return
tx
;
}
// convert this class instance to float array to match layout of the C struct
public
float
[]
asFloatArray
(
boolean
use_aux
)
{
...
...
@@ -2043,10 +2055,13 @@ public class GPUTileProcessor {
}
}
setCorrIndicesTdData
(
ntile
,
// int num_tiles, // corr_indices, fdata may be longer than needed
ntile
*
num_pairs
,
// int num_tiles, // corr_indices, fdata may be longer than needed
indices
,
// int [] corr_indices,
fdata
);
// float [] fdata);
return
indices
;
// trim indices
int
[]
indices_trim
=
new
int
[
ntile
*
num_pairs
];
System
.
arraycopy
(
indices
,
0
,
indices_trim
,
0
,
indices_trim
.
length
);
return
indices_trim
;
}
public
float
[][][][]
getCorrTilesTd
()
// [tileY][tileX][pair][4*64] , read all available pairs
...
...
@@ -2104,7 +2119,9 @@ public class GPUTileProcessor {
ntile
,
// int num_tiles, // corr_indices, fdata may be longer than needed
indices
,
// int [] corr_indices,
fdata
);
// float [] fdata);
return
indices
;
int
[]
indices_trim
=
new
int
[
ntile
];
System
.
arraycopy
(
indices
,
0
,
indices_trim
,
0
,
indices_trim
.
length
);
return
indices_trim
;
}
public
float
[][][]
getCorrTilesComboTd
()
// [tileY][tileX][4*64] , read all available pairs
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
901f0a49
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
View file @
901f0a49
...
...
@@ -1509,7 +1509,7 @@ public class ImageDttCPU {
}
// removing macro and FPGA modes
public
double
[][]
cltMeasureLazyEye
(
// returns d,s lazy eye parameters
public
double
[][]
cltMeasureLazyEye
(
// returns d,s lazy eye parameters
final
ImageDttParameters
imgdtt_params
,
// Now just extra correlation parameters, later will include, most others
final
int
[][]
tile_op
,
// [tilesY][tilesX] - what to do - 0 - nothing for this tile
final
double
[][]
disparity_array
,
// [tilesY][tilesX] - individual per-tile expected disparity
...
...
@@ -1753,6 +1753,7 @@ public class ImageDttCPU {
// filter only tiles with similar disparity to enable lazy eye for the ERS.
int
num_good_tiles
=
0
;
while
(
true
)
{
// num_good_tiles = 0; // FIXME: Was missing - uncomment?
int
mnTx
=
-
1
,
mnTy
=
-
1
,
mxTx
=
-
1
,
mxTy
=
-
1
;
double
mn
=
Double
.
NaN
;
double
mx
=
Double
.
NaN
;
...
...
@@ -2148,7 +2149,7 @@ public class ImageDttCPU {
imgdtt_params
.
lmas_max_rel_rms
,
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
imgdtt_params
.
lmas_min_strength
,
// minimal composite strength (sqrt(average amp squared over absolute RMS)
imgdtt_params
.
lmas_min_ac
,
// minimal of A and C coefficients maximum (measures sharpest point/line)
imgdtt_params
.
lmas_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lmas_max_area
,
//
double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
imgdtt_params
.
lma_str_offset
// convert lma-generated strength to match previous ones - add to result
)[
0
];
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLT.java
View file @
901f0a49
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
901f0a49
...
...
@@ -7403,17 +7403,37 @@ public class QuadCLTCPU {
tp
.
clt_3d_passes
.
get
(
refine_pass
),
// CLTPass3d scan,
"after_refinePassSetup-"
+
tp
.
clt_3d_passes
.
size
());
// Just debugging
if
(
clt_parameters
.
gpu_debug_accum
)
{
CLTMeasureCorrTesting
(
// perform single pass according to prepared tiles operations and disparity
clt_parameters
,
0
,
false
,
// true, // final boolean save_textures,
threadsMax
,
// maximal number of threads to launch
updateStatus
,
debugLevel
);
CLTMeasureCorrTesting
(
// perform single pass according to prepared tiles operations and disparity
clt_parameters
,
refine_pass
,
false
,
// true, // final boolean save_textures,
threadsMax
,
// maximal number of threads to launch
updateStatus
,
debugLevel
);
}
// End of just debugging
CLTMeasureCorr
(
// perform single pass according to prepared tiles operations and disparity
// image_data, // first index - number of image in a quad
// saturation_imp, //final boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters
,
refine_pass
,
false
,
// true, // final boolean save_textures,
threadsMax
,
// maximal number of threads to launch
updateStatus
,
debugLevel
);
if
(
debugLevel
>
-
1
){
System
.
out
.
println
(
"CLTMeasure("
+
refine_pass
+
")"
);
if
(
debugLevel
>
-
3
){
System
.
out
.
println
(
"CLTMeasure("
+
refine_pass
+
")-*"
);
}
if
(
show_init_refine
)
tp
.
showScan
(
tp
.
clt_3d_passes
.
get
(
refine_pass
),
// CLTPass3d scan,
...
...
@@ -7664,12 +7684,28 @@ public class QuadCLTCPU {
for
(
int
nTile
=
0
;
nTile
<
bg_use
.
length
;
nTile
++)
{
if
(
bg_sel
[
nTile
]
&&
(
filtered_bgnd_disp_strength
[
1
][
nTile
]
>
0.0
)
&&
(
bg_str
[
nTile
]
>
clt_parameters
.
fcorr_inf_strength
)
&&
((
bg_overexp
==
null
)
||
(
bg_overexp
[
nTile
]
<
clt_parameters
.
lym_overexp
))
(
bg_str
[
nTile
]
>
clt_parameters
.
fcorr_inf_strength
)
&&
// 0.13
((
bg_overexp
==
null
)
||
(
bg_overexp
[
nTile
]
<
clt_parameters
.
lym_overexp
))
//1e-4
){
bg_use
[
nTile
]
=
true
;
}
}
if
(
true
)
{
String
[]
dbg_titles
=
{
"fdisp"
,
"fstr"
,
"disp"
,
"str"
,
"overexp"
,
"sel"
,
"use"
};
double
[][]
ddd
=
{
filtered_bgnd_disp_strength
[
0
],
filtered_bgnd_disp_strength
[
1
],
null
,
bg_str
,
bg_overexp
,
null
,
null
};
ddd
[
5
]
=
new
double
[
bg_sel
.
length
];
ddd
[
6
]
=
new
double
[
bg_sel
.
length
];
for
(
int
nTile
=
0
;
nTile
<
bg_use
.
length
;
nTile
++)
{
ddd
[
5
][
nTile
]
=
bg_sel
[
nTile
]?
1.0
:
0.0
;
ddd
[
6
][
nTile
]
=
bg_use
[
nTile
]?
1.0
:
0.0
;
}
(
new
ShowDoubleFloatArrays
()).
showArrays
(
ddd
,
tp
.
getTilesX
(),
tp
.
getTilesY
(),
true
,
"filtered_bgnd_disp_strength"
,
dbg_titles
);
}
int
num_bg
=
tp
.
clt_3d_passes
.
get
(
bg_scan
).
setTileOpDisparity
(
// other minimal strength?
bg_use
,
// boolean [] selection,
null
);
// double [] disparity); // null for 0
...
...
@@ -7694,12 +7730,8 @@ public class QuadCLTCPU {
System
.
out
.
println
(
"Number of background tiles = "
+
num_bg
+
", number of lazy eye tiles = "
+
num_combo
);
}
// measure combo
CLTMeasure
(
// perform single pass according to prepared tiles operations and disparity
// image_data, // first index - number of image in a quad
// saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null
/*
CLTMeasure( // perform single pass according to prepared tiles operations and disparity **** CPU?
clt_parameters,
combo_scan,
false, // final boolean save_textures,
...
...
@@ -7708,9 +7740,18 @@ public class QuadCLTCPU {
tp.threadsMax, // maximal number of threads to launch
false, // updateStatus,
debugLevelInner - 1);
if
(!
batch_mode
&&
clt_parameters
.
show_extrinsic
&&
(
debugLevel
>-
1
))
{
*/
CLTMeasureCorr
(
// perform single pass according to prepared tiles operations and disparity **** CPU?
clt_parameters
,
combo_scan
,
false
,
// final boolean save_textures,
tp
.
threadsMax
,
// maximal number of threads to launch
false
,
// updateStatus,
debugLevelInner
-
1
);
if
(!
batch_mode
&&
clt_parameters
.
show_extrinsic
&&
(
debugLevel
>-
3
))
{
tp
.
showScan
(
tp
.
clt_3d_passes
.
get
(
bg_scan
),
// CLTPass3d scan,
tp
.
clt_3d_passes
.
get
(
bg_scan
),
// CLTPass3d scan,
badly filtered?
"bg_scan_post"
);
//String title)
tp
.
showScan
(
tp
.
clt_3d_passes
.
get
(
combo_scan
),
// CLTPass3d scan,
...
...
@@ -7755,7 +7796,25 @@ public class QuadCLTCPU {
combo_use
[
nTile
]
=
true
;
}
}
int
num_combo1
=
tp
.
clt_3d_passes
.
get
(
combo_scan
).
setTileOpDisparity
(
if
(
true
)
{
String
[]
dbg_titles
=
{
"fdisp"
,
"fstr"
,
"disp"
,
"str"
,
"overexp"
,
"sel"
,
"use"
};
double
[][]
ddd
=
{
filtered_combo_scand_isp_strength
[
0
],
filtered_combo_scand_isp_strength
[
1
],
combo_disp
,
combo_str
,
combo_overexp
,
null
,
null
};
ddd
[
5
]
=
new
double
[
combo_use
.
length
];
ddd
[
6
]
=
new
double
[
combo_use
.
length
];
for
(
int
nTile
=
0
;
nTile
<
combo_use
.
length
;
nTile
++)
{
//ddd[5][nTile] = bg_sel[nTile]?1.0:0.0;
ddd
[
6
][
nTile
]
=
combo_use
[
nTile
]?
1.0
:
0.0
;
}
(
new
ShowDoubleFloatArrays
()).
showArrays
(
ddd
,
tp
.
getTilesX
(),
tp
.
getTilesY
(),
true
,
"filtered_combo_scand_isp_strength"
,
dbg_titles
);
}
int
num_combo1
=
tp
.
clt_3d_passes
.
get
(
combo_scan
).
setTileOpDisparity
(
// GPU ==0 !
combo_use
,
// boolean [] selection,
combo_disp
);
// double [] disparity);
if
(
debugLevel
>
-
1
)
{
...
...
@@ -7772,7 +7831,7 @@ public class QuadCLTCPU {
dbg_bg_use
[
i
]
=
bg_use
[
i
]?
1.0
:
0.0
;
dbg_combo_use
[
i
]
=
combo_use
[
i
]?
1.0
:
0.0
;
}
double
[][]
dbg_img
=
{
double
[][]
dbg_img
=
{
// bg_use - all 0? (never assigned)?
filtered_bgnd_disp_strength
[
0
],
filtered_bgnd_disp_strength
[
1
],
filtered_combo_scand_isp_strength
[
0
],
...
...
@@ -7816,9 +7875,9 @@ public class QuadCLTCPU {
false
,
// updateStatus,
debugLevelInner
-
1
);
// - 1); // -5-1
if
(
debugLevel
>
-
2
)
{
tp
.
showScan
(
tp
.
clt_3d_passes
.
get
(
combo_scan
),
// CLTPass3d scan,
"LY_combo_scan-"
+
combo_scan
+
"_post"
);
//String title)
tp
.
showScan
(
tp
.
clt_3d_passes
.
get
(
combo_scan
),
// CLTPass3d scan,
"LY_combo_scan-"
+
combo_scan
+
"_post"
);
//String title)
}
int
tilesX
=
tp
.
getTilesX
();
...
...
@@ -7913,9 +7972,8 @@ public class QuadCLTCPU {
break
;
}
if
(
update_disp_from_latest
)
{
/*
CLTMeasure( // perform single pass according to prepared tiles operations and disparity
// image_data, // first index - number of image in a quad
// saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters,
combo_scan,
false, // final boolean save_textures,
...
...
@@ -7924,14 +7982,20 @@ public class QuadCLTCPU {
tp.threadsMax, // maximal number of threads to launch
false, // updateStatus,
debugLevelInner - 1);
*/
CLTMeasureCorr
(
// perform single pass according to prepared tiles operations and disparity
clt_parameters
,
combo_scan
,
false
,
// final boolean save_textures,
tp
.
threadsMax
,
// maximal number of threads to launch
false
,
// updateStatus,
debugLevelInner
-
1
);
}
}
else
{
}
else
{
// Old, no-GPU
double
[][]
bg_mismatch
=
new
double
[
12
][];
double
[][]
combo_mismatch
=
new
double
[
12
][];
CLTMeasure
(
// perform single pass according to prepared tiles operations and disparity
// image_data, // first index - number of image in a quad
// saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters
,
bg_scan
,
false
,
// final boolean save_textures,
...
...
@@ -7941,8 +8005,6 @@ public class QuadCLTCPU {
false
,
// updateStatus,
debugLevelInner
-
1
);
CLTMeasure
(
// perform single pass according to prepared tiles operations and disparity
// image_data, // first index - number of image in a quad
// saturation_imp, // boolean [][] saturation_imp, // (near) saturated pixels or null
clt_parameters
,
combo_scan
,
false
,
// final boolean save_textures,
...
...
@@ -11317,4 +11379,21 @@ public class QuadCLTCPU {
}
scan
.
setTilesRBGA
(
tileTones
);
}
// non-trivial in QuadCLT (for the GPU)
public
CLTPass3d
CLTMeasureCorrTesting
(
// perform single pass according to prepared tiles operations and disparity // not used in lwir
CLTParameters
clt_parameters
,
final
int
scanIndex
,
final
boolean
save_textures
,
final
int
threadsMax
,
// maximal number of threads to launch
final
boolean
updateStatus
,
final
int
debugLevel
)
{
return
CLTMeasureCorrTesting
(
// perform single pass according to prepared tiles operations and disparity // not used in lwir
clt_parameters
,
scanIndex
,
save_textures
,
threadsMax
,
// maximal number of threads to launch
updateStatus
,
debugLevel
);
}
}
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
901f0a49
...
...
@@ -8315,7 +8315,6 @@ if (debugLevel > -100) return true; // temporarily !
}
}
/*
boolean
ok
=
quadCLT_main
.
extrinsicsCLT
(
clt_parameters
,
// EyesisCorrectionParameters.CLTParameters clt_parameters,
false
,
// adjust_poly,
...
...
@@ -8325,8 +8324,6 @@ if (debugLevel > -100) return true; // temporarily !
// clear memory for main
quadCLT_main
.
tp
.
resetCLTPasses
();
if
(!
ok
)
break
;
*/
}
// Generate 4 main camera images and thumbnail
if
(
quadCLT_main
.
correctionsParameters
.
clt_batch_4img
){
...
...
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