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
b6394c1f
Commit
b6394c1f
authored
Apr 16, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Before changing far split format
parent
1ddf4e46
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
68 deletions
+88
-68
BiQuadParameters.java
...ava/com/elphel/imagej/tileprocessor/BiQuadParameters.java
+3
-3
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+2
-2
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+83
-63
No files found.
src/main/java/com/elphel/imagej/tileprocessor/BiQuadParameters.java
View file @
b6394c1f
...
...
@@ -267,9 +267,9 @@ public class BiQuadParameters {
public
double
fsplit_neib_str
=
0.4
;
// minimal strength of the neighbor to compare
public
double
fsplit_neib_diff
=
1.5
;
// *** maximal disparity difference to neighbor to use
public
double
fsplit_disp
=
3.0
;
// maximal tile disparity to consider split.
public
double
fsplit_adiff
=
0.04
;
// minimal tile (combo) absolute disparity difference from neighbors
public
double
fsplit_rdiff
=
0.1
;
// minimal tile (combo) relative disparity difference from neighbors
public
double
fsplit_kfg_min
=
0.
1
;
// *** minimal fraction of kfg and (1.0-kfg)
public
double
fsplit_adiff
=
0.0
2
;
//
4;// minimal tile (combo) absolute disparity difference from neighbors
public
double
fsplit_rdiff
=
0.
02
;
//
1; // minimal tile (combo) relative disparity difference from neighbors
public
double
fsplit_kfg_min
=
0.
05
;
// *** minimal fraction of kfg and (1.0-kfg)
public
boolean
mll_generate_scene_outlines
=
false
;
// Uses 2 GB - change format, add dimensions (separate color for ref)
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
b6394c1f
...
...
@@ -1961,9 +1961,9 @@ public class ImageDtt extends ImageDttCPU {
// boolean dbg_val=globalDebugLevel>100;
nTile
=
tileY
*
tilesX
+
tileX
;
if
(
tp_tasks
[
iTile
].
getTask
()
==
0
)
continue
;
// nothing to do for this tile
boolean
debugTile0
=(
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
)
&&
(
globalDebugLevel
>
0
);
// 1);
boolean
debugTile0
=(
tileX
==
debug_tileX
)
&&
(
tileY
>=
debug_tileY
)
&&
(
tileY
<
(
debug_tileY
+
3
)
)
&&
(
globalDebugLevel
>
0
);
// 1);
debugTile0
|=(
tileX
==
debug_tileX
-
1
)
&&
(
tileY
==
debug_tileY
)
&&
(
globalDebugLevel
>
0
);
// 1);
boolean
debugTile1
=(
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
)
&&
(
globalDebugLevel
>
-
10
);
boolean
debugTile1
=(
tileX
==
debug_tileX
)
&&
(
tileY
>=
debug_tileY
)
&&
(
tileY
<
(
debug_tileY
+
3
)
)
&&
(
globalDebugLevel
>
-
10
);
if
(
debugTile0
)
{
System
.
out
.
println
(
"clt_process_tl_correlations(): tileX="
+
tileX
+
", tileY="
+
tileY
+
", iTile="
+
iTile
+
", nTile="
+
nTile
);
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
b6394c1f
...
...
@@ -8142,6 +8142,8 @@ public class OpticalFlow {
dbg_corr_scale
=
new
double
[
max_refines
][];
}
boolean
[]
selection
=
new
boolean
[
target_disparity
.
length
];
int
nTiles
=
selection
.
length
;
for
(
int
i
=
0
;
i
<
target_disparity
.
length
;
i
++)
{
selection
[
i
]
=
!
Double
.
isNaN
(
target_disparity
[
i
]);
}
...
...
@@ -8153,10 +8155,10 @@ public class OpticalFlow {
boolean
bg_refine
=
false
;
final
double
[][]
far_fgbg
=
new
double
[
selection
.
length
][];
final
double
[][]
pre_split_ds
=
new
double
[
2
][];
double
[][]
far_fg_ds
=
null
;
double
[][]
far_bg_ds
=
null
;
boolean
[]
sel_split
=
new
boolean
[
selection
.
length
];
double
[][]
far_fg_ds
=
new
double
[
2
][];
double
[][]
far_bg_ds
=
new
double
[
2
][];
boolean
[]
far_split
=
null
;
// new boolean [nTiles];
for
(
int
nrefine
=
0
;
nrefine
<
max_refines
;
nrefine
++)
{
if
(
nrefine
==
clt_parameters
.
rig
.
mll_max_refines_pre
)
{
min_disp_change
=
clt_parameters
.
rig
.
mll_min_disp_change_lma
;
...
...
@@ -8195,48 +8197,47 @@ public class OpticalFlow {
double
[][]
avg_ds
=
new
double
[][]
{
combo_dsn_final
[
COMBO_DSN_INDX_DISP
],
combo_dsn_final
[
COMBO_DSN_INDX_STRENGTH
]};
int
split_src
=
-
1
;
if
(
split_pass
>=
0
)
{
int
split_src
=
0
;
// avg
if
(
split_pass
==
0
)
{
split_src
=
0
;
// AVG
// 04/11/2023: always outputs both FG and BG
clt_parameters
.
img_dtt
.
bimax_combine_mode
=
Correlation2d
.
CAMEL_FG
;
sel_split
=
calcFarFgBg
(
split_src
,
// final int split_src, // target disparity is for 0 - avg, 1 - fg, 2 - bg
fsplit_str
,
// final double fsplit_str, // minimal strength of the tile to split
fsplit_neibs
,
// final int fsplit_neibs, // minimal number of neighbors to consider split
fsplit_neibs_side
,
// final int fsplit_neibs_side,// minimal number of neighbors from each side to consider thin FG
fsplit_neib_str
,
// final double fsplit_neib_str, // minimal strength of the neighbor to use
fsplit_neib_diff
,
// final double fsplit_neib_diff,// maximal disparity difference to neighbor to use
fsplit_disp
,
// final double fsplit_disp, // maximal tile disparity to consider split, also for neibs.
fsplit_adiff
,
// final double fsplit_adiff, // minimal tile (combo) absolute disparity difference from neighbors
fsplit_rdiff
,
// final double fsplit_rdiff, // minimal tile (combo) relative disparity difference from neighbors
fsplit_kfg_min
,
// final double fsplit_kfg_min, // minimal fraction of kfg and (1.0-kfg)
far_fgbg
,
// final double [][] far_fgbg, // should be initialized to [nTiles][?]
avg_ds
,
// final double [][] avg_ds, // always defined, used for selection
null
,
// final double [][] fg_ds,
null
,
// final double [][] bg_ds,
null
,
// final boolean [] selection, // may be null, does not apply to neighbors
tilesX
,
// final int tilesX,
ref_scene
.
getImageName
()+
"-FGBG"
);
// final String dbg_title);
selection
=
sel_split
;
// for correlateInterscene()
}
else
if
(
split_pass
==
1
)
{
// 04/11/2023: always outputs both FG and BG
split_src
=
1
;
clt_parameters
.
img_dtt
.
bimax_combine_mode
=
Correlation2d
.
CAMEL_FG
;
break
;
/*
switch (fsplit_mode) {
case 1: split_src = 1; clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_FG; break;
case 2: split_src = 1; clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_BG; break;
case 3: split_src = 0; clt_parameters.img_dtt.bimax_combine_mode = Correlation2d.CAMEL_BG; break;
}
*/
}
else
if
(
split_pass
==
2
)
{
// only for fsplit_mode == 1
// 04/11/2023: always outputs both FG and BG
split_src
=
2
;
clt_parameters
.
img_dtt
.
bimax_combine_mode
=
Correlation2d
.
CAMEL_BG
;
split_src
=
1
;
clt_parameters
.
img_dtt
.
bimax_combine_mode
=
Correlation2d
.
CAMEL_FG
;
target_disparity
=
far_fg_ds
[
0
];
}
else
{
// if (split_pass == 2) {
split_src
=
2
;
clt_parameters
.
img_dtt
.
bimax_combine_mode
=
Correlation2d
.
CAMEL_BG
;
target_disparity
=
far_bg_ds
[
0
];
}
// 04/11/2023: always outputs both FG and BG
clt_parameters
.
img_dtt
.
bimax_combine_mode
=
Correlation2d
.
CAMEL_FG
;
sel_split
=
calcFarFgBg
(
split_src
,
// final int split_src, // target disparity is for 0 - avg, 1 - fg, 2 - bg
fsplit_str
,
// final double fsplit_str, // minimal strength of the tile to split
fsplit_neibs
,
// final int fsplit_neibs, // minimal number of neighbors to consider split
fsplit_neibs_side
,
// final int fsplit_neibs_side,// minimal number of neighbors from each side to consider thin FG
fsplit_neib_str
,
// final double fsplit_neib_str, // minimal strength of the neighbor to use
fsplit_neib_diff
,
// final double fsplit_neib_diff,// maximal disparity difference to neighbor to use
fsplit_disp
,
// final double fsplit_disp, // maximal tile disparity to consider split, also for neibs.
fsplit_adiff
,
// final double fsplit_adiff, // minimal tile (combo) absolute disparity difference from neighbors
fsplit_rdiff
,
// final double fsplit_rdiff, // minimal tile (combo) relative disparity difference from neighbors
fsplit_kfg_min
,
// final double fsplit_kfg_min, // minimal fraction of kfg and (1.0-kfg)
far_fgbg
,
// final double [][] far_fgbg, // should be initialized to [nTiles][?]
avg_ds
,
// final double [][] avg_ds, // always defined, used for selection
far_fg_ds
,
// final double [][] fg_ds,
far_bg_ds
,
// final double [][] bg_ds,
far_split
,
// null, // final boolean [] selection, // may be null, does not apply to neighbors
tilesX
,
// final int tilesX,
ref_scene
.
getImageName
()+
"-FGBG"
);
// final String dbg_title);
//far_split
selection
=
sel_split
;
// for correlateInterscene()
if
(
split_src
==
0
)
{
far_fg_ds
=
new
double
[
2
][];
far_bg_ds
=
new
double
[
2
][];
far_fg_ds
[
0
]
=
new
double
[
nTiles
];
far_bg_ds
[
0
]
=
new
double
[
nTiles
];
Arrays
.
fill
(
far_fg_ds
[
0
],
Double
.
NaN
);
Arrays
.
fill
(
far_bg_ds
[
0
],
Double
.
NaN
);
}
// boolean [] sel_fgbg =
}
int
mcorr_sel
=
Correlation2d
.
corrSelEncode
(
clt_parameters
.
img_dtt
,
num_sensors
);
double
[][]
disparity_map
=
...
...
@@ -8274,36 +8275,52 @@ public class OpticalFlow {
double
[]
map_far_fg_strength
=
disparity_map
[
ImageDtt
.
DISPARITY_INDEX_POLY
+
1
];
double
[]
map_far_bg_disparity
=
disparity_map
[
ImageDtt
.
DISPARITY_INDEX_CM
];
double
[]
map_far_bg_strength
=
disparity_map
[
ImageDtt
.
DISPARITY_INDEX_CM
+
1
];
if
(
split_pass
>=
0
)
{
int
nTiles
=
selection
.
length
;
boolean
[]
far_split
=
new
boolean
[
nTiles
];
// double [][] far_fg_ds = new double[2][];
// double [][] far_bg_ds = new double[2][];
if
(
far_split
==
null
)
{
far_split
=
new
boolean
[
nTiles
];
}
// Arrays.fill(far_split, false);
// boolean [] far_split = new boolean [nTiles];
double
[][]
far_fg_ds_merge
=
new
double
[
2
][];
double
[][]
far_bg_ds_merge
=
new
double
[
2
][];
far_fg_ds
[
0
]
=
new
double
[
nTiles
];
far_bg_ds
[
0
]
=
new
double
[
nTiles
];
Arrays
.
fill
(
far_fg_ds
[
0
],
Double
.
NaN
);
Arrays
.
fill
(
far_bg_ds
[
0
],
Double
.
NaN
);
far_fg_ds_merge
[
0
]
=
avg_ds
[
0
].
clone
();
far_bg_ds_merge
[
0
]
=
avg_ds
[
0
].
clone
();
far_fg_ds_merge
[
1
]
=
avg_ds
[
1
].
clone
();
far_bg_ds_merge
[
1
]
=
avg_ds
[
1
].
clone
();
// single-threaded
for
(
int
tile
=
0
;
tile
<
nTiles
;
tile
++)
{
if
(!
Double
.
isNaN
(
map_far_fg_disparity
[
tile
])
&&
!
Double
.
isNaN
(
map_far_bg_disparity
[
tile
]))
{
far_split
[
tile
]
=
true
;
far_fg_ds
[
0
][
tile
]
=
avg_ds
[
0
][
tile
]
+
map_far_fg_disparity
[
tile
];
far_bg_ds
[
0
][
tile
]
=
avg_ds
[
0
][
tile
]
+
map_far_bg_disparity
[
tile
];
far_fg_ds_merge
[
0
][
tile
]
=
far_fg_ds
[
0
][
tile
];
far_bg_ds_merge
[
0
][
tile
]
=
far_bg_ds
[
0
][
tile
];
far_fg_ds_merge
[
1
][
tile
]
=
map_far_fg_strength
[
tile
];
far_bg_ds_merge
[
1
][
tile
]
=
map_far_bg_strength
[
tile
];
// single-threaded
if
(
split_src
==
0
)
{
for
(
int
tile
=
0
;
tile
<
nTiles
;
tile
++)
{
if
(!
Double
.
isNaN
(
map_far_fg_disparity
[
tile
])
&&
!
Double
.
isNaN
(
map_far_bg_disparity
[
tile
]))
{
far_split
[
tile
]
=
true
;
far_fg_ds
[
0
][
tile
]
=
avg_ds
[
0
][
tile
]
+
map_far_fg_disparity
[
tile
];
far_bg_ds
[
0
][
tile
]
=
avg_ds
[
0
][
tile
]
+
map_far_bg_disparity
[
tile
];
far_fg_ds_merge
[
0
][
tile
]
=
far_fg_ds
[
0
][
tile
];
far_bg_ds_merge
[
0
][
tile
]
=
far_bg_ds
[
0
][
tile
];
far_fg_ds_merge
[
1
][
tile
]
=
map_far_fg_strength
[
tile
];
far_bg_ds_merge
[
1
][
tile
]
=
map_far_bg_strength
[
tile
];
}
}
}
else
if
(
split_src
==
1
)
{
for
(
int
tile
=
0
;
tile
<
nTiles
;
tile
++)
{
if
(!
Double
.
isNaN
(
map_far_fg_disparity
[
tile
]))
{
far_split
[
tile
]
=
true
;
far_fg_ds
[
0
][
tile
]
+=
map_far_fg_disparity
[
tile
];
far_fg_ds_merge
[
0
][
tile
]
=
far_fg_ds
[
0
][
tile
];
far_fg_ds_merge
[
1
][
tile
]
=
map_far_fg_strength
[
tile
];
}
}
}
else
if
(
split_src
==
2
)
{
for
(
int
tile
=
0
;
tile
<
nTiles
;
tile
++)
{
if
(!
Double
.
isNaN
(
map_far_bg_disparity
[
tile
]))
{
far_split
[
tile
]
=
true
;
far_bg_ds
[
0
][
tile
]
+=
map_far_bg_disparity
[
tile
];
far_bg_ds_merge
[
0
][
tile
]
=
far_bg_ds
[
0
][
tile
];
far_bg_ds_merge
[
1
][
tile
]
=
map_far_bg_strength
[
tile
];
}
}
}
far_fg_ds
[
1
]
=
map_far_fg_strength
;
far_bg_ds
[
1
]
=
map_far_bg_strength
;
if
(
debug_level
>
0
)
{
//-3) {
...
...
@@ -8388,7 +8405,9 @@ public class OpticalFlow {
"bg_str_predicted_only"
,
// 15
"fg_str_predicted_err"
,
// 16
"bg_str_predicted_err"
,
// 17
"sel"
};
// 16
"sel"
,
// 18
"target_disparity"
};
// 19
double
[][]
dbg_img
=
new
double
[
dbg_far_spit_titles
.
length
][];
dbg_img
[
0
]
=
avg_ds
[
0
];
dbg_img
[
1
]
=
far_fg_ds_merge
[
0
];
...
...
@@ -8413,13 +8432,14 @@ public class OpticalFlow {
// update index below !
dbg_img
[
18
][
tile
]
=
(
selection
[
tile
]
?
0.5
:
0.0
)
+
(
far_split
[
tile
]
?
0.6
:
0.0
);
}
dbg_img
[
19
]
=
target_disparity
;
ShowDoubleFloatArrays
.
showArrays
(
dbg_img
,
tilesX
,
tilesY
,
true
,
"far-split"
+
nrefine
,
"far-split"
+
split_pass
,
dbg_far_spit_titles
);
}
...
...
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