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
9a8fd5dc
Commit
9a8fd5dc
authored
Apr 17, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugging far split, before updating of usage of split FG/BG
parent
b6394c1f
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
218 additions
and
124 deletions
+218
-124
Corr2dLMA.java
src/main/java/com/elphel/imagej/tileprocessor/Corr2dLMA.java
+40
-7
Correlation2d.java
...n/java/com/elphel/imagej/tileprocessor/Correlation2d.java
+8
-10
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+70
-7
ImageDttCPU.java
...ain/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
+14
-12
ImageDttParameters.java
...a/com/elphel/imagej/tileprocessor/ImageDttParameters.java
+7
-1
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+79
-87
No files found.
src/main/java/com/elphel/imagej/tileprocessor/Corr2dLMA.java
View file @
9a8fd5dc
...
@@ -2605,7 +2605,8 @@ public class Corr2dLMA {
...
@@ -2605,7 +2605,8 @@ public class Corr2dLMA {
double
lma_max_area
,
// maximal half-area (if > 0.0)
double
lma_max_area
,
// maximal half-area (if > 0.0)
double
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
double
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
double
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
double
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
double
lma_ac_offset
// add to a,c coefficients for near-lines where A,C could become negative because of window
double
lma_ac_offset
,
// add to a,c coefficients for near-lines where A,C could become negative because of window
double
lma_relax_indiv_max
// double relax_indiv_max
){
){
return
lmaDisparityStrengths
(
return
lmaDisparityStrengths
(
bypass_tests
,
//boolean bypass_tests, // keep even weak for later analysis. Normally - only in test mode
bypass_tests
,
//boolean bypass_tests, // keep even weak for later analysis. Normally - only in test mode
...
@@ -2619,7 +2620,8 @@ public class Corr2dLMA {
...
@@ -2619,7 +2620,8 @@ public class Corr2dLMA {
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
false
,
// boolean dbg_mode
false
,
// boolean dbg_mode
lma_ac_offset
// add to a,c coefficients for near-lines where A,C could become negative because of window
lma_ac_offset
,
// add to a,c coefficients for near-lines where A,C could become negative because of window
lma_relax_indiv_max
// double relax_indiv_max
)[
0
];
)[
0
];
}
}
...
@@ -2636,12 +2638,19 @@ public class Corr2dLMA {
...
@@ -2636,12 +2638,19 @@ public class Corr2dLMA {
double
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
double
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
double
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
double
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
boolean
dbg_mode
,
boolean
dbg_mode
,
double
lma_ac_offset
// add to a,c coefficients for near-lines where A,C could become negative because of window
double
lma_ac_offset
,
// add to a,c coefficients for near-lines where A,C could become negative because of window
double
relax_indiv_max
// = 2.0; // relax lma_max_rel_rms and lma_min_strength for individual maximum
){
){
// double relax_indiv_max = 2.0; // relax lma_max_rel_rms and lma_min_strength for individual maximum
// from the best one
double
[][][]
ds
=
new
double
[
numMax
][
numTiles
][
dbg_mode
?
14
:
3
];
double
[][][]
ds
=
new
double
[
numMax
][
numTiles
][
dbg_mode
?
14
:
3
];
int
reason_index
=
(
dbg_mode
&&
bypass_tests
)?
13
:-
1
;
int
reason_index
=
(
dbg_mode
&&
bypass_tests
)?
13
:-
1
;
double
[]
rms
=
getRmsTile
();
double
[]
rms
=
getRmsTile
();
double
[]
avg_g
=
new
double
[
numTiles
];
// best avg among all maximums
for
(
int
tile
=
0
;
tile
<
numTiles
;
tile
++)
{
double
[][]
maxmaxmin_amp
=
getMaxMaxMinAmpTile
();
avg_g
[
tile
]
=
0.50
*(
maxmaxmin_amp
[
tile
][
0
]+
maxmaxmin_amp
[
tile
][
1
]);
}
for
(
int
nmax
=
0
;
nmax
<
numMax
;
nmax
++)
{
for
(
int
nmax
=
0
;
nmax
<
numMax
;
nmax
++)
{
double
[][]
maxmin_amp
=
getMaxMinAmpTile
(
nmax
);
// nmax
double
[][]
maxmin_amp
=
getMaxMinAmpTile
(
nmax
);
// nmax
double
[][]
abc
=
getABCTile
(
nmax
);
// nmax
double
[][]
abc
=
getABCTile
(
nmax
);
// nmax
...
@@ -2673,7 +2682,10 @@ public class Corr2dLMA {
...
@@ -2673,7 +2682,10 @@ public class Corr2dLMA {
}
}
double
avg
=
0.50
*(
maxmin_amp
[
tile
][
0
]+
maxmin_amp
[
tile
][
1
]);
// max_min[1] can be negative - filter it out?
double
avg
=
0.50
*(
maxmin_amp
[
tile
][
0
]+
maxmin_amp
[
tile
][
1
]);
// max_min[1] can be negative - filter it out?
double
rrms
=
rms
[
tile
]/
avg
;
double
rrms
=
rms
[
tile
]/
avg
;
if
((
lma_max_rel_rms
>
0.00
)
&&
(
rrms
>
lma_max_rel_rms
))
{
double
rrms_g
=
rms
[
tile
]/
avg_g
[
tile
];
if
((
lma_max_rel_rms
>
0.0
)
&&
(
(
rrms
>
(
lma_max_rel_rms
*
relax_indiv_max
))
||
// compare for this maximum
(
rrms_g
>
lma_max_rel_rms
)
))
{
// compare for the best maximum
if
(
bypass_tests
)
{
if
(
bypass_tests
)
{
if
((
reason_index
>
0
)
&&
(
ds
[
nmax
][
tile
][
reason_index
]
==
0
))
ds
[
nmax
][
tile
][
reason_index
]
=
1
;
if
((
reason_index
>
0
)
&&
(
ds
[
nmax
][
tile
][
reason_index
]
==
0
))
ds
[
nmax
][
tile
][
reason_index
]
=
1
;
}
else
{
}
else
{
...
@@ -2713,8 +2725,10 @@ public class Corr2dLMA {
...
@@ -2713,8 +2725,10 @@ public class Corr2dLMA {
}
}
}
}
double
strength
=
Math
.
sqrt
(
avg
/
rrms
);
double
strength
=
Math
.
sqrt
(
avg
/
rrms
);
// double disparity = -all_pars[DISP_INDEX + offs];
double
strength_g
=
Math
.
sqrt
(
avg_g
[
tile
]/
rrms_g
);
if
((
strength
<
lma_min_strength
)
||
Double
.
isNaN
(
disparity
))
{
if
(
(
strength
<
(
lma_min_strength
/
relax_indiv_max
))
||
// compare for this maximum
(
strength_g
<
lma_min_strength
)
||
// compare for the strongest maximum
Double
.
isNaN
(
disparity
))
{
if
(
bypass_tests
)
{
if
(
bypass_tests
)
{
if
((
reason_index
>
0
)
&&
(
ds
[
nmax
][
tile
][
reason_index
]
==
0
))
ds
[
nmax
][
tile
][
reason_index
]
=
6
;
if
((
reason_index
>
0
)
&&
(
ds
[
nmax
][
tile
][
reason_index
]
==
0
))
ds
[
nmax
][
tile
][
reason_index
]
=
6
;
}
else
{
}
else
{
...
@@ -2974,6 +2988,25 @@ public class Corr2dLMA {
...
@@ -2974,6 +2988,25 @@ public class Corr2dLMA {
}
}
return
maxmins
;
return
maxmins
;
}
}
/**
* Find maximal values for each element of maxmins among all maximums (currently 1 or 2)
* @return
*/
public
double
[][]
getMaxMaxMinAmpTile
(){
double
[][]
maxmaxmins
=
getMaxMinAmpTile
(
0
);
for
(
int
nmax
=
1
;
nmax
<
numMax
;
nmax
++)
{
// compare with all other maximums
double
[][]
maxmins
=
getMaxMinAmpTile
(
nmax
);
for
(
int
tile
=
0
;
tile
<
numTiles
;
tile
++)
{
maxmaxmins
[
tile
][
0
]
=
Math
.
max
(
maxmaxmins
[
tile
][
0
],
maxmins
[
tile
][
0
]);
maxmaxmins
[
tile
][
1
]
=
Math
.
max
(
maxmaxmins
[
tile
][
1
],
maxmins
[
tile
][
1
]);
}
}
return
maxmaxmins
;
}
/**
/**
* Get maximal/minimal (per pair) amplitudes and values for each tile
* Get maximal/minimal (per pair) amplitudes and values for each tile
* @return array [tile][{vmax, vmin}]
* @return array [tile][{vmax, vmin}]
...
...
src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java
View file @
9a8fd5dc
...
@@ -3838,7 +3838,8 @@ public class Correlation2d {
...
@@ -3838,7 +3838,8 @@ public class Correlation2d {
imgdtt_params
.
lma_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lma_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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_relax_indiv_max
// double lma_relax_indiv_max // double relax_indiv_max
);
);
if
(
debug_level
>
0
)
lma
.
printStats
(
ds
,
clust_width
);
if
(
debug_level
>
0
)
lma
.
printStats
(
ds
,
clust_width
);
...
@@ -3943,7 +3944,8 @@ public class Correlation2d {
...
@@ -3943,7 +3944,8 @@ public class Correlation2d {
imgdtt_params
.
lma_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lma_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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_relax_indiv_max
// double lma_relax_indiv_max // double relax_indiv_max
);
);
if
(
debug_level
>
0
)
{
// -2) {
if
(
debug_level
>
0
)
{
// -2) {
lma
.
printStats
(
ds
,
clust_width
);
lma
.
printStats
(
ds
,
clust_width
);
...
@@ -4452,8 +4454,8 @@ public class Correlation2d {
...
@@ -4452,8 +4454,8 @@ public class Correlation2d {
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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_relax_indiv_max
// double lma_relax_indiv_max // double relax_indiv_max
);
);
if
(
dispStr
[
0
][
1
]
<=
0
)
{
if
(
dispStr
[
0
][
1
]
<=
0
)
{
lmaSuccess
=
false
;
lmaSuccess
=
false
;
...
@@ -4985,12 +4987,8 @@ public class Correlation2d {
...
@@ -4985,12 +4987,8 @@ public class Correlation2d {
imgdtt_params
.
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
false
,
// boolean dbg_mode
false
,
// boolean dbg_mode
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_relax_indiv_max
// double lma_relax_indiv_max // double relax_indiv_max
);
);
for
(
int
nmax
=
00
;
nmax
<
dispStrs
.
length
;
nmax
++)
if
(
dispStrs
[
nmax
][
0
][
1
]
<=
0
)
{
for
(
int
nmax
=
00
;
nmax
<
dispStrs
.
length
;
nmax
++)
if
(
dispStrs
[
nmax
][
0
][
1
]
<=
0
)
{
lmaSuccess
=
false
;
lmaSuccess
=
false
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
9a8fd5dc
...
@@ -2110,8 +2110,9 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -2110,8 +2110,9 @@ public class ImageDtt extends ImageDttCPU {
if
(
maxes
.
length
==
1
)
{
// normally should be just one. If 2 - OK, use old splitting (abnormal)
if
(
maxes
.
length
==
1
)
{
// normally should be just one. If 2 - OK, use old splitting (abnormal)
maxes
=
split_far_max
(
maxes
=
split_far_max
(
maxes
[
0
],
// double [] max,
maxes
[
0
],
// double [] max,
far_fgbg
[
nTile
][
0
],
// double diff,
far_fgbg
[
nTile
][
0
],
// double fg_targ,
far_fgbg
[
nTile
][
1
],
// double kfg,
far_fgbg
[
nTile
][
1
],
// double bg_targ,
far_fgbg
[
nTile
][
2
],
// double kfg,
imgdtt_params
.
mcorr_dual_fract
);
// 0.1); // double min_k);
imgdtt_params
.
mcorr_dual_fract
);
// 0.1); // double min_k);
if
(
maxes
==
null
)
{
if
(
maxes
==
null
)
{
continue
;
continue
;
...
@@ -2202,7 +2203,8 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -2202,7 +2203,8 @@ public class ImageDtt extends ImageDttCPU {
imgdtt_params
.
lma_str_scale
,
// convert lma-generated strength to match previous ones - scale
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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
dbg_dispStrs
,
// false // boolean dbg_mode
dbg_dispStrs
,
// false // boolean dbg_mode
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_relax_indiv_max
// double lma_relax_indiv_max // double relax_indiv_max
);
);
disp_str_lma
=
new
double
[
dispStrs
.
length
][];
// order matching input ones
disp_str_lma
=
new
double
[
dispStrs
.
length
][];
// order matching input ones
for
(
int
nmax
=
0
;
nmax
<
dispStrs
.
length
;
nmax
++)
{
for
(
int
nmax
=
0
;
nmax
<
dispStrs
.
length
;
nmax
++)
{
...
@@ -2245,6 +2247,14 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -2245,6 +2247,14 @@ public class ImageDtt extends ImageDttCPU {
// set BG to DISPARITY_INDEX_CM/DISPARITY_INDEX_CM+1
// set BG to DISPARITY_INDEX_CM/DISPARITY_INDEX_CM+1
disparity_map
[
DISPARITY_INDEX_CM
][
nTile
]
=
disp_str_lma
[
1
-
indx
][
0
];
// disparity LMA
disparity_map
[
DISPARITY_INDEX_CM
][
nTile
]
=
disp_str_lma
[
1
-
indx
][
0
];
// disparity LMA
disparity_map
[
DISPARITY_INDEX_CM
+
1
][
nTile
]
=
disp_str_lma
[
1
-
indx
][
2
];
// strength LMA
disparity_map
[
DISPARITY_INDEX_CM
+
1
][
nTile
]
=
disp_str_lma
[
1
-
indx
][
2
];
// strength LMA
if
(
debugTile1
)
{
// FIXME: remove debugTile1!
System
.
out
.
println
(
"clt_process_tl_correlations() disp_str_lma:"
);
for
(
int
nmax
=
0
;
nmax
<
disp_str_lma
.
length
;
nmax
++)
{
System
.
out
.
println
(
String
.
format
(
"disp_str_lma[%d][0]=%f, disp_str_lma[%d][1]=%f disp_str_lma[%d][2]=%f"
,
nmax
,
disp_str_lma
[
nmax
][
0
],
nmax
,
disp_str_lma
[
nmax
][
1
],
nmax
,
disp_str_lma
[
nmax
][
2
]));
}
}
}
}
}
else
{
}
else
{
disparity_map
[
DISPARITY_INDEX_CM
][
nTile
]
=
disp_str_sel
[
0
][
0
];
// disparity non-LMA
disparity_map
[
DISPARITY_INDEX_CM
][
nTile
]
=
disp_str_sel
[
0
][
0
];
// disparity non-LMA
...
@@ -2342,7 +2352,8 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -2342,7 +2352,8 @@ public class ImageDtt extends ImageDttCPU {
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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_relax_indiv_max
// double lma_relax_indiv_max // double relax_indiv_max
);
);
if
(
ds
!=
null
)
{
// always true
if
(
ds
!=
null
)
{
// always true
// if (disparity_map!=null) {
// if (disparity_map!=null) {
...
@@ -2499,9 +2510,59 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -2499,9 +2510,59 @@ public class ImageDtt extends ImageDttCPU {
return
null
;
// too large difference between strong and weak;
return
null
;
// too large difference between strong and weak;
}
}
return
maxes
;
return
maxes
;
}
/**
* Providing initial 2-max for LMA using provided hints
* There can be 3 cases:
* 1 - initial run where target disparity is a combined (unresolved) maximum (trust only difference and kfg)
* 2 - Refining FG - target_disparity is FG (found after initial run), so fg_targ==0,
* bg_target defined from the first run
* 3 - Refining BG - target_disparity is BG (found in initial run, nut during refining FG), bg_targ=0
* input max[] is accurate only when centered, can not be trusted when target_disparity was offset (either FG or BG)
*
* @param max disparity+strength of a single unresolved maximum using center-of-mass (or poly?) method
* @param fg_targ FG disparity hint relative to target disparity
* @param bg_targ BG disparity hint relative to target disparity
* @param kfg strength fraction of the FG maximum (0.5 - equal FG/BG strength)
* @param min_k do not try to process camel case if one maximum is much weaker than the other
* @return a pair of d/s pairs, starting with a strongest one. Null on failure.
*/
public
static
double
[][]
split_far_max
(
double
[]
max
,
double
fg_targ
,
double
bg_targ
,
double
kfg
,
double
min_k
){
if
(((
kfg
<
min_k
)
||
((
1.0
-
kfg
)
<
min_k
)))
{
return
null
;
// one of the maximums is too weak with respect to the other
}
double
[][]
maxes
=
new
double
[
2
][
2
];
if
(
kfg
<=
0
)
{
return
null
;
//diff and kfg can not be 0.0 simultaneously (or use this case for something?)
}
if
((
fg_targ
!=
0.0
)
&&
(
bg_targ
!=
0.0
))
{
// initial run that used average
double
diff
=
fg_targ
-
bg_targ
;
maxes
[
0
][
0
]
=
max
[
0
]
+
diff
*
(
1.0
-
kfg
);
// disparity(FG)
maxes
[
1
][
0
]
=
max
[
0
]
-
diff
*
kfg
;
// disparity(BG)
}
else
{
// refinement run when target_disparity was either FG or BG, so either fg_targ or bg_targ is 0
maxes
[
0
][
0
]
=
fg_targ
;
// disparity(FG)
maxes
[
1
][
0
]
=
bg_targ
;
// disparity(BG)
}
maxes
[
0
][
1
]
=
max
[
1
]
*
kfg
;
// strength(FG)
maxes
[
1
][
1
]
=
max
[
1
]
*
(
1.0
-
kfg
);
// strength(BG)
if
(
maxes
[
1
][
1
]
>
maxes
[
0
][
1
])
{
double
[]
tmp
=
maxes
[
0
];
maxes
[
0
]
=
maxes
[
1
];
maxes
[
1
]=
tmp
;
}
if
((
maxes
[
0
][
1
]
/
maxes
[
1
][
1
])
>
(
1.0
-
min_k
)/
min_k
)
{
return
null
;
// too large difference between strong and weak;
}
return
maxes
;
}
}
public
void
clt_process_tl_correlations_GPU_DBG
(
// convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
public
void
clt_process_tl_correlations_GPU_DBG
(
// convert to pixel domain and process correlations already prepared in fcorr_td and/or fcorr_combo_td
...
@@ -3877,7 +3938,8 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -3877,7 +3938,8 @@ public class ImageDtt extends ImageDttCPU {
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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_relax_indiv_max
// double lma_relax_indiv_max // double relax_indiv_max
)[
0
];
)[
0
];
if
(
tile_lma_debug_level
>
0
)
{
if
(
tile_lma_debug_level
>
0
)
{
double
[][]
ds_dbg
=
{
disp_str
};
double
[][]
ds_dbg
=
{
disp_str
};
...
@@ -4176,7 +4238,8 @@ public class ImageDtt extends ImageDttCPU {
...
@@ -4176,7 +4238,8 @@ public class ImageDtt extends ImageDttCPU {
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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_relax_indiv_max
// double lma_relax_indiv_max // double relax_indiv_max
)[
0
];
)[
0
];
if
(
tile_lma_debug_level
>
0
)
{
if
(
tile_lma_debug_level
>
0
)
{
double
[][]
ds_dbg
=
{
disp_str
};
double
[][]
ds_dbg
=
{
disp_str
};
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
View file @
9a8fd5dc
...
@@ -2212,7 +2212,8 @@ public class ImageDttCPU {
...
@@ -2212,7 +2212,8 @@ public class ImageDttCPU {
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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_relax_indiv_max
// double lma_relax_indiv_max // double relax_indiv_max
)[
0
];
)[
0
];
if
((
disp_str
[
cTile
]!=
null
)
&&
Double
.
isNaN
(
disp_str
[
cTile
][
1
]))
{
if
((
disp_str
[
cTile
]!=
null
)
&&
Double
.
isNaN
(
disp_str
[
cTile
][
1
]))
{
System
.
out
.
println
();
System
.
out
.
println
();
...
@@ -2397,7 +2398,8 @@ public class ImageDttCPU {
...
@@ -2397,7 +2398,8 @@ public class ImageDttCPU {
imgdtt_params
.
lma_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
imgdtt_params
.
lma_max_area
,
//double lma_max_area, // maximal half-area (if > 0.0)
1.0
,
// imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale
1.0
,
// imgdtt_params.lma_str_scale, // convert lma-generated strength to match previous ones - scale
0.0
,
// convert lma-generated strength to match previous ones - add to result
0.0
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
);
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_relax_indiv_max
);
// double lma_relax_indiv_max // double relax_indiv_max
// double [][] extra_stats = lma2.getTileStats();
// double [][] extra_stats = lma2.getTileStats();
if
(
debugCluster
)
{
if
(
debugCluster
)
{
...
@@ -3134,8 +3136,8 @@ public class ImageDttCPU {
...
@@ -3134,8 +3136,8 @@ public class ImageDttCPU {
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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
);
imgdtt_params
.
lma_relax_indiv_max
);
// double lma_relax_indiv_max // double relax_indiv_max
if
(
ds
!=
null
)
{
// always true
if
(
ds
!=
null
)
{
// always true
disparity_map
[
DISPARITY_INDEX_POLY
][
tIndex
]
=
ds
[
0
][
0
];
disparity_map
[
DISPARITY_INDEX_POLY
][
tIndex
]
=
ds
[
0
][
0
];
disparity_map
[
DISPARITY_INDEX_POLY
+
1
][
tIndex
]
=
ds
[
0
][
1
];
disparity_map
[
DISPARITY_INDEX_POLY
+
1
][
tIndex
]
=
ds
[
0
][
1
];
...
@@ -4232,8 +4234,8 @@ public class ImageDttCPU {
...
@@ -4232,8 +4234,8 @@ public class ImageDttCPU {
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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
);
imgdtt_params
.
lma_relax_indiv_max
);
// double lma_relax_indiv_max // double relax_indiv_max
if
(
ds
!=
null
)
{
// always true
if
(
ds
!=
null
)
{
// always true
disp_lma
[
nTile
]
=
ds
[
0
][
0
];
disp_lma
[
nTile
]
=
ds
[
0
][
0
];
str_lma
[
nTile
]
=
ds
[
0
][
1
];
str_lma
[
nTile
]
=
ds
[
0
][
1
];
...
@@ -5150,8 +5152,8 @@ public class ImageDttCPU {
...
@@ -5150,8 +5152,8 @@ public class ImageDttCPU {
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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
);
imgdtt_params
.
lma_relax_indiv_max
);
// double lma_relax_indiv_max // double relax_indiv_max
if
(
ds
!=
null
)
{
// always true
if
(
ds
!=
null
)
{
// always true
disparity_map
[
DISPARITY_INDEX_POLY
][
nTileC
]
=
ds
[
0
][
0
];
disparity_map
[
DISPARITY_INDEX_POLY
][
nTileC
]
=
ds
[
0
][
0
];
disparity_map
[
DISPARITY_INDEX_POLY
+
1
][
nTileC
]
=
ds
[
0
][
1
];
disparity_map
[
DISPARITY_INDEX_POLY
+
1
][
nTileC
]
=
ds
[
0
][
1
];
...
@@ -15540,8 +15542,8 @@ public class ImageDttCPU {
...
@@ -15540,8 +15542,8 @@ public class ImageDttCPU {
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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
);
imgdtt_params
.
lma_relax_indiv_max
);
// double lma_relax_indiv_max // double relax_indiv_max
lma2
.
printStats
(
ds
,
1
);
lma2
.
printStats
(
ds
,
1
);
}
}
}
}
...
@@ -16550,8 +16552,8 @@ public class ImageDttCPU {
...
@@ -16550,8 +16552,8 @@ public class ImageDttCPU {
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_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
imgdtt_params
.
lma_str_offset
,
// convert lma-generated strength to match previous ones - add to result
imgdtt_params
.
lma_ac_offset
// Add to A, C coefficients for near-lines where A,C could become negative because of window
imgdtt_params
.
lma_ac_offset
,
// Add to A, C coefficients for near-lines where A,C could become negative because of window
);
imgdtt_params
.
lma_relax_indiv_max
);
// double lma_relax_indiv_max // double relax_indiv_max
if
(
ds
!=
null
)
{
// always true
if
(
ds
!=
null
)
{
// always true
if
(
disparity_map
!=
null
)
{
if
(
disparity_map
!=
null
)
{
disparity_map
[
DISPARITY_INDEX_POLY
][
nTile
]
=
ds
[
0
][
0
];
disparity_map
[
DISPARITY_INDEX_POLY
][
nTile
]
=
ds
[
0
][
0
];
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDttParameters.java
View file @
9a8fd5dc
...
@@ -268,8 +268,8 @@ public class ImageDttParameters {
...
@@ -268,8 +268,8 @@ public class ImageDttParameters {
public
double
lma_max_rel_rms
=
0.25
;
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
public
double
lma_max_rel_rms
=
0.25
;
// maximal relative (to average max/min amplitude LMA RMS) // May be up to 0.3)
public
double
lma_min_strength
=
1.0
;
// minimal composite strength (sqrt(average amp squared over absolute RMS)
public
double
lma_min_strength
=
1.0
;
// minimal composite strength (sqrt(average amp squared over absolute RMS)
public
double
lma_relax_indiv_max
=
2.0
;
// relax lma_max_rel_rms and lma_min_strength for individual maximum
public
double
lma_ac_offset
=
0.015
;
// add to a,c coefficients for near-lines where A,C could become negative because of window
public
double
lma_ac_offset
=
0.015
;
// add to a,c coefficients for near-lines where A,C could become negative because of window
public
double
lma_min_ac
=
0.05
;
// minimal of a and C coefficients maximum (measures sharpest point/line)
public
double
lma_min_ac
=
0.05
;
// minimal of a and C coefficients maximum (measures sharpest point/line)
public
double
lma_min_min_ac
=
0.015
;
// minimal of a and C coefficients minimum (measures sharpest point)
public
double
lma_min_min_ac
=
0.015
;
// minimal of a and C coefficients minimum (measures sharpest point)
public
double
lma_max_area
=
30.0
;
//45.0; // maximal half-area (if > 0.0)
public
double
lma_max_area
=
30.0
;
//45.0; // maximal half-area (if > 0.0)
...
@@ -828,6 +828,8 @@ public class ImageDttParameters {
...
@@ -828,6 +828,8 @@ public class ImageDttParameters {
"Discard tile if ratio of RMS to average of min and max amplitude exceeds this value"
);
"Discard tile if ratio of RMS to average of min and max amplitude exceeds this value"
);
gd
.
addNumericField
(
"Minimal composite strength"
,
this
.
lma_min_strength
,
6
,
8
,
""
,
gd
.
addNumericField
(
"Minimal composite strength"
,
this
.
lma_min_strength
,
6
,
8
,
""
,
"Discard tile if composite strength (average amplitude over SQRT of RMS) is below"
);
"Discard tile if composite strength (average amplitude over SQRT of RMS) is below"
);
gd
.
addNumericField
(
"Relax individual maximum requirements (for camel case)"
,
this
.
lma_relax_indiv_max
,
6
,
8
,
""
,
"Relax lma_max_rel_rms and lma_min_strength for individual maximum compared to that of the strongest one."
);
gd
.
addNumericField
(
"Offset A,C coefficients"
,
this
.
lma_ac_offset
,
6
,
8
,
""
,
gd
.
addNumericField
(
"Offset A,C coefficients"
,
this
.
lma_ac_offset
,
6
,
8
,
""
,
"Add to A, C coefficients for near-lines where A,C could become negative because of window "
);
"Add to A, C coefficients for near-lines where A,C could become negative because of window "
);
...
@@ -1107,6 +1109,7 @@ public class ImageDttParameters {
...
@@ -1107,6 +1109,7 @@ public class ImageDttParameters {
this
.
lma_multi_cons
=
gd
.
getNextBoolean
();
this
.
lma_multi_cons
=
gd
.
getNextBoolean
();
this
.
lma_max_rel_rms
=
gd
.
getNextNumber
();
this
.
lma_max_rel_rms
=
gd
.
getNextNumber
();
this
.
lma_min_strength
=
gd
.
getNextNumber
();
this
.
lma_min_strength
=
gd
.
getNextNumber
();
this
.
lma_relax_indiv_max
=
gd
.
getNextNumber
();
this
.
lma_ac_offset
=
gd
.
getNextNumber
();
this
.
lma_ac_offset
=
gd
.
getNextNumber
();
this
.
lma_min_ac
=
gd
.
getNextNumber
();
this
.
lma_min_ac
=
gd
.
getNextNumber
();
...
@@ -1352,6 +1355,7 @@ public class ImageDttParameters {
...
@@ -1352,6 +1355,7 @@ public class ImageDttParameters {
properties
.
setProperty
(
prefix
+
"lma_multi_cons"
,
this
.
lma_multi_cons
+
""
);
properties
.
setProperty
(
prefix
+
"lma_multi_cons"
,
this
.
lma_multi_cons
+
""
);
properties
.
setProperty
(
prefix
+
"lma_max_rel_rms"
,
this
.
lma_max_rel_rms
+
""
);
properties
.
setProperty
(
prefix
+
"lma_max_rel_rms"
,
this
.
lma_max_rel_rms
+
""
);
properties
.
setProperty
(
prefix
+
"lma_min_strength"
,
this
.
lma_min_strength
+
""
);
properties
.
setProperty
(
prefix
+
"lma_min_strength"
,
this
.
lma_min_strength
+
""
);
properties
.
setProperty
(
prefix
+
"lma_relax_indiv_max"
,
this
.
lma_relax_indiv_max
+
""
);
properties
.
setProperty
(
prefix
+
"lma_ac_offset"
,
this
.
lma_ac_offset
+
""
);
properties
.
setProperty
(
prefix
+
"lma_ac_offset"
,
this
.
lma_ac_offset
+
""
);
...
@@ -1619,6 +1623,7 @@ public class ImageDttParameters {
...
@@ -1619,6 +1623,7 @@ public class ImageDttParameters {
if
(
properties
.
getProperty
(
prefix
+
"lma_multi_cons"
)!=
null
)
this
.
lma_multi_cons
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"lma_multi_cons"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_multi_cons"
)!=
null
)
this
.
lma_multi_cons
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"lma_multi_cons"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_max_rel_rms"
)!=
null
)
this
.
lma_max_rel_rms
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_max_rel_rms"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_max_rel_rms"
)!=
null
)
this
.
lma_max_rel_rms
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_max_rel_rms"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_min_strength"
)!=
null
)
this
.
lma_min_strength
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_min_strength"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_min_strength"
)!=
null
)
this
.
lma_min_strength
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_min_strength"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_relax_indiv_max"
)!=
null
)
this
.
lma_relax_indiv_max
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_relax_indiv_max"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_ac_offset"
)!=
null
)
this
.
lma_ac_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_ac_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_ac_offset"
)!=
null
)
this
.
lma_ac_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_ac_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_min_ac"
)!=
null
)
this
.
lma_min_ac
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_min_ac"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_min_ac"
)!=
null
)
this
.
lma_min_ac
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lma_min_ac"
));
...
@@ -1860,6 +1865,7 @@ public class ImageDttParameters {
...
@@ -1860,6 +1865,7 @@ public class ImageDttParameters {
idp
.
lma_multi_cons
=
this
.
lma_multi_cons
;
idp
.
lma_multi_cons
=
this
.
lma_multi_cons
;
idp
.
lma_max_rel_rms
=
this
.
lma_max_rel_rms
;
idp
.
lma_max_rel_rms
=
this
.
lma_max_rel_rms
;
idp
.
lma_min_strength
=
this
.
lma_min_strength
;
idp
.
lma_min_strength
=
this
.
lma_min_strength
;
idp
.
lma_relax_indiv_max
=
this
.
lma_relax_indiv_max
;
idp
.
lma_ac_offset
=
this
.
lma_ac_offset
;
idp
.
lma_ac_offset
=
this
.
lma_ac_offset
;
idp
.
lma_min_ac
=
this
.
lma_min_ac
;
idp
.
lma_min_ac
=
this
.
lma_min_ac
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
9a8fd5dc
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