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
ee1f0069
Commit
ee1f0069
authored
Mar 04, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving preExpandCLTQuad3d
parent
3901557b
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
675 additions
and
364 deletions
+675
-364
EyesisCorrectionParameters.java
...com/elphel/imagej/cameras/EyesisCorrectionParameters.java
+11
-4
CLTPass3d.java
src/main/java/com/elphel/imagej/tileprocessor/CLTPass3d.java
+10
-0
Correlation2d.java
...n/java/com/elphel/imagej/tileprocessor/Correlation2d.java
+4
-57
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+1
-1
ImageDtt.java
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
+95
-91
ImageDttCPU.java
...ain/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
+17
-6
ImageDttParameters.java
...a/com/elphel/imagej/tileprocessor/ImageDttParameters.java
+4
-3
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+403
-29
OpticalFlowParameters.java
...om/elphel/imagej/tileprocessor/OpticalFlowParameters.java
+30
-9
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+60
-84
TileProcessor.java
...n/java/com/elphel/imagej/tileprocessor/TileProcessor.java
+1
-1
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+39
-79
No files found.
src/main/java/com/elphel/imagej/cameras/EyesisCorrectionParameters.java
View file @
ee1f0069
...
...
@@ -161,6 +161,7 @@ public class EyesisCorrectionParameters {
public
boolean
clt_batch_dbg1
=
true
;
// Generate debug images if a single set is selected
public
boolean
clt_batch_dsi
=
true
;
// Create and save DSI combo image with the model
public
boolean
clt_batch_dsi_aux
=
false
;
// Calculate and save aux camera DSI (currently it is offset from the main/rig data
public
boolean
clt_batch_dsi_cm_strength
=
true
;
// Use CM strength (no switch between LMA/no-LMA) for DSI export
public
boolean
clt_batch_dsi_aux_full
=
false
;
// more than just preExpandCLTQuad3d() (same as for Lazy Eye
public
boolean
clt_batch_save_extrinsics
=
true
;
// Save cameras extrinsic parameters with the model
public
boolean
clt_batch_save_all
=
true
;
// Save all parameters with the model
...
...
@@ -320,6 +321,7 @@ public class EyesisCorrectionParameters {
cp
.
clt_batch_dsi
=
this
.
clt_batch_dsi
;
cp
.
clt_batch_dsi_aux
=
this
.
clt_batch_dsi_aux
;
cp
.
clt_batch_dsi_cm_strength
=
this
.
clt_batch_dsi_cm_strength
;
cp
.
clt_batch_dsi_aux_full
=
this
.
clt_batch_dsi_aux_full
;
cp
.
clt_batch_save_extrinsics
=
this
.
clt_batch_save_extrinsics
;
cp
.
clt_batch_save_all
=
this
.
clt_batch_save_all
;
...
...
@@ -521,6 +523,7 @@ public class EyesisCorrectionParameters {
properties
.
setProperty
(
prefix
+
"clt_batch_dsi"
,
this
.
clt_batch_dsi
+
""
);
properties
.
setProperty
(
prefix
+
"clt_batch_dsi_aux"
,
this
.
clt_batch_dsi_aux
+
""
);
properties
.
setProperty
(
prefix
+
"clt_batch_dsi_cm_strength"
,
this
.
clt_batch_dsi_cm_strength
+
""
);
properties
.
setProperty
(
prefix
+
"clt_batch_dsi_aux_full"
,
this
.
clt_batch_dsi_aux_full
+
""
);
properties
.
setProperty
(
prefix
+
"clt_batch_save_extrinsics"
,
this
.
clt_batch_save_extrinsics
+
""
);
properties
.
setProperty
(
prefix
+
"clt_batch_save_all"
,
this
.
clt_batch_save_all
+
""
);
...
...
@@ -700,6 +703,8 @@ public class EyesisCorrectionParameters {
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_dsi"
)!=
null
)
this
.
clt_batch_dsi
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_dsi"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_dsi_aux"
)!=
null
)
this
.
clt_batch_dsi_aux
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_dsi_aux"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_dsi_cm_strength"
)!=
null
)
this
.
clt_batch_dsi_cm_strength
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_dsi_cm_strength"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_dsi_aux_full"
)!=
null
)
this
.
clt_batch_dsi_aux_full
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_dsi_aux_full"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_save_extrinsics"
)!=
null
)
this
.
clt_batch_save_extrinsics
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_save_extrinsics"
));
if
(
properties
.
getProperty
(
prefix
+
"clt_batch_save_all"
)!=
null
)
this
.
clt_batch_save_all
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"clt_batch_save_all"
));
...
...
@@ -1094,10 +1099,11 @@ public class EyesisCorrectionParameters {
gd
.
addCheckbox
(
"Include/genarate separate aux camera DSI data in the combo DSI"
,
this
.
clt_batch_dsi_aux
,
"8-rig: DSI for the AUX camera is offset (by the rig baseline) from the main and rig DSI. Aux DSI requires extra processing time."
+
"EO+LWIR - generate a separate GT+AUX file"
);
gd
.
addCheckbox
(
"Use CM strength (no switch between LMA/no-LMA) for DSI"
,
this
.
clt_batch_dsi_cm_strength
,
"Generate CM-only, single-tile strength for each tile keeping disparity and LMA-disparity from multi-tile"
+
"to use as a layer for interscene matching"
);
gd
.
addCheckbox
(
"Additional steps to calculate Aux DSI (more than for LY adjustment)"
,
this
.
clt_batch_dsi_aux_full
,
"(Not yet tested)"
);
gd
.
addCheckbox
(
"Save field adjustment data with the model"
,
this
.
clt_batch_save_extrinsics
,
"This data can be used to restore specific filed-adjusted cameras extrinsics used when the model was generated"
);
gd
.
addCheckbox
(
"Save all parameters with the model"
,
this
.
clt_batch_save_all
,
...
...
@@ -1225,6 +1231,7 @@ public class EyesisCorrectionParameters {
this
.
clt_batch_dbg1
=
gd
.
getNextBoolean
();
// 29
this
.
clt_batch_dsi
=
gd
.
getNextBoolean
();
this
.
clt_batch_dsi_aux
=
gd
.
getNextBoolean
();
this
.
clt_batch_dsi_cm_strength
=
gd
.
getNextBoolean
();
this
.
clt_batch_dsi_aux_full
=
gd
.
getNextBoolean
();
this
.
clt_batch_save_extrinsics
=
gd
.
getNextBoolean
();
this
.
clt_batch_save_all
=
gd
.
getNextBoolean
();
...
...
src/main/java/com/elphel/imagej/tileprocessor/CLTPass3d.java
View file @
ee1f0069
...
...
@@ -978,6 +978,16 @@ public class CLTPass3d{
restoreTileOpDisparity
();
saveTileOpDisparity
();
}
public
int
setTileOpDisparity
(
double
[]
disparity
)
{
boolean
[]
selection
=
new
boolean
[
disparity
.
length
];
for
(
int
i
=
0
;
i
<
disparity
.
length
;
i
++)
{
selection
[
i
]
=
!
Double
.
isNaN
(
disparity
[
i
]);
}
return
setTileOpDisparity
(
selection
,
// boolean [] selection,
disparity
);
// double [] disparity)
}
public
int
setTileOpDisparity
(
boolean
[]
selection
,
...
...
src/main/java/com/elphel/imagej/tileprocessor/Correlation2d.java
View file @
ee1f0069
...
...
@@ -2429,7 +2429,7 @@ public class Correlation2d {
int
[]
imx
=
new
int
[
2
];
for
(
int
i
=
center_x
-
transform_size
+
2
;
i
<
center_x
+
transform_size
-
1
;
i
++)
{
double
c
=
combo_corrs
[
i
];
if
((
c
>
combo_corrs
[
i
-
1
])
&&
(
c
>
combo_corrs
[
i
+
1
]))
{
if
((
c
>
combo_corrs
[
i
-
1
])
&&
(
c
>
combo_corrs
[
i
+
1
])
&&
(
c
>
0.0
)
)
{
if
((
imx
[
0
]
==
0
)
||
(
c
>
combo_corrs
[
imx
[
0
]]))
{
imx
[
1
]
=
imx
[
0
];
imx
[
0
]
=
i
;
...
...
@@ -2439,7 +2439,9 @@ public class Correlation2d {
i
++;
// skip next after max
}
}
if
(
imx
[
0
]
==
0
)
return
new
double
[
0
][];
if
(
imx
[
0
]
==
0
)
{
return
new
double
[
0
][];
}
int
nm
=
1
;
if
((
imx
[
1
]
>
0
)
&&
(
combo_corrs
[
imx
[
1
]]/
combo_corrs
[
imx
[
0
]]
>
min_fraction
))
{
nm
++;
...
...
@@ -4621,61 +4623,6 @@ public class Correlation2d {
own_masks
=
new
double
[][][]
{
own_masks0
[
sel_max
]};
common_scale
=
new
boolean
[]
{(
sel_max
==
fg_max
)
?
imgdtt_params
.
bimax_common_fg
:
imgdtt_params
.
bimax_common_bg
};
}
/*
int nearest_max = (Math.abs(disp_str_dual[0][0]) < Math.abs(disp_str_dual[1][0]))? 0 : 1;
int fg_max = (disp_str_dual[0][0] > disp_str_dual[1][0]) ? 0 : 1;
switch (combine_mode) {
case 0: // keep both
pair_offsets = pair_offsets0;
lma_corr_weights = lma_corr_weights0;
disp_str_all = disp_str_dual;
own_masks = own_masks0;
common_scale = new boolean[disp_str_dual.length];
for (int i = 0; i < common_scale.length; i++) {
common_scale[i] = (i == fg_max) ? imgdtt_params.bimax_common_fg : imgdtt_params.bimax_common_bg;
}
break;
case 1: // keep strongest
pair_offsets = new double [][][] {pair_offsets0 [0]};
lma_corr_weights = new double [][][] {lma_corr_weights0[0]};
disp_str_all = new double [][] {disp_str_dual [0]};
own_masks = new double [][][] {own_masks0 [0]};
common_scale = new boolean[] {(0 == fg_max) ? imgdtt_params.bimax_common_fg : imgdtt_params.bimax_common_bg};
break;
case 2: // keep nearest
pair_offsets = new double [][][] {pair_offsets0 [nearest_max]};
lma_corr_weights = new double [][][] {lma_corr_weights0[nearest_max]};
disp_str_all = new double [][] {disp_str_dual [nearest_max]};
own_masks = new double [][][] {own_masks0 [nearest_max]};
common_scale = new boolean[] {(nearest_max == fg_max) ? imgdtt_params.bimax_common_fg : imgdtt_params.bimax_common_bg};
break;
case 3: // keep foreground
pair_offsets = new double [][][] {pair_offsets0 [fg_max]};
lma_corr_weights = new double [][][] {lma_corr_weights0[fg_max]};
disp_str_all = new double [][] {disp_str_dual [fg_max]};
own_masks = new double [][][] {own_masks0 [fg_max]};
common_scale = new boolean[] {imgdtt_params.bimax_common_fg};
break;
case 4: // keep background
pair_offsets = new double [][][] {pair_offsets0 [1-fg_max]};
lma_corr_weights = new double [][][] {lma_corr_weights0[1-fg_max]};
disp_str_all = new double [][] {disp_str_dual [1-fg_max]};
own_masks = new double [][][] {own_masks0 [1-fg_max]};
common_scale = new boolean[] {imgdtt_params.bimax_common_bg};
break;
default: // keep both
pair_offsets = pair_offsets0;
lma_corr_weights = lma_corr_weights0;
disp_str_all = disp_str_dual;
own_masks = own_masks0;
common_scale = new boolean[disp_str_dual.length];
for (int i = 0; i < common_scale.length; i++) {
common_scale[i] = (i == fg_max) ? imgdtt_params.bimax_common_fg : imgdtt_params.bimax_common_bg;
}
}
*/
}
double
[][][]
filtWeight
=
new
double
[
lma_corr_weights
.
length
][
corrs
.
length
][];
...
...
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
ee1f0069
src/main/java/com/elphel/imagej/tileprocessor/ImageDtt.java
View file @
ee1f0069
...
...
@@ -2486,7 +2486,7 @@ public class ImageDtt extends ImageDttCPU {
}
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
);
boolean
debugTile0
=(
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
)
&&
(
globalDebugLevel
>
1
);
//
0);
boolean
debugTile1
=(
tileX
==
debug_tileX
)
&&
(
tileY
==
debug_tileY
)
&&
(
globalDebugLevel
>
-
10
);
if
(
debugTile0
)
{
System
.
out
.
println
(
"clt_process_tl_correlations(): tileX="
+
tileX
+
", tileY="
+
tileY
+
", iTile="
+
iTile
+
", nTile="
+
nTile
);
...
...
@@ -2612,7 +2612,7 @@ public class ImageDtt extends ImageDttCPU {
}
// calculate 0,1, or 2 maximums
if
(
debugTile1
)
{
System
.
out
.
println
(
"clt_process_tl_correlations(): debugTile1
"
);
System
.
out
.
println
(
"clt_process_tl_correlations(): debugTile1
, tp_task["
+
iTile
+
"]target_disparity="
+
tp_tasks
[
iTile
].
getTargetDisparity
()
);
// debugTile0 = true;
}
double
[][]
disp_str_sel
=
null
;
...
...
@@ -2623,6 +2623,7 @@ public class ImageDtt extends ImageDttCPU {
disparity_scale
,
// double disparity_scale,
((
corr_dia_tile
!=
null
)
?
corr_dia_tile
:
corr_combo_tile
),
// double [] combo_corrs,
imgdtt_params
.
mcorr_dual_fract
);
//double min_fraction
if
(
maxes
.
length
>
0
)
{
// TODO: add corr layer - copy of combo with singles as nulls
// just for debugging to indicate tiles with dual maximums
if
((
maxes
.
length
<
2
)
&&
(
corr_dia_tile
!=
null
))
{
//FIXME: Debug
...
...
@@ -2659,7 +2660,7 @@ public class ImageDtt extends ImageDttCPU {
if
(
run_lma
)
{
if
(
debugTile1
)
{
System
.
out
.
println
(
"clt_process_tl_correlations() maxes="
);
System
.
out
.
println
(
"clt_process_tl_correlations() maxes, tp_task["
+
iTile
+
"]target_disparity="
+
tp_tasks
[
iTile
].
getTargetDisparity
()
);
for
(
int
i
=
0
;
i
<
maxes
.
length
;
i
++)
{
System
.
out
.
println
(
String
.
format
(
"maxes[%d][0]=%f (quadcam disparity pixels, not combo pixels), maxes[%d][1]=%f"
,
i
,
maxes
[
i
][
0
],
i
,
maxes
[
i
][
1
]));
}
...
...
@@ -2708,7 +2709,9 @@ public class ImageDtt extends ImageDttCPU {
}
}
// if (lma_dual != null) {
}
}
// no positive maximums on y==0 - nothing in this tile
}
if
((
disp_str_sel
!=
null
)
&&
(
disp_str_sel
.
length
>
0
))
{
if
(
debugTile1
)
{
// FIXME: remove debugTile1!
System
.
out
.
println
(
"clt_process_tl_correlations() disp_str_sel="
);
for
(
int
nmax
=
0
;
nmax
<
disp_str_sel
.
length
;
nmax
++)
{
...
...
@@ -2716,7 +2719,6 @@ public class ImageDtt extends ImageDttCPU {
nmax
,
disp_str_sel
[
nmax
][
0
],
nmax
,
disp_str_sel
[
nmax
][
1
],
(((
disp_str_lma
!=
null
)
&&
(
disp_str_lma
[
nmax
]!=
null
))?
"true"
:
"false"
)));
}
}
if
((
disp_str_sel
!=
null
)
&&
(
disp_str_sel
.
length
>
0
))
{
if
(
disparity_map
!=
null
)
{
disparity_map
[
DISPARITY_INDEX_CM
][
nTile
]
=
disp_str_sel
[
0
][
0
];
// disparity non-LMA
disparity_map
[
DISPARITY_INDEX_CM
+
1
][
nTile
]
=
disp_str_sel
[
0
][
1
];
// strength non-LMA;
...
...
@@ -2726,14 +2728,16 @@ public class ImageDtt extends ImageDttCPU {
if
(!
Double
.
isNaN
(
disp_str_lma
[
0
][
0
]))
{
disparity_map
[
DISPARITY_INDEX_POLY
][
nTile
]
=
disp_str_lma
[
0
][
0
];
// disparity LMA
disparity_map
[
DISPARITY_INDEX_POLY
+
1
][
nTile
]
=
disp_str_lma
[
0
][
2
];
// strength LMA
disparity_map
[
DISPARITY_STRENGTH_INDEX
][
nTile
]
=
disp_str_lma
[
0
][
1
];
// overwrite with LMA strength
// keep strength from CM strength (not LMA)
// disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = disp_str_lma[0][1]; // overwrite with LMA strength
}
}
else
{
int
indx
=
sel_fg_bg
[
0
];
if
(!
Double
.
isNaN
(
disp_str_lma
[
indx
][
0
]))
{
disparity_map
[
DISPARITY_INDEX_POLY
][
nTile
]
=
disp_str_lma
[
indx
][
0
];
// disparity LMA
disparity_map
[
DISPARITY_INDEX_POLY
+
1
][
nTile
]
=
disp_str_lma
[
indx
][
2
];
// strength LMA
disparity_map
[
DISPARITY_STRENGTH_INDEX
][
nTile
]
=
disp_str_lma
[
indx
][
1
];
// overwrite with LMA strength
// keep strength from CM strength (not LMA)
// disparity_map[DISPARITY_STRENGTH_INDEX][nTile] = disp_str_lma[indx][1]; // overwrite with LMA strength
}
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDttCPU.java
View file @
ee1f0069
...
...
@@ -16587,12 +16587,13 @@ public class ImageDttCPU {
startAndJoin
(
threads
);
return
texture_tiles
;
}
private
double
[][][]
prepareNeibs
(
private
static
double
[][][]
prepareNeibs
(
int
nTileC
,
boolean
float_center
,
// false - center around provided value: target_disparity[center] or dcenter[0] if dcenter != null
// dcenter[0] - center offset, dcenter[1] - tiltX, dcenter[2] - tiltY
double
[]
target_disparity
,
// = new double [tilesY * tilesX];
TileNeibs
tn
,
TileNeibs
tn_clust
,
int
clustRadius
,
double
[]
wnd_neib
,
int
[][]
dtx_dty
,
// null or int [][] dtx_dty = new int [wnd_neib.length][];
...
...
@@ -16608,6 +16609,7 @@ public class ImageDttCPU {
disparity_center
=
dcenter
[
0
];
//
}
double
disparity_range
=
2
*(
arange
+
rrange
*
Math
.
abs
(
disparity_center
));
boolean
[]
left_pix
=
new
boolean
[
clustDiameter
*
clustDiameter
];
if
(
float_center
)
{
final
double
[]
disp
=
new
double
[
wnd_neib
.
length
];
Arrays
.
fill
(
disp
,
Double
.
NaN
);
...
...
@@ -16625,6 +16627,7 @@ public class ImageDttCPU {
double
w
=
wnd_neib
[
indx
];
swd
+=
w
*
d
;
sw
+=
w
;
left_pix
[
indx
]
=
true
;
}
}
indx
++;
...
...
@@ -16638,20 +16641,24 @@ public class ImageDttCPU {
});
// Remove "worst" of min and max disparity tiles, until difference is smaller than the specified range
boolean
[]
update_mm
=
{
true
,
true
};
// do not recalculate the min/max end if it was not removed
double
[]
mm_diffs
=
new
double
[
2
];
while
((
disp
[
tileList
.
get
(
tileList
.
size
()-
1
)]
-
disp
[
tileList
.
get
(
0
)])
>
disparity_range
)
{
int
[]
min_max_indices
=
{
tileList
.
get
(
0
),
tileList
.
get
(
tileList
.
size
()-
1
)};
double
[]
mm_diffs
=
new
double
[
2
];
//
double [] mm_diffs = new double[2];
boolean
both_with_neib
=
true
;
for
(
int
imm
=
0
;
imm
<
2
;
imm
++)
if
(
update_mm
[
imm
]){
// do not recalc same
update_mm
[
imm
]
=
false
;
int
idy
=
(
min_max_indices
[
imm
]
/
clustDiameter
)
-
clustRadius
+
1
;
int
idx
=
(
min_max_indices
[
imm
]
%
clustDiameter
)
-
clustRadius
+
1
;
int
tileMM
=
tn
.
getNeibIndex
(
nTileC
,
idx
,
idy
);
// full tile index
int
tile_clust
=
tn_clust
.
getNeibIndex
(
center_indx
,
idx
,
idy
);
// local tile index
double
snw
=
0.0
,
snwd
=
0.0
;
int
nn
=
0
;
for
(
int
dir
=
0
;
dir
<
8
;
dir
++)
{
int
nTile1
=
tn
.
getNeibIndex
(
tileMM
,
dir
);
if
((
nTile1
>=
0
)
&&
!
Double
.
isNaN
(
target_disparity
[
nTile1
])){
int
tile_clust1
=
tn_clust
.
getNeibIndex
(
tile_clust
,
dir
);
// if ((nTile1 >= 0) && !Double.isNaN(target_disparity[nTile1])){
if
((
nTile1
>=
0
)
&&
!
Double
.
isNaN
(
target_disparity
[
nTile1
])
&&
((
tile_clust1
<
0
)
||
left_pix
[
tile_clust1
]
)){
double
w
=
((
dir
&
1
)
!=
0
)
?
1.0
:
1.5
;
snw
+=
w
;
snwd
+=
w
*
target_disparity
[
nTile1
];
...
...
@@ -16677,7 +16684,7 @@ public class ImageDttCPU {
double
w
=
wnd_neib
[
ri
];
sw
-=
w
;
swd
-=
w
*
disp
[
ri
];
left_pix
[
ri
]
=
false
;
}
else
{
break
;
}
...
...
@@ -16880,6 +16887,8 @@ public class ImageDttCPU {
public
void
run
()
{
int
tileXC
,
tileYC
,
nTileC
;
TileNeibs
tn
=
new
TileNeibs
(
tilesX
,
tilesY
);
TileNeibs
tn_clust
=
new
TileNeibs
(
2
*
clustRadius
-
1
,
2
*
clustRadius
-
1
);
TileNeibs
tn_clust_tilt
=
new
TileNeibs
(
2
*
clustRadiusTilt
-
1
,
2
*
clustRadiusTilt
-
1
);
double
[]
dcenter
=
new
double
[
3
];
PolynomialApproximation
pa
=
new
PolynomialApproximation
();
for
(
int
iTileC
=
ai
.
getAndIncrement
();
iTileC
<
tp_tasks
.
length
;
iTileC
=
ai
.
getAndIncrement
())
if
(
tp_tasks
[
iTileC
].
getTask
()
!=
0
)
{
...
...
@@ -16901,6 +16910,7 @@ public class ImageDttCPU {
float_center
,
// boolean float_center, // false - center around provided value
target_disparity
,
//double [] target_disparity, // = new double [tilesY * tilesX];
tn
,
// TileNeibs tn,
tn_clust_tilt
,
// TileNeibs tn_clust,
clustRadiusTilt
,
// int clustRadius,
wnd_neib_tilt
,
// double [] wnd_neib,
null
,
// int [][] dtx_dty, // null or int [][] dtx_dty = new int [wnd_neib.length][];
...
...
@@ -16943,6 +16953,7 @@ public class ImageDttCPU {
false
,
// float_center, // boolean float_center, // false - center around provided value
target_disparity
,
//double [] target_disparity, // = new double [tilesY * tilesX];
tn
,
// TileNeibs tn,
tn_clust
,
// TileNeibs tn_clust,
clustRadius
,
// int clustRadius,
wnd_neib
,
// double [] wnd_neib,
dtx_dty
,
// int [][] dtx_dty, // null or int [][] dtx_dty = new int [wnd_neib.length][];
...
...
src/main/java/com/elphel/imagej/tileprocessor/ImageDttParameters.java
View file @
ee1f0069
...
...
@@ -496,8 +496,9 @@ public class ImageDttParameters {
"When dual max, LMA with two maximums, then select. If false,select before LMA"
);
gd
.
addChoice
(
"Multiple maximums select mode"
,
COMBINE_MODES
,
COMBINE_MODES
[
bimax_combine_mode
],
"Which maximum to keep after LMA"
);
gd
.
addCheckbox
(
"Use updated LMA capable of FG/BG"
,
this
.
bimax_dual_LMA
,
"When dual max, LMA with two maximums, then select. If false,select before LMA"
);
gd
.
addCheckbox
(
"Use updated LMA capable of FG/BG, force CM strength for strength"
,
this
.
bimax_dual_LMA
,
"Use LMA capable of FG/BG. Use CM strength (now 3) as DISPARITY_STRENGTH_INDEX (now 10)."
+
"When false (old) use LMA (DISPARITY_INDEX_POLY+1 now 9) as DISPARITY_STRENGTH_INDEX"
);
gd
.
addCheckbox
(
"Process only tiles with dual maximums (requires bimax_dual_LMA)"
,
this
.
bimax_dual_only
,
"May be used to determine BG after refining FG. First refine with false and mode = 3 (FG), then with true and mode = 4 (BG)"
);
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
ee1f0069
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlowParameters.java
View file @
ee1f0069
...
...
@@ -39,7 +39,6 @@ public class OpticalFlowParameters {
public
double
tolerance_absolute_inter
=
0.25
;
// absolute disparity half-range in each tile
public
double
tolerance_relative_inter
=
0.2
;
// relative disparity half-range in each tile
public
double
occupancy_inter
=
0.25
;
// fraction of remaining tiles in the center 8x8 area (<1.0)
public
double
nsigma
=
1.5
;
// Remove outliers by more that this scaled sigma
public
double
nsigma2
=
2.0
;
// Second time outlier filter (<0 - disable)
public
double
[]
chn_weights
=
{
1.0
,
1.0
,
1.0
,
1.0
};
// strength, r,b,g
...
...
@@ -50,23 +49,20 @@ public class OpticalFlowParameters {
public
double
frac_radius
=
0.9
;
// add to integer radius for window calculation
public
double
tolerance_absolute_macro
=
0.25
;
// absolute disparity half-range to consolidate macro tiles
public
double
tolerance_relative_macro
=
0.2
;
// relative disparity half-range to consolidate macro tiles
public
int
iradius_cm
=
3
;
// half-size of the square to process
public
double
dradius_cm
=
1.5
;
// weight calculation (1/(r/dradius)^2 + 1)
public
int
refine_num_cm
=
5
;
// number of iterations to apply weights around new center
public
double
magic_scale
=
0.85
;
// 2.0 * 0.85;
public
int
max_refines
=
50
;
public
int
num_refine_all
=
3
;
public
double
min_change
=
0.1
;
// 01;// sqrt (dx*dx + dy*dy) for correction (int tiles) in pixels
public
int
best_neibs_num
=
4
;
// use 4 best neighbors to calculate std deviation
public
double
ref_stdev
=
5.0
;
// strength 0.5 if standard deviation of best neighbors to tile difference is this.
public
boolean
ignore_ers
=
false
;
// ignore velocities from individual ERS (LWIR - ignore, RGB - do not ignore
public
double
lpf_pairs
=
5.0
;
// velocities LPF during pairwise fitting
public
double
lpf_series
=
5.0
;
// velocities LPF during all-to-reference fitting
public
boolean
combine_empty_only
=
true
;
// false;
public
boolean
late_normalize_iterate
=
true
;
public
int
test_corr_rad_max
=
3
;
// for recalculateFlowXY()
...
...
@@ -151,6 +147,14 @@ public class OpticalFlowParameters {
gd
.
addNumericField
(
"Expected standard deviation of the Optical Flow"
,
this
.
ref_stdev
,
3
,
6
,
"pix"
,
"Calculate for the best neighbors around the current tile: confidence= (ref_stdev ^ 2)/(ref_stdev ^2 + stdev^2)"
);
gd
.
addMessage
(
"Linear and Rotational Velocities"
);
gd
.
addCheckbox
(
"Ignore velocities from individual ERS"
,
this
.
ignore_ers
,
"Ignore relative pose from individa-scene ERS when calculating relative poses"
);
gd
.
addNumericField
(
"Velocities LPF during pairwise fitting"
,
this
.
lpf_pairs
,
3
,
6
,
"samples"
,
"Half of the full width LPF to smooth ERS velocities during consecutive pairs pose fitting"
);
gd
.
addNumericField
(
"Velocities LPF during all-to-reference fitting"
,
this
.
lpf_series
,
3
,
6
,
"samples"
,
"Half of the full width LPF to smooth ERS velocities during all scenes to reference pose fitting"
);
gd
.
addMessage
(
"Testing and Debug"
);
gd
.
addCheckbox
(
"Consolidate correlation macrotiles only if the current macrotile is null"
,
this
.
combine_empty_only
,
"When false - consolidate all macrotiles, including defined ones"
);
...
...
@@ -203,6 +207,10 @@ public class OpticalFlowParameters {
this
.
best_neibs_num
=
(
int
)
gd
.
getNextNumber
();
this
.
ref_stdev
=
gd
.
getNextNumber
();
this
.
ignore_ers
=
gd
.
getNextBoolean
();
this
.
lpf_pairs
=
gd
.
getNextNumber
();
this
.
lpf_series
=
gd
.
getNextNumber
();
this
.
combine_empty_only
=
gd
.
getNextBoolean
();
this
.
late_normalize_iterate
=
gd
.
getNextBoolean
();
this
.
test_corr_rad_max
=
(
int
)
gd
.
getNextNumber
();
...
...
@@ -246,6 +254,10 @@ public class OpticalFlowParameters {
properties
.
setProperty
(
prefix
+
"best_neibs_num"
,
this
.
best_neibs_num
+
""
);
properties
.
setProperty
(
prefix
+
"ref_stdev"
,
this
.
ref_stdev
+
""
);
properties
.
setProperty
(
prefix
+
"ignore_ers"
,
this
.
ignore_ers
+
""
);
properties
.
setProperty
(
prefix
+
"lpf_pairs"
,
this
.
lpf_pairs
+
""
);
properties
.
setProperty
(
prefix
+
"lpf_series"
,
this
.
lpf_series
+
""
);
properties
.
setProperty
(
prefix
+
"combine_empty_only"
,
this
.
combine_empty_only
+
""
);
properties
.
setProperty
(
prefix
+
"late_normalize_iterate"
,
this
.
late_normalize_iterate
+
""
);
properties
.
setProperty
(
prefix
+
"test_corr_rad_max"
,
this
.
test_corr_rad_max
+
""
);
...
...
@@ -289,6 +301,11 @@ public class OpticalFlowParameters {
if
(
properties
.
getProperty
(
prefix
+
"best_neibs_num"
)!=
null
)
this
.
best_neibs_num
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"best_neibs_num"
));
if
(
properties
.
getProperty
(
prefix
+
"ref_stdev"
)!=
null
)
this
.
ref_stdev
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ref_stdev"
));
if
(
properties
.
getProperty
(
prefix
+
"ignore_ers"
)!=
null
)
this
.
ignore_ers
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ignore_ers"
));
if
(
properties
.
getProperty
(
prefix
+
"lpf_pairs"
)!=
null
)
this
.
lpf_pairs
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lpf_pairs"
));
if
(
properties
.
getProperty
(
prefix
+
"lpf_series"
)!=
null
)
this
.
lpf_series
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"lpf_series"
));
if
(
properties
.
getProperty
(
prefix
+
"combine_empty_only"
)!=
null
)
this
.
combine_empty_only
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"combine_empty_only"
));
if
(
properties
.
getProperty
(
prefix
+
"late_normalize_iterate"
)!=
null
)
this
.
late_normalize_iterate
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"late_normalize_iterate"
));
if
(
properties
.
getProperty
(
prefix
+
"test_corr_rad_max"
)!=
null
)
this
.
test_corr_rad_max
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"test_corr_rad_max"
));
...
...
@@ -331,6 +348,10 @@ public class OpticalFlowParameters {
ofp
.
best_neibs_num
=
this
.
best_neibs_num
;
ofp
.
ref_stdev
=
this
.
ref_stdev
;
ofp
.
ignore_ers
=
this
.
ignore_ers
;
ofp
.
lpf_pairs
=
this
.
lpf_pairs
;
ofp
.
lpf_series
=
this
.
lpf_series
;
ofp
.
combine_empty_only
=
this
.
combine_empty_only
;
ofp
.
late_normalize_iterate
=
this
.
late_normalize_iterate
;
ofp
.
test_corr_rad_max
=
this
.
test_corr_rad_max
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
ee1f0069
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/TileProcessor.java
View file @
ee1f0069
...
...
@@ -3573,7 +3573,7 @@ ImageDtt.startAndJoin(threads);
}
return
ds
;
}
public
double
[][]
getDSLMA
(
public
static
double
[][]
getDSLMA
(
CLTPass3d
scan
,
boolean
use_final
)
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
ee1f0069
...
...
@@ -8233,7 +8233,7 @@ if (debugLevel > -100) return true; // temporarily !
EyesisCorrectionParameters
.
RGBParameters
rgbParameters
,
EyesisCorrectionParameters
.
EquirectangularParameters
equirectangularParameters
,
Properties
properties
,
boolean
reset_from_extrinsics
,
boolean
reset_from_extrinsics
,
// true
final
int
threadsMax
,
// maximal number of threads to launch
final
boolean
updateStatus
,
final
int
debugLevel
)
throws
Exception
...
...
@@ -8291,7 +8291,7 @@ if (debugLevel > -100) return true; // temporarily !
// QuadCLT qPrev = (i > 0) ? quadCLTs[i - 1] : null;
QuadCLTCPU
qPrev
=
(
i
>
0
)
?
quadCLTs
[
i
-
1
]
:
null
;
// double [][][] pair_sets =
double
[][]
pose
=
o
pticalFlow
.
getPoseFromErs
(
double
[][]
pose
=
O
pticalFlow
.
getPoseFromErs
(
// FIXME: *********** update getPoseFromErs to use QUADCLTCPU ! **********
clt_parameters
.
ofp
.
k_prev
,
// k_prev,
(
QuadCLT
)
quadCLTs
[
i
],
...
...
@@ -8324,7 +8324,6 @@ if (debugLevel > -100) return true; // temporarily !
CLTParameters
clt_parameters
,
EyesisCorrectionParameters
.
DebayerParameters
debayerParameters
,
ColorProcParameters
colorProcParameters
,
// ColorProcParameters colorProcParameters_aux,
CorrectionColorProc
.
ColorGainsParameters
channelGainParameters
,
EyesisCorrectionParameters
.
RGBParameters
rgbParameters
,
EyesisCorrectionParameters
.
EquirectangularParameters
equirectangularParameters
,
...
...
@@ -8347,12 +8346,8 @@ if (debugLevel > -100) return true; // temporarily !
return
;
}
QuadCLT
.
SetChannels
[]
set_channels
=
quadCLT_main
.
setChannels
(
debugLevel
);
// String set_name = set_channels[0].set_name;
// QuadCLT [] quadCLTs = new QuadCLT [set_channels.length];
// QuadCLTCPU [] quadCLTs = new QuadCLTCPU [set_channels.length];
QuadCLT
[]
quadCLTs
=
new
QuadCLT
[
set_channels
.
length
];
for
(
int
i
=
0
;
i
<
quadCLTs
.
length
;
i
++)
{
for
(
int
i
=
0
0
;
i
<
quadCLTs
.
length
;
i
++)
{
quadCLTs
[
i
]
=
(
QuadCLT
)
quadCLT_main
.
spawnQuadCLT
(
set_channels
[
i
].
set_name
,
clt_parameters
,
...
...
@@ -8361,7 +8356,7 @@ if (debugLevel > -100) return true; // temporarily !
debugLevel
);
// temporarily fix wrong sign:
ErsCorrection
ers
=
(
ErsCorrection
)
(
quadCLTs
[
i
].
getGeometryCorrection
());
if
(
reset_from_extrinsics
)
{
if
(
reset_from_extrinsics
)
{
// extrinsics vector "IMU" parameters
System
.
out
.
println
(
"Reset ERS parameters from intraframe extrinsics"
);
ers
.
setupERSfromExtrinsics
();
}
...
...
@@ -8394,71 +8389,6 @@ if (debugLevel > -100) return true; // temporarily !
}
/*
public void interSeriesLMA(
QuadCLT quadCLT_main, // tiles should be set
CLTParameters clt_parameters,
EyesisCorrectionParameters.DebayerParameters debayerParameters,
ColorProcParameters colorProcParameters,
// ColorProcParameters colorProcParameters_aux,
CorrectionColorProc.ColorGainsParameters channelGainParameters,
EyesisCorrectionParameters.RGBParameters rgbParameters,
EyesisCorrectionParameters.EquirectangularParameters equirectangularParameters,
Properties properties,
boolean reset_from_extrinsics,
final int threadsMax, // maximal number of threads to launch
final boolean updateStatus,
final int debugLevel) throws Exception
{
if ((quadCLT_main != null) && (quadCLT_main.getGPU() != null)) {
quadCLT_main.getGPU().resetGeometryCorrection();
quadCLT_main.gpuResetCorrVector(); // .getGPU().resetGeometryCorrectionVector();
}
// final boolean batch_mode = clt_parameters.batch_run;
this.startTime=System.nanoTime();
String [] sourceFiles0=quadCLT_main.correctionsParameters.getSourcePaths();
QuadCLT.SetChannels [] set_channels_main = quadCLT_main.setChannels(debugLevel);
if ((set_channels_main == null) || (set_channels_main.length==0)) {
System.out.println("No files to process (of "+sourceFiles0.length+")");
return;
}
QuadCLT.SetChannels [] set_channels=quadCLT_main.setChannels(debugLevel);
QuadCLT [] quadCLTs = new QuadCLT [set_channels.length];
// QuadCLTCPU [] quadCLTs = new QuadCLTCPU [set_channels.length];
for (int i = 0; i < quadCLTs.length; i++) {
quadCLTs[i] = (QuadCLT) quadCLT_main.spawnQuadCLT(
set_channels[i].set_name,
clt_parameters,
colorProcParameters, //
threadsMax,
debugLevel);
// temporarily fix wrong sign:
// ErsCorrection ers = (ErsCorrection) (quadCLTs[i].getGeometryCorrection());
quadCLTs[i].setDSRBG(
clt_parameters, // CLTParameters clt_parameters,
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus, // boolean updateStatus,
debugLevel); // int debugLevel)
}
OpticalFlow opticalFlow = new OpticalFlow(
quadCLT_main.getNumSensors(),
clt_parameters.ofp.scale_no_lma_disparity, // double scale_no_lma_disparity,
threadsMax, // int threadsMax, // maximal number of threads to launch
updateStatus); // boolean updateStatus);
opticalFlow.adjustSeries(
clt_parameters, // CLTParameters clt_parameters,
clt_parameters.ofp.k_prev, // k_prev,\
// FIXME: *********** update adjustSeries to use QUADCLTCPU ! **********
// (QuadCLT [])
quadCLTs, // QuadCLT [] scenes, // ordered by increasing timestamps
clt_parameters.ofp.debug_level_optical); // 1); // -1); // int debug_level);
System.out.println("End of interSeriesLMA()");
}
*/
public
void
interSeriesLMA
(
QuadCLT
quadCLT_main
,
// tiles should be set
...
...
@@ -8491,7 +8421,6 @@ if (debugLevel > -100) return true; // temporarily !
QuadCLT
.
SetChannels
[]
set_channels
=
quadCLT_main
.
setChannels
(
debugLevel
);
QuadCLT
[]
quadCLTs
=
new
QuadCLT
[
set_channels
.
length
];
// QuadCLTCPU [] quadCLTs = new QuadCLTCPU [set_channels.length];
for
(
int
i
=
0
;
i
<
quadCLTs
.
length
;
i
++)
{
quadCLTs
[
i
]
=
(
QuadCLT
)
quadCLT_main
.
spawnQuadCLT
(
set_channels
[
i
].
set_name
,
...
...
@@ -8499,8 +8428,6 @@ if (debugLevel > -100) return true; // temporarily !
colorProcParameters
,
//
threadsMax
,
debugLevel
);
// temporarily fix wrong sign:
// ErsCorrection ers = (ErsCorrection) (quadCLTs[i].getGeometryCorrection());
quadCLTs
[
i
].
setDSRBG
(
clt_parameters
,
// CLTParameters clt_parameters,
threadsMax
,
// int threadsMax, // maximal number of threads to launch
...
...
@@ -11786,16 +11713,49 @@ if (debugLevel > -100) return true; // temporarily !
updateStatus
,
debugLevel
);
}
if
(
debugLevel
>
-
2
)
{
// && clt_parameters.show_first_bg) {
quadCLT_aux
.
tp
.
showScan
(
quadCLT_aux
.
tp
.
clt_3d_passes
.
get
(
quadCLT_aux
.
tp
.
clt_3d_passes
.
size
()
-
1
),
//last
"last_data-"
+
quadCLT_aux
.
tp
.
clt_3d_passes
.
size
());
}
// double [][] aux_last_scan = quadCLT_aux.tp.getShowDS(
// quadCLT_aux.tp.clt_3d_passes.get( quadCLT_aux.tp.clt_3d_passes.size() -1),
// false); // boolean force_final);
double
[][]
aux_last_scan
=
quadCLT_aux
.
tp
.
getDSLMA
(
double
[][]
aux_last_scan
=
TileProcessor
.
getDSLMA
(
quadCLT_aux
.
tp
.
clt_3d_passes
.
get
(
quadCLT_aux
.
tp
.
clt_3d_passes
.
size
()
-
1
),
false
);
// boolean force_final);
//measure w/o LMA just to get strength w/o any averaging
dsi
[
DSI_DISPARITY_AUX
]
=
aux_last_scan
[
0
];
dsi
[
DSI_STRENGTH_AUX
]
=
aux_last_scan
[
1
];
dsi
[
DSI_DISPARITY_AUX_LMA
]
=
aux_last_scan
[
2
];
if
(
quadCLT_main
.
correctionsParameters
.
clt_batch_dsi_cm_strength
)
{
CLTPass3d
scan
=
new
CLTPass3d
(
quadCLT_aux
.
tp
);
scan
.
setTileOpDisparity
(
aux_last_scan
[
0
]);
// measure w/o LMA, use just strength
quadCLT_aux
.
CLTMeas
(
// perform single pass according to prepared tiles operations and disparity
clt_parameters
,
// EyesisCorrectionParameters.CLTParameters clt_parameters,
scan
,
// final CLTPass3d scan,
false
,
// final boolean save_textures,
false
,
// final boolean need_diffs, // calculate diffs even if textures are not needed
0
,
// final int clust_radius,
true
,
// final boolean save_corr,
false
,
// final boolean run_lma, // = true;
threadsMax
,
// final int threadsMax, // maximal number of threads to launch
updateStatus
,
// final boolean updateStatus,
debugLevel
);
// final int debugLevel);
dsi
[
DSI_STRENGTH_AUX
]
=
scan
.
getStrength
();
if
(
debugLevel
>
1
)
{
quadCLT_aux
.
tp
.
showScan
(
scan
,
// CLTPass3d scan,
"test-strength"
);
}
}
else
{
dsi
[
DSI_STRENGTH_AUX
]
=
aux_last_scan
[
1
];
}
// quadCLT_main.saveDSIMain (dsi);
quadCLT_aux
.
saveDSIAll
(
"-DSI_MAIN"
,
// String suffix, // "-DSI_MAIN"
...
...
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