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
b56ba447
Commit
b56ba447
authored
Aug 11, 2025
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding "importance"
parent
97bfc4bf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
745 additions
and
94 deletions
+745
-94
CuasMotion.java
src/main/java/com/elphel/imagej/cuas/CuasMotion.java
+616
-65
CuasMotionLMA.java
src/main/java/com/elphel/imagej/cuas/CuasMotionLMA.java
+27
-7
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+102
-22
No files found.
src/main/java/com/elphel/imagej/cuas/CuasMotion.java
View file @
b56ba447
...
...
@@ -57,9 +57,20 @@ public class CuasMotion {
final
static
public
int
TARGET_VY
=
3
;
final
static
public
int
TARGET_STRENGTH
=
4
;
final
static
public
int
TARGET_NTILE
=
5
;
final
static
public
int
TARGET_LENGTH
=
TARGET_NTILE
+
1
;
final
static
public
int
IMPORTANCE_A
=
0
;
final
static
public
int
IMPORTANCE_RMS
=
1
;
final
static
public
int
IMPORTANCE_RMS_A
=
2
;
final
static
public
int
IMPORTANCE_LENGTH
=
IMPORTANCE_RMS_A
+
1
;
/*
final double [] importance, // for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
*/
public
static
String
RESOURCE_GRAPICS_DIR
=
"graphics"
;
public
static
String
ICON_TARGET_1X
=
"TDbox_dashed21x21_bold.png"
;
public
static
String
ICON_TARGET_2X
=
"TDbox_dashed43x43_2px.png"
;
...
...
@@ -319,8 +330,13 @@ public class CuasMotion {
double
lma_rrms
=
clt_parameters
.
imp
.
cuas_lma_rrms
;
// = 0.15; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
double
lma_mina
=
clt_parameters
.
imp
.
cuas_lma_mina
;
// = 1.0; // Minimal A (amplitude)
double
lma_maxr
=
clt_parameters
.
imp
.
cuas_lma_maxr
;
// = 5.0; // Maximal radius (>3.8)
double
lma_minr1
=
clt_parameters
.
imp
.
cuas_lma_minr1
;
// = 1.0; // Maximal inner radius
double
lma_mink
=
clt_parameters
.
imp
.
cuas_lma_mink
;
// = 0.0; // Minimal K (overshoot) <0.007
double
lma_maxk
=
clt_parameters
.
imp
.
cuas_lma_maxk
;
// = 5.0; // Minimal K (overshoot) > 3.8
double
lma_a2a
=
clt_parameters
.
imp
.
cuas_lma_a2a
;
// = 0.7; // Minimal ratio of the maximal pixel to the amplitude
boolean
remove_isolated
=
clt_parameters
.
imp
.
cuas_isolated
;
// true;
double
max_mismatch
=
clt_parameters
.
imp
.
cuas_max_mismatch
;
// 2;
...
...
@@ -908,21 +924,47 @@ public class CuasMotion {
public
static
double
[][][]
filterAndShowTargetsLMA
(
double
[][][]
coord_data
,
double
importance_limit
,
double
importance_power
,
// Raise each factor to this power before combining
double
[]
importance
,
// for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
double
lma_rms
,
// = 1.5; // Maximal RMS (should always match, regardless if A)
double
lma_arms
,
// = 0.06; // Maximal absolute RMS (should match one of cuas_lma_arms OR cuas_lma_rrms (0.484)
double
lma_rrms
,
// = 0.15; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
double
lma_mina
,
// = 1.0; // Minimal A (amplitude)
double
lma_maxr
,
// = 5.0; // Minimal K (overshoot) = 3.0
double
lma_mink
,
// = 0.0; // Minimal K (overshoot) = 1.0
double
lma_maxk
,
// = 5.0; // Minimal K (overshoot) = 3.0
double
lma_maxr
,
// = 5.0; // Minimal K (overshoot) = 5.0
double
lma_minr1
,
// = 1.0; // Minimal R1 (radius of positive peak)
double
lma_mink
,
// = 0.0; // Minimal K (overshoot) = 0.0
double
lma_maxk
,
// = 5.0; // Minimal K (overshoot) = 5.0
double
lma_a2a
,
String
[]
slice_titles
,
//
String
title_targets_filt
,
double
[][][]
failures_debug
,
int
[]
targets_remain
,
int
tilesX
,
boolean
show
,
QuadCLT
parentCLT
)
{
boolean
save
=
(
parentCLT
!=
null
);
double
lma_minxy
=
0.8
;
double
[][]
target_scores
=
getEffectiveStrengthLMA
(
coord_data
,
// final double [][][] target_coords, // LMA
importance_limit
,
// final double importance_limit,
importance_power
,
// final double importance_power, // Raise each factor to this power before combining
importance
,
// final double [] importance, // for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
lma_rms
,
// final double lma_rms, // = 1.5; // Maximal RMS (should always match, regardless if A)
lma_arms
,
// final double lma_arms, // = 0.06; // Maximal absolute RMS (should match one of cuas_lma_arms OR cuas_lma_rrms (0.484)
lma_rrms
,
// final double lma_rrms, // = 0.15; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
lma_mina
,
// final double lma_mina, // = 1.0; // Minimal A (amplitude)
lma_maxr
,
// final double lma_maxr, // = 5.0; // Minimal K (overshoot) = 3.0
lma_minr1
,
// final double lma_minr1,// = 1.0; // Minimal R1 (radius of positive peak)
lma_mink
,
// final double lma_mink, // = 0.0; // Minimal K (overshoot) = 1.0
lma_maxk
,
// final double lma_maxk, // = 5.0; // Minimal K (overshoot) = 3.0// final double lma_a2a,
lma_a2a
,
// final double lma_a2a,
lma_minxy
,
// final double lma_minxy, // 0.8
tilesX
,
// final int tilesX,
failures_debug
,
// final double failures_debug,
null
);
// remain); // final int [] remain)
/*
boolean [][] good_targets = filterTargetsLMA(
coord_data, // final double [][][] target_coords,
lma_rms, // double lma_rms, // = 1.5; // Maximal RMS (should always match, regardless if A)
...
...
@@ -930,6 +972,7 @@ public class CuasMotion {
lma_rrms, // double lma_rrms, // = 0.03; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
lma_mina, // double lma_mina, // = 1.0; // Minimal A (amplitude)
lma_maxr, // double lma_maxr, // = 5.0; // Minimal K (overshoot) = 3.0
lma_minr1, //double lma_minr1,// = 1.0; // Minimal R1 (radius of positive peak)
lma_mink, // double lma_mink, // = 1.0; // Minimal K (overshoot) = 1.0
lma_maxk, // double lma_maxk, // = 1.0; // Minimal K (overshoot) = 3.0
lma_minxy, // final double lma_minxy, // 0.8
...
...
@@ -938,6 +981,10 @@ public class CuasMotion {
double [][][] coord_data_filtered = applyFilter(
coord_data, // double [][][] motion_scan,
good_targets); // boolean [][] filter5)
*/
double
[][][]
coord_data_filtered
=
applyFilter
(
coord_data
,
// double [][][] motion_scan,
target_scores
);
// double [][] filter5)
if
(
save
||
show
)
{
ImagePlus
imp
=
showVectorFieldsSequenceLMA
(
coord_data_filtered
,
// double [][][] target_scene_sequence,
...
...
@@ -1065,7 +1112,7 @@ public class CuasMotion {
param_select
[
CuasMotionLMA
.
INDX_C
]
=
lma_fit_c
;
param_select
[
CuasMotionLMA
.
INDX_RR0
]
=
lma_fit_r
;
param_select
[
CuasMotionLMA
.
INDX_K
]
=
lma_fit_k
;
final
int
dbg_tile
=
(
38
+
45
*
80
);
final
int
dbg_tile
=
(
3
3
+
34
*
80
);
//(3
8 + 45 * 80);
final
int
dbg_seq
=
-
15
;
// final boolean[] fpn_mask= no_border? (new boolean[0]) : null;
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
...
...
@@ -1106,6 +1153,7 @@ public class CuasMotion {
int
ntile_amax
=
TileNeibs
.
getAmaxTile
(
pix_tile
);
//double [] data)
double
amax_val
=
pix_tile
[
ntile_amax
];
double
lmax_val
=
amax_val
;
int
use_max
=
-
1
;
if
(!
tn
.
isEdge
(
ntile_amax
))
{
boolean
isolated
=
tn
.
isMaxIsolated
(
...
...
@@ -1138,6 +1186,7 @@ public class CuasMotion {
}
}
}
lmax_val
=
best_val
;
}
if
(
use_max
<
0
){
// no candidate for the centroid/lma
...
...
@@ -1197,6 +1246,7 @@ public class CuasMotion {
mv
[
1
],
// double yc, // relative to center =width/2
lma_r0
,
// double r0,
lma_ovrsht
,
// double k,
lmax_val
,
// double lmax_val,
debugLevel
);
// int debugLevel)
int
rslt
=
cuasMotionLMA
.
runLma
(
// <0 - failed, >=0 iteration number (1 - immediately)
lambda
,
// double lambda, // 0.1
...
...
@@ -1283,6 +1333,24 @@ public class CuasMotion {
}
public
static
double
[][][]
applyFilter
(
double
[][][]
motion_scan
,
double
[][]
scores
){
double
[][][]
filtered_scan
=
new
double
[
motion_scan
.
length
][
motion_scan
[
0
].
length
][];
for
(
int
nscan
=
0
;
nscan
<
motion_scan
.
length
;
nscan
++)
{
for
(
int
t
=
0
;
t
<
motion_scan
[
nscan
].
length
;
t
++)
{
if
((
motion_scan
[
nscan
][
t
]
!=
null
)
&&
(
scores
[
nscan
][
t
]
>
0
))
{
filtered_scan
[
nscan
][
t
]
=
motion_scan
[
nscan
][
t
].
clone
();
}
}
}
return
filtered_scan
;
}
public
static
ImagePlus
showVectorFieldsSequence
(
double
[][][]
vector_fields_sequence
,
double
speed_min
,
...
...
@@ -1451,6 +1519,7 @@ public class CuasMotion {
return
filter_target
;
}
@Deprecated
public
static
boolean
[][]
filterTargetsLMA
(
final
double
[][][]
target_coords
,
double
lma_rms
,
// = 1.5; // Maximal RMS (should always match, regardless if A)
...
...
@@ -1458,6 +1527,7 @@ public class CuasMotion {
double
lma_rrms
,
// = 0.15; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
double
lma_mina
,
// = 1.0; // Minimal A (amplitude)
double
lma_maxr
,
// = 5.0; // Minimal K (overshoot) = 3.0
double
lma_minr1
,
// = 1.0; // Minimal R1 (radius of positive peak)
double
lma_mink
,
// = 0.0; // Minimal K (overshoot) = 1.0
double
lma_maxk
,
// = 5.0; // Minimal K (overshoot) = 3.0
final
double
lma_minxy
,
// 0.8
...
...
@@ -1490,19 +1560,38 @@ public class CuasMotion {
continue
;
// LMA failed
}
double
A
=
lma_rslts
[
CuasMotionLMA
.
RSLT_A
];
double
RMSE
=
lma_rslts
[
CuasMotionLMA
.
RSLT_RMS
];
double
RMSE_A
=
lma_rslts
[
CuasMotionLMA
.
RSLT_RMS_A
];
double
R1
=
lma_rslts
[
CuasMotionLMA
.
RSLT_R1
];
if
(
A
<
lma_mina
)
{
continue
;
// too weak
}
if
(
lma_rslts
[
CuasMotionLMA
.
RSLT_RMS
]
>
lma_rms
)
{
if
(
RMSE
>
lma_rms
)
{
continue
;
// too high RMSE regardless of A
}
if
((
RMSE
>
lma_arms
)
&&
(
RMSE_A
>
lma_rrms
))
{
continue
;
// too high RMSE
}
/*
double max_RMS = Math.max(lma_arms, A * lma_rrms);
if
(
lma_rslts
[
CuasMotionLMA
.
RSLT_RMS
]
>
max_RMS
)
{
if (RMSE > max_RMS) {
continue; // too high RMSE
}
*/
double
max_RMS
=
Math
.
max
(
lma_arms
,
A
*
lma_rrms
);
if
(
RMSE
>
max_RMS
)
{
continue
;
// too high RMSE
}
if
(
lma_rslts
[
CuasMotionLMA
.
RSLT_R0
]
>
lma_maxr
)
{
continue
;
// Radius is too high
}
if
(
R1
<
lma_minr1
)
{
continue
;
// Inner radius too small
}
if
(
lma_rslts
[
CuasMotionLMA
.
RSLT_K
]
<
lma_mink
)
{
continue
;
// K is too low
}
...
...
@@ -1530,17 +1619,282 @@ public class CuasMotion {
return
filter_target
;
}
public
static
double
[][]
getEffectiveStrengthLMA
(
final
double
[][][]
target_coords
,
// LMA
final
double
importance_limit
,
final
double
importance_power
,
// Raise each factor to this power before combining
final
double
[]
importance
,
// for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
final
double
lma_rms
,
// = 1.5; // Maximal RMS (should always match, regardless if A)
final
double
lma_arms
,
// = 0.06; // Maximal absolute RMS (should match one of cuas_lma_arms OR cuas_lma_rrms (0.484)
final
double
lma_rrms
,
// = 0.15; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
final
double
lma_mina
,
// = 1.0; // Minimal A (amplitude)
final
double
lma_maxr
,
// = 5.0; // Minimal K (overshoot) = 3.0
final
double
lma_minr1
,
// = 1.0; // Minimal R1 (radius of positive peak)
final
double
lma_mink
,
// = 0.0; // Minimal K (overshoot) = 1.0
final
double
lma_maxk
,
// = 5.0; // Minimal K (overshoot) = 3.0
final
double
lma_a2a
,
final
double
lma_minxy
,
// 0.8
final
int
tilesX
,
final
double
[][][]
failures_debug
,
// if not null, should be [num_scenes][][], fill contain a copy of original target_coords with failure reason
final
int
[]
remain
)
{
final
int
num_seq
=
target_coords
.
length
;
final
int
num_tiles
=
target_coords
[
0
].
length
;
final
double
[][]
effective_strength
=
new
double
[
num_seq
][
num_tiles
];
final
double
maxxy
=
GPUTileProcessor
.
DTT_SIZE
-
1
-
lma_minxy
;
// lma_minxy=1 - prevent bottom row/righth column
final
double
minxy
=
-
GPUTileProcessor
.
DTT_SIZE
+
lma_minxy
;
// lma_minxy=1 - prevent top row/left column
final
int
dbg_tile
=
-(
33
+
34
*
80
);
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
();
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
threads
[
ithread
]
=
new
Thread
()
{
public
void
run
()
{
for
(
int
nSeq
=
ai
.
getAndIncrement
();
nSeq
<
num_seq
;
nSeq
=
ai
.
getAndIncrement
())
{
if
(
failures_debug
!=
null
)
{
failures_debug
[
nSeq
]
=
new
double
[
num_tiles
][];
}
int
num
=
0
;
for
(
int
ntile
=
0
;
ntile
<
num_tiles
;
ntile
++)
{
if
(
ntile
==
dbg_tile
)
{
System
.
out
.
println
(
"filterTargetsLMA(): ntile = "
+
ntile
);
}
double
[]
lma_rslts
=
target_coords
[
nSeq
][
ntile
];
if
(
lma_rslts
!=
null
)
{
if
(
failures_debug
!=
null
)
{
failures_debug
[
nSeq
][
ntile
]
=
lma_rslts
.
clone
();
}
if
(
lma_rslts
[
CuasMotionLMA
.
RSLT_ITERS
]
<
0
)
{
// fitting has not failed
continue
;
// LMA failed
}
double
A
=
lma_rslts
[
CuasMotionLMA
.
RSLT_A
];
double
RMSE
=
lma_rslts
[
CuasMotionLMA
.
RSLT_RMS
];
double
RMSE_A
=
lma_rslts
[
CuasMotionLMA
.
RSLT_RMS_A
];
double
R1
=
lma_rslts
[
CuasMotionLMA
.
RSLT_R1
];
double
MAX2A
=
lma_rslts
[
CuasMotionLMA
.
RSLT_MAX2A
];
if
(
A
<
lma_mina
)
{
if
(
failures_debug
!=
null
)
failures_debug
[
nSeq
][
ntile
][
CuasMotionLMA
.
RSLT_FAIL
]
=
CuasMotionLMA
.
FAIL_A_LOW
;
continue
;
// too weak
}
if
(
MAX2A
<
lma_a2a
)
{
if
(
failures_debug
!=
null
)
failures_debug
[
nSeq
][
ntile
][
CuasMotionLMA
.
RSLT_FAIL
]
=
CuasMotionLMA
.
FAIL_ACENT
;
continue
;
// ratio of maximal value to A is too low
}
if
(
RMSE
>
lma_rms
)
{
if
(
failures_debug
!=
null
)
failures_debug
[
nSeq
][
ntile
][
CuasMotionLMA
.
RSLT_FAIL
]
=
CuasMotionLMA
.
FAIL_RMSE
;
continue
;
// too high RMSE regardless of A
}
if
((
RMSE
>
lma_arms
)
&&
(
RMSE_A
>
lma_rrms
))
{
if
(
failures_debug
!=
null
)
failures_debug
[
nSeq
][
ntile
][
CuasMotionLMA
.
RSLT_FAIL
]
=
CuasMotionLMA
.
FAIL_RMSE_R
;
continue
;
// too high RMSE
}
if
(
lma_rslts
[
CuasMotionLMA
.
RSLT_R0
]
>
lma_maxr
)
{
if
(
failures_debug
!=
null
)
failures_debug
[
nSeq
][
ntile
][
CuasMotionLMA
.
RSLT_FAIL
]
=
CuasMotionLMA
.
FAIL_R0_HIGH
;
continue
;
// Radius is too high
}
if
(
R1
<
lma_minr1
)
{
if
(
failures_debug
!=
null
)
failures_debug
[
nSeq
][
ntile
][
CuasMotionLMA
.
RSLT_FAIL
]
=
CuasMotionLMA
.
FAIL_R1_LOW
;
continue
;
// Inner radius too small
}
if
(
lma_rslts
[
CuasMotionLMA
.
RSLT_K
]
<
lma_mink
)
{
if
(
failures_debug
!=
null
)
failures_debug
[
nSeq
][
ntile
][
CuasMotionLMA
.
RSLT_FAIL
]
=
CuasMotionLMA
.
FAIL_K_LOW
;
continue
;
// K is too low
}
if
(
lma_rslts
[
CuasMotionLMA
.
RSLT_K
]
>
lma_maxk
)
{
if
(
failures_debug
!=
null
)
failures_debug
[
nSeq
][
ntile
][
CuasMotionLMA
.
RSLT_FAIL
]
=
CuasMotionLMA
.
FAIL_K_HIGH
;
continue
;
// K is too high
}
double
x
=
lma_rslts
[
CuasMotionLMA
.
RSLT_X
];
double
y
=
lma_rslts
[
CuasMotionLMA
.
RSLT_Y
];
if
((
x
<
minxy
)
||
(
y
<
minxy
)
||
(
x
>
maxxy
)
||
(
y
>
maxxy
))
{
if
(
failures_debug
!=
null
)
failures_debug
[
nSeq
][
ntile
][
CuasMotionLMA
.
RSLT_FAIL
]
=
CuasMotionLMA
.
FAIL_FAR
;
continue
;
// center outside of allowed range (on the very edges)
}
// filter_target[nSeq][ntile] = true;
// Now calculate overall quality
double
[]
quality_factors
=
new
double
[
IMPORTANCE_LENGTH
];
double
inv_rms
=
1.0
/
RMSE
;
double
inv_rms_lim
=
1.0
/
lma_arms
;
double
inv_rel_rms
=
1.0
/
RMSE_A
;
// A/RMSE;
double
inv_rel_rms_lim
=
1.0
/
lma_rrms
;
quality_factors
[
IMPORTANCE_A
]
=
(
A
-
lma_mina
)/
lma_mina
;
quality_factors
[
IMPORTANCE_RMS
]
=
(
inv_rms
-
inv_rms_lim
)/
inv_rms_lim
;
// only >0 for small max-es
quality_factors
[
IMPORTANCE_RMS_A
]
=
(
inv_rel_rms
-
inv_rel_rms_lim
)/
inv_rel_rms_lim
;
// only >0 for small max-es
double
sw
=
0
;
for
(
int
i
=
0
;
i
<
importance
.
length
;
i
++)
{
sw
+=
importance
[
i
];
}
for
(
int
i
=
0
;
i
<
importance
.
length
;
i
++)
{
quality_factors
[
i
]
=
Math
.
min
(
quality_factors
[
i
],
importance_limit
);
}
// importance_limit
double
quality
=
0
;
for
(
int
i
=
0
;
i
<
importance
.
length
;
i
++)
{
double
factor_contrib
=
Math
.
pow
(
quality_factors
[
i
],
importance_power
);
quality
+=
(
importance
[
i
]/
sw
)
*
factor_contrib
;
}
quality
=
Math
.
pow
(
quality
,
1.0
/
importance_power
);
effective_strength
[
nSeq
][
ntile
]
=
quality
;
num
++;
}
}
if
(
remain
!=
null
)
{
remain
[
nSeq
]
=
num
;
}
}
}
};
}
ImageDtt
.
startAndJoin
(
threads
);
return
effective_strength
;
}
public
static
double
[][]
getEffectiveStrengthMV
(
// calculate tiles effective strength by the motion vectors. Combine with the target LMA?
final
double
[][][]
motion_scan
,
final
int
tilesX
,
final
int
range
,
// 1 or 2
double
speed_min
,
double
speed_pref
,
double
speed_boost
){
final
int
num_seq
=
motion_scan
.
length
;
final
int
num_tiles
=
motion_scan
[
0
].
length
;
final
double
[][]
effective_strength
=
new
double
[
num_seq
][
num_tiles
];
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
();
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
threads
[
ithread
]
=
new
Thread
()
{
public
void
run
()
{
for
(
int
nSeq
=
ai
.
getAndIncrement
();
nSeq
<
num_seq
;
nSeq
=
ai
.
getAndIncrement
())
{
double
[][]
ms
=
motion_scan
[
nSeq
];
for
(
int
ntile
=
0
;
ntile
<
num_tiles
;
ntile
++)
{
if
(
ms
[
ntile
]
!=
null
)
{
effective_strength
[
nSeq
][
ntile
]
=
getEffectiveStrength
(
ms
[
ntile
],
// double [] mv_tile, // 4
speed_min
,
// double speed_min,
speed_pref
,
// double speed_pref,
speed_boost
);
//double speed_boost)
}
}
}
}
};
}
ImageDtt
.
startAndJoin
(
threads
);
return
effective_strength
;
}
public
static
boolean
[][]
filterMotionScanTarget
(
// should work for motion vectors and target coordinates
double
[][]
confidence
,
double
min_confidence
,
final
int
tilesX
,
final
int
range
,
// 1 or 2
final
int
[]
remain
,
final
int
[]
passes
,
// debugging - numer of passes required
final
int
debugLevel
){
final
int
num_seq
=
confidence
.
length
;
final
int
num_tiles
=
confidence
[
0
].
length
;
final
int
tilesY
=
num_tiles
/
tilesX
;
final
boolean
[][]
filter5
=
new
boolean
[
num_seq
][
num_tiles
];
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
();
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
threads
[
ithread
]
=
new
Thread
()
{
public
void
run
()
{
TileNeibs
tn
=
new
TileNeibs
(
tilesX
,
tilesY
);
boolean
[]
prohibit
=
new
boolean
[
num_tiles
];
for
(
int
nSeq
=
ai
.
getAndIncrement
();
nSeq
<
num_seq
;
nSeq
=
ai
.
getAndIncrement
())
{
int
num_total
=
0
;
Arrays
.
fill
(
prohibit
,
false
);
double
[]
conf
=
confidence
[
nSeq
];
int
num_this_pass
=
0
;
int
npass
=
0
;
do
{
npass
++;
num_this_pass
=
0
;
for
(
int
tileY
=
0
;
tileY
<
tilesY
;
tileY
++)
{
for
(
int
tileX
=
0
;
tileX
<
tilesX
;
tileX
++)
{
int
ntile
=
tileX
+
tilesX
*
tileY
;
if
((
conf
[
ntile
]
>
0.0
)
&&
!
prohibit
[
ntile
])
{
boolean
ismax
=
true
;
check_max:
{
double
cval
=
conf
[
ntile
]-
min_confidence
;
if
(
cval
<=
0
)
{
ismax
=
false
;
prohibit
[
ntile
]
=
true
;
// not needed
break
check_max
;
}
for
(
int
dy
=
-
range
;
dy
<=
range
;
dy
++)
{
for
(
int
dx
=
-
range
;
dx
<=
range
;
dx
++)
{
int
indx
=
tn
.
getNeibIndex
(
ntile
,
dx
,
dy
);
if
((
indx
>=
0
)
&&
!
prohibit
[
indx
])
{
double
val
=
conf
[
indx
]-
min_confidence
;
if
(
val
>
cval
)
{
ismax
=
false
;
break
check_max
;
}
}
}
}
}
if
(
ismax
)
{
filter5
[
nSeq
][
ntile
]
=
true
;
// ismax;
// prohibit all around, including this one
for
(
int
dy
=
-
range
;
dy
<=
range
;
dy
++)
{
for
(
int
dx
=
-
range
;
dx
<=
range
;
dx
++)
{
int
indx
=
tn
.
getNeibIndex
(
ntile
,
dx
,
dy
);
if
(
indx
>=
0
)
{
// && ((filtered == null) || !filtered[nSeq][indx])){
prohibit
[
indx
]
=
true
;
}
}
}
num_this_pass
++;
}
}
}
}
num_total
+=
num_this_pass
;
}
while
(
num_this_pass
>
0
);
if
(
remain
!=
null
)
{
remain
[
nSeq
]
=
num_total
;
}
if
(
passes
!=
null
)
{
passes
[
nSeq
]
=
npass
;
}
}
}
};
}
ImageDtt
.
startAndJoin
(
threads
);
return
filter5
;
}
public
static
boolean
[][]
filterMotionScan
(
final
double
[][][]
motion_scan
,
final
int
tilesX
,
final
int
range
,
// 1 or 2
final
boolean
[][]
filtered
,
// same format as output, previously selected
//
final boolean [][] filtered, // same format as output, previously selected
final
int
[]
remain
,
double
speed_min
,
double
speed_pref
,
double
speed_boost
){
final
boolean
[][]
filtered
=
null
;
final
int
num_seq
=
motion_scan
.
length
;
final
int
num_tiles
=
motion_scan
[
0
].
length
;
final
int
tilesY
=
num_tiles
/
tilesX
;
...
...
@@ -1557,7 +1911,7 @@ public class CuasMotion {
for
(
int
tileY
=
0
;
tileY
<
tilesY
;
tileY
++)
{
for
(
int
tileX
=
0
;
tileX
<
tilesX
;
tileX
++)
{
int
ntile
=
tileX
+
tilesX
*
tileY
;
if
((
ms
[
ntile
]
!=
null
)
&&
((
filtered
==
null
)
||
!
filtered
[
nSeq
][
ntile
]))
{
if
((
ms
[
ntile
]
!=
null
)
)
{
//
&& ((filtered == null) || !filtered[nSeq][ntile])) {
boolean
ismax
=
true
;
check_max:
{
// double cval = ms[ntile][INDX_STRENGTH]*ms[ntile][INDX_FRAC]; // quality
...
...
@@ -1573,8 +1927,9 @@ public class CuasMotion {
for
(
int
dy
=
-
range
;
dy
<=
range
;
dy
++)
{
for
(
int
dx
=
-
range
;
dx
<=
range
;
dx
++)
{
int
indx
=
tn
.
getNeibIndex
(
ntile
,
dx
,
dy
);
if
((
indx
>=
0
)
&&
(
ms
[
indx
]
!=
null
)
&&
((
filtered
==
null
)
||
!
filtered
[
nSeq
][
indx
])){
if
((
filtered
==
null
)
||
!
filtered
[
nSeq
][
indx
])
{
// double val = ms[indx][INDX_STRENGTH]*ms[indx][INDX_FRAC]; // quality
// if ((indx >= 0) && (ms[indx] != null) && ((filtered == null) || !filtered[nSeq][indx])){ if ((filtered == null) || !filtered[nSeq][indx]) {
if
((
indx
>=
0
)
&&
(
ms
[
indx
]
!=
null
))
{
// && ((filtered == null) || !filtered[nSeq][indx])){
// if ((filtered == null) || !filtered[nSeq][indx]) {
// FIXME: calculate once all values before this cycle
double
val
=
getEffectiveStrength
(
ms
[
indx
],
// double [] mv_tile, // 4
...
...
@@ -1585,7 +1940,7 @@ public class CuasMotion {
ismax
=
false
;
break
check_max
;
}
}
//
}
}
}
}
...
...
@@ -3379,8 +3734,19 @@ public class CuasMotion {
double
lma_rrms
=
clt_parameters
.
imp
.
cuas_lma_rrms
;
// = 0.15; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
double
lma_mina
=
clt_parameters
.
imp
.
cuas_lma_mina
;
// = 1.0; // Minimal A (amplitude)
double
lma_maxr
=
clt_parameters
.
imp
.
cuas_lma_maxr
;
// = 5.0; // Maximal radius (>3.8)
double
lma_minr1
=
clt_parameters
.
imp
.
cuas_lma_minr1
;
// = 1.0; // Maximal inner radius
double
lma_mink
=
clt_parameters
.
imp
.
cuas_lma_mink
;
// = 0.0; // Minimal K (overshoot) <0.007
double
lma_maxk
=
clt_parameters
.
imp
.
cuas_lma_maxk
;
// = 5.0; // Minimal K (overshoot) > 3.8
double
lma_a2a
=
clt_parameters
.
imp
.
cuas_lma_a2a
;
// = 0.7; // Minimal ratio of the maximal pixel to the amplitude
// Handling overall target scores
double
min_score_mv
=
clt_parameters
.
imp
.
cuas_score_mv
;
double
min_score_lma
=
clt_parameters
.
imp
.
cuas_score_lma
;
double
factor_lim
=
clt_parameters
.
imp
.
cuas_factor_lim
;
double
factor_pow
=
clt_parameters
.
imp
.
cuas_factor_pow
;
double
[]
score_coeff
=
clt_parameters
.
imp
.
cuas_score_coeff
;
// boolean remove_isolated= clt_parameters.imp.cuas_isolated;
double
input_range
=
clt_parameters
.
imp
.
cuas_input_range
;
// 5;
int
iter_show
=
clt_parameters
.
imp
.
cuas_iter_show
;
//1; // Maximal enhancement iteration to show intermediate result (0 - none)
...
...
@@ -3405,6 +3771,8 @@ public class CuasMotion {
final
int
frame0
=
start_frame
+
seq_length
/
2
;
final
int
half_accum_range
=
corr_pairs
/
2
;
int
[]
remain
=
new
int
[
num_corr_samples
];
int
[]
passes
=
new
int
[
num_corr_samples
];
// debugging filter5
boolean
debug_tum
=
true
;
// false;
String
model_prefix
=
parentCLT
.
getImageName
()+
getParametersSuffix
(
clt_parameters
,
null
);
float
[][]
fpixels_tum
=
fpixels
;
...
...
@@ -3637,16 +4005,49 @@ public class CuasMotion {
if
(
debugLevel
>
-
4
)
printRemain
(
remain
,
"motion_scan wo bad"
,
true
);
// filter remaining (no known bad ones)
boolean
[][]
filter5
=
filterMotionScan
(
double
[][]
effective_strength
=
getEffectiveStrengthMV
(
// calculate tiles effective strength by the motion vectors. Combine with the target LMA?
motion_scan
,
// final double [][][] motion_scan,
cuasMotion
.
tilesX
,
// final int tilesX)
max_range
,
// final int range, // 1 or 2
null
,
// final boolean [][] filtered, // same format as output, previously selected
speed_min
,
// double speed_min,
speed_pref
,
// double speed_pref,
speed_boost
);
// double speed_boost);
if
(
save_filtered_low
)
{
ImagePlus
imp_effective_strength
=
ShowDoubleFloatArrays
.
makeArrays
(
effective_strength
,
// double[][] pixels,
cuasMotion
.
tilesX
,
cuasMotion
.
tilesY
,
model_prefix
+
"-EFFECTIVE_STRENGTH-n"
+
niter
,
// String title,
slice_titles
);
if
(!
batch_mode
)
{
imp_effective_strength
.
show
();
}
parentCLT
.
saveImagePlusInModelDirectory
(
imp_effective_strength
);
// ImagePlus imp)
}
boolean
[][]
filter5
=
filterMotionScanTarget
(
effective_strength
,
// double [][] confidence,
min_score_mv
,
// double min_confidence,
cuasMotion
.
tilesX
,
// final int tilesX,
max_range
,
// final int range, // 1 or 2
remain
,
// final int [] remain){
passes
,
// final int [] passes, // debugging - numer of passes required
debugLevel
);
// final int debugLevel)
/*
boolean[][] filter50 = filterMotionScan(
motion_scan, // final double [][][] motion_scan,
cuasMotion.tilesX, // final int tilesX)
max_range, // final int range, // 1 or 2
// null, // final boolean [][] filtered, // same format as output, previously selected
remain, // final int [] remain){
speed_min, // double speed_min,
speed_pref, // double speed_pref,
speed_boost); // double speed_boost);
*/
if
(
debugLevel
>
-
4
)
printRemain
(
remain
,
"filter5"
,
true
);
if
(
debugLevel
>
-
4
)
printRemain
(
passes
,
"filter5 passes"
,
true
);
if
(
save_filtered_low
)
{
ImagePlus
imp_filter5
=
ShowDoubleFloatArrays
.
makeArrays
(
filter5
,
// double[][] pixels,
...
...
@@ -3661,9 +4062,6 @@ public class CuasMotion {
}
double
[][][]
motion_scan_filtered
=
applyFilter
(
// motion vectors
motion_scan
,
// double [][][] motion_scan,
filter5
);
// boolean [][] filter5)
...
...
@@ -3861,12 +4259,12 @@ public class CuasMotion {
cuasMotion
.
tilesX
);
// int tilesX) {
parentCLT
.
saveImagePlusInModelDirectory
(
imp_lma
);
// ImagePlus imp)
}
double
[][][]
coord_centroids_filtered
=
filterAndShowTargets
(
// generates motion vectors?
double
[][][]
coord_centroids_filtered
=
filterAndShowTargets
(
// generates motion vectors?
Not used?
coord_centroid
,
// double [][][] coord_data,
target_strength
,
// double target_strength,
target_frac
,
// double [][] target_frac,
slice_titles
,
// String [] slice_titles, //
model_prefix
+
"-CENTROIDS-FILTERED-n"
+
niter
,
// String title_targets_filt,
model_prefix
+
"-CENTROIDS-FILTERED-n"
+
niter
,
// String title_targets_filt,
OK
remain
,
// int [] targets_remain,
cuasMotion
.
tilesX
,
// int tilesX)
save_filtered_low
&&
!
batch_mode
,
// boolean show)
...
...
@@ -3880,23 +4278,38 @@ public class CuasMotion {
break
;
// }
}
double
[][][]
failures_debug
=
(
intermed_low
)
?
(
new
double
[
targets_good
.
length
][][])
:
null
;
double
[][][]
coord_data_filtered_lma
=
filterAndShowTargetsLMA
(
coord_lma
,
// double [][][] coord_data,
factor_lim
,
// final double importance_limit,
factor_pow
,
// final double importance_power, // Raise each factor to this power before combining
score_coeff
,
// final double [] importance, // for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
lma_rms
,
// double lma_rms, // = 1.5; // Maximal RMS (should always match, regardless if A)
lma_arms
,
// double lma_arms, // = 0.03; // Maximal absolutre RMS
lma_rrms
,
// double lma_rrms, // = 0.03; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
lma_mina
,
// double lma_mina, // = 1.0; // Minimal A (amplitude)
lma_maxr
,
// double lma_maxr, // = 5.0; // Minimal K (overshoot) = 3.0
lma_minr1
,
// double lma_minr1,// = 1.0; // Minimal R1 (radius of positive peak)
lma_mink
,
// double lma_mink, // = 1.0; // Minimal K (overshoot) = 1.0
lma_maxk
,
// double lma_maxk, // = 1.0; // Minimal K (overshoot) = 3.0
lma_a2a
,
// double lma_a2a,
slice_titles
,
// String [] slice_titles, //
model_prefix
+
"-TARGETS-FILTERED-LMA-n"
+
niter
,
// String title_targets_filt,
model_prefix
+
"-TARGETS-FILTERED-LMA-n"
+
niter
,
// String title_targets_filt, // empty
failures_debug
,
// double [][][] failures_debug,
remain
,
// int [] targets_remain,
cuasMotion
.
tilesX
,
// int tilesX)
save_filtered_low
&&
!
batch_mode
,
// boolean show)
(
save_filtered_low
?
parentCLT
:
null
));
// do not save //QuadCLT parentCLT)
if
(
debugLevel
>
-
4
)
remained_total
=
printRemain
(
remain
,
"coord_data_filtered_lma: Total new targets"
,
true
);
if
(
failures_debug
!=
null
)
{
// last slice show reason of failure
ImagePlus
imp_failures
=
showVectorFieldsSequenceLMA
(
failures_debug
,
// double [][][] vector_fields_sequence,
slice_titles
,
// String [] titles, // all slices*frames titles or just slice titles or null
model_prefix
+
"-FAILURES-n"
+
niter
,
// String title,
!
batch_mode
,
// boolean show,
cuasMotion
.
tilesX
);
// int tilesX) {
parentCLT
.
saveImagePlusInModelDirectory
(
imp_failures
);
}
// add good targets to targets_good
targets_good
=
combineMotionScans
(
// lma-vectors
...
...
@@ -3945,42 +4358,101 @@ public class CuasMotion {
}
// TODO See if they are needed here at all
/*
fpixels_accumulated_filtered = getTargetImages(
coord_centroids_filtered, // final double [][][] vector_fields, // centers , just null/not null
fpixels_accumulated, // final float [][] accum_data, // should be around 0, no low-freq
cuasMotion.tilesX); // final int tilesX)
if (save_filtered_high) {
ImagePlus imp_acc_filt = ShowDoubleFloatArrays.makeArrays(
fpixels_accumulated_filtered, // double[][] pixels,
cuasMotion.gpu_max_width,
cuasMotion.gpu_max_height,
model_prefix+"-ACCUMULATED-FILTERED-n"+niter, // String title,
if
(
debugLevel
>
-
4
)
{
System
.
out
.
println
(
"Iteration "
+
niter
+
" DONE."
);
}
}
//for (niter=0; niter < max_iter; niter++)
// there could be conflicting tiles in targets_good. Calculate scores and then filter to keep the best ones that do not conflict
double
lma_minxy
=
0.8
;
double
[][][]
failures_debug
=
(
intermed_low
)
?
(
new
double
[
targets_good
.
length
][][])
:
null
;
double
[][]
target_scores
=
getEffectiveStrengthLMA
(
targets_good
,
// final double [][][] target_coords, // LMA
factor_lim
,
// final double importance_limit,
factor_pow
,
// final double importance_power, // Raise each factor to this power before combining
score_coeff
,
// final double [] importance, // for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
lma_rms
,
// final double lma_rms, // = 1.5; // Maximal RMS (should always match, regardless if A)
lma_arms
,
// final double lma_arms, // = 0.06; // Maximal absolute RMS (should match one of cuas_lma_arms OR cuas_lma_rrms (0.484)
lma_rrms
,
// final double lma_rrms, // = 0.15; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
lma_mina
,
// final double lma_mina, // = 1.0; // Minimal A (amplitude)
lma_maxr
,
// final double lma_maxr, // = 5.0; // Minimal K (overshoot) = 3.0
lma_minr1
,
// final double lma_minr1,// = 1.0; // Minimal R1 (radius of positive peak)
lma_mink
,
// final double lma_mink, // = 0.0; // Minimal K (overshoot) = 1.0
lma_maxk
,
// final double lma_maxk, // = 5.0; // Minimal K (overshoot) = 3.0
lma_a2a
,
// final double lma_a2a,
lma_minxy
,
// final double lma_minxy, // 0.8
cuasMotion
.
tilesX
,
// final int tilesX,
failures_debug
,
// final double [][][] failures_debug,
remain
);
// final int [] remain)
if
(
debugLevel
>
-
4
)
printRemain
(
remain
,
"remaining good targets"
,
true
);
if
(
intermed_low
)
{
ImagePlus
imp_target_scores
=
ShowDoubleFloatArrays
.
makeArrays
(
target_scores
,
// double[][] pixels,
cuasMotion
.
tilesX
,
cuasMotion
.
tilesY
,
model_prefix
+
"-TARGET_SCORES"
,
// String title,
slice_titles
);
imp_acc_filt.getProcessor().setMinAndMax(-input_range/2, input_range/2);
if
(!
batch_mode
)
{
imp_acc_filt
.show();
imp_target_scores
.
show
();
}
parentCLT.saveImagePlusInModelDirectory(imp_acc_filt
); // ImagePlus imp)
parentCLT
.
saveImagePlusInModelDirectory
(
imp_target_scores
);
// ImagePlus imp)
}
*/
if
(
debugLevel
>
-
4
)
{
System
.
out
.
println
(
"Iteration "
+
niter
+
" DONE."
);
if
(
failures_debug
!=
null
)
{
// last slice show reason of failure
ImagePlus
imp_failures
=
showVectorFieldsSequenceLMA
(
failures_debug
,
// double [][][] vector_fields_sequence,
slice_titles
,
// String [] titles, // all slices*frames titles or just slice titles or null
model_prefix
+
"-FAILURES"
,
// String title,
!
batch_mode
,
// boolean show,
cuasMotion
.
tilesX
);
// int tilesX) {
parentCLT
.
saveImagePlusInModelDirectory
(
imp_failures
);
}
// if (no_improve) {
// if (debugLevel > -4) {
// System.out.println("There was no improvement, exiting the loop, iteration "+niter+" .");
// }
// }
}
//for (niter=0; niter < max_iter; niter++)
boolean
[][]
filter5
=
filterMotionScanTarget
(
target_scores
,
// double [][] confidence,
min_score_lma
,
// min_mv_strength, // double min_confidence,
cuasMotion
.
tilesX
,
// final int tilesX,
max_range
,
// final int range, // 1 or 2
remain
,
// final int [] remain){
passes
,
// final int [] passes, // debugging - numer of passes required
debugLevel
);
// final int debugLevel)
if
(
debugLevel
>
-
4
)
printRemain
(
remain
,
"filter5 lma"
,
true
);
if
(
debugLevel
>
-
4
)
printRemain
(
passes
,
"filter5 passes"
,
true
);
if
(
intermed_low
)
{
ImagePlus
imp_filter5_lma
=
ShowDoubleFloatArrays
.
makeArrays
(
filter5
,
// double[][] pixels,
cuasMotion
.
tilesX
,
cuasMotion
.
tilesY
,
model_prefix
+
"-FILTER5_LMA"
,
// String title,
slice_titles
);
if
(!
batch_mode
)
{
imp_filter5_lma
.
show
();
}
parentCLT
.
saveImagePlusInModelDirectory
(
imp_filter5_lma
);
}
if
(
intermed_low
)
{
// save final
ImagePlus
imp_good
=
showVectorFieldsSequenceLMA
(
targets_good
,
// double [][][] vector_fields_sequence,
slice_titles
,
// String [] titles, // all slices*frames titles or just slice titles or null
model_prefix
+
"-TARGETS-GOOD-ALL"
,
// String title,
!
batch_mode
,
// boolean show,
cuasMotion
.
tilesX
);
// int tilesX) {
parentCLT
.
saveImagePlusInModelDirectory
(
imp_good
);
// ImagePlus imp)
}
// apply filter5 to targets_good
targets_good
=
applyFilter
(
// motion vectors
targets_good
,
// double [][][] motion_scan,
filter5
);
// boolean [][] filter5)
double
[][][]
motion_good
=
filterMotionScans
(
motion_scan_original
,
// double [][][] scan1 // or just use motion_scan - it has only bad removed
targets_good
,
// double [][][] scan1){ // keep scan0 that is in scan1
remain
);
if
(
debugLevel
>
-
4
)
printRemain
(
remain
,
"
All done: motion_good
"
,
true
);
if
(
debugLevel
>
-
4
)
printRemain
(
remain
,
"
motion_good final
"
,
true
);
if
(
intermed_low
)
{
// save final
ImagePlus
imp_good
=
showVectorFieldsSequenceLMA
(
...
...
@@ -3991,7 +4463,7 @@ public class CuasMotion {
cuasMotion
.
tilesX
);
// int tilesX) {
parentCLT
.
saveImagePlusInModelDirectory
(
imp_good
);
// ImagePlus imp)
ImagePlus
imp_mv_good
=
showVectorFieldsSequence
(
targets
_good
,
// double [][][] vector_fields_sequence,
motion
_good
,
// double [][][] vector_fields_sequence,
speed_min
,
// double speed_min,
speed_pref
,
// double speed_pref,
speed_boost
,
// double speed_boost,
...
...
@@ -4068,12 +4540,23 @@ public class CuasMotion {
double
lma_rrms
=
clt_parameters
.
imp
.
cuas_lma_rrms
;
// = 0.15; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
double
lma_mina
=
clt_parameters
.
imp
.
cuas_lma_mina
;
// = 1.0; // Minimal A (amplitude)
double
lma_maxr
=
clt_parameters
.
imp
.
cuas_lma_maxr
;
// = 5.0; // Maximal radius (>3.8)
double
lma_minr1
=
clt_parameters
.
imp
.
cuas_lma_minr1
;
// = 1.0; // Maximal inner radius
double
lma_mink
=
clt_parameters
.
imp
.
cuas_lma_mink
;
// = 0.0; // Minimal K (overshoot) <0.007
double
lma_maxk
=
clt_parameters
.
imp
.
cuas_lma_maxk
;
// = 5.0; // Minimal K (overshoot) > 3.8
double
lma_a2a
=
clt_parameters
.
imp
.
cuas_lma_a2a
;
// = 0.7; // Minimal ratio of the maximal pixel to the amplitude
double
factor_lim
=
clt_parameters
.
imp
.
cuas_factor_lim
;
double
factor_pow
=
clt_parameters
.
imp
.
cuas_factor_pow
;
double
[]
score_coeff
=
clt_parameters
.
imp
.
cuas_score_coeff
;
boolean
remove_isolated
=
clt_parameters
.
imp
.
cuas_isolated
;
double
max_mismatch
=
clt_parameters
.
imp
.
cuas_max_mismatch
;
// 2;
boolean
ignore_mismatch
=
clt_parameters
.
imp
.
cuas_ignore_mismatch
;
boolean
target_by_horizon
=
clt_parameters
.
imp
.
cuas_by_horizon
;
// true;
double
target_horizon
=
clt_parameters
.
imp
.
cuas_horizon
;
// a90
int
target_type
=
clt_parameters
.
imp
.
cuas_target_type
;
//0; // 0 - unknown, 1 - known, 2 - friend, 3 - foe
double
input_range
=
clt_parameters
.
imp
.
cuas_input_range
;
// 5;
boolean
scale2x
=
clt_parameters
.
imp
.
cuas_scale2x
;
//true;
...
...
@@ -4213,15 +4696,21 @@ public class CuasMotion {
double
[][][]
coord_data_filtered_lma
=
filterAndShowTargetsLMA
(
coord_lma
,
// double [][][] coord_data,
factor_lim
,
// final double importance_limit,
factor_pow
,
// final double importance_power, // Raise each factor to this power before combining
score_coeff
,
// final double [] importance, // for now (each - squared?): [0] - Amplitude (A/A0), 1 - RMS (RMS0/RMS), 2 - RRMS((RMS/A0) / (RMS/A)
lma_rms
,
// double lma_rms, // = 1.5; // Maximal RMS (should always match, regardless if A)
lma_arms
,
// double lma_arms, // = 0.03; // Maximal absolutre RMS
lma_rrms
,
// double lma_rrms, // = 0.03; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
lma_mina
,
// double lma_mina, // = 1.0; // Minimal A (amplitude)
lma_maxr
,
// double lma_maxr, // = 5.0; // Minimal K (overshoot) = 3.0
lma_minr1
,
// double lma_minr1,// = 1.0; // Minimal R1 (radius of positive peak)
lma_mink
,
// double lma_mink, // = 1.0; // Minimal K (overshoot) = 1.0
lma_maxk
,
// double lma_maxk, // = 1.0; // Minimal K (overshoot) = 3.0
lma_a2a
,
// double lma_a2a,
slice_titles
,
// String [] slice_titles, //
model_prefix
+
"-LMA-FILTERED"
,
// String title_targets_filt,
null
,
// double [][][] failures_debug,
remain
,
// int [] targets_remain,
cuasMotion
.
tilesX
,
// int tilesX)
intermed_low
&&
!
batch_mode
,
// show_vector_field); // boolean show)
...
...
@@ -4266,6 +4755,22 @@ public class CuasMotion {
parentCLT
.
saveImagePlusInModelDirectory
(
imp_filtered_combo
);
// ImagePlus imp)
}
double
[][][]
mismatch_ba
=
null
;
if
(
target_by_horizon
)
{
if
(
target_by_horizon
)
{
targets_lma_combo
=
filterByHorizon
(
targets_lma_combo
,
// final double [][][] target_positions,
target_horizon
,
// final double horizon,
remain
,
// final int [] remain,
cuasMotion
.
tilesX
);
// int tilesX) {
}
if
(
debugLevel
>
-
4
)
printRemain
(
remain
,
"Remained after target_by_horizon"
,
true
);
targets_vf_combo
=
filterMotionScans
(
// duplicate removal to motion vectors
targets_vf_combo
,
// double [][][] scan0,
targets_lma_combo
,
// double [][][] scan1)
remain
);
}
if
(
remove_isolated
)
{
double
interseq_scale
=
0.5
*
corr_inc
/
corr_offset
;
// multiply target velocity to get offset in the middle between the key frames
double
[][][][]
ba_xy
=
getHalfBeforeAfterPixXY
(
...
...
@@ -4549,6 +5054,52 @@ public class CuasMotion {
return
filtered_tiles
;
}
public
static
double
[][][]
filterByHorizon
(
final
double
[][][]
target_positions
,
final
double
horizon
,
final
int
[]
remain
,
final
int
tilesX
)
{
final
int
num_seq
=
target_positions
.
length
;
final
int
num_tiles
=
target_positions
[
0
].
length
;
final
double
[][][]
filtered_tiles
=
new
double
[
num_seq
][
num_tiles
][];
final
int
tileSize
=
GPUTileProcessor
.
DTT_SIZE
;
final
Thread
[]
threads
=
ImageDtt
.
newThreadArray
();
final
AtomicInteger
ai
=
new
AtomicInteger
(
0
);
for
(
int
ithread
=
0
;
ithread
<
threads
.
length
;
ithread
++)
{
threads
[
ithread
]
=
new
Thread
()
{
public
void
run
()
{
for
(
int
nSeq
=
ai
.
getAndIncrement
();
nSeq
<
num_seq
;
nSeq
=
ai
.
getAndIncrement
())
{
if
(
remain
!=
null
)
{
remain
[
nSeq
]
=
0
;
}
for
(
int
ntile
=
0
;
ntile
<
num_tiles
;
ntile
++)
{
double
[]
target_pos
=
target_positions
[
nSeq
][
ntile
];
if
(
target_pos
!=
null
)
{
// should be always
// int tileX = ntile % tilesX;
int
tileY
=
ntile
/
tilesX
;
// double xc = tileSize * tileX + tileSize/2;
double
yc
=
tileSize
*
tileY
+
tileSize
/
2
;
// double xtk = xc + target_pos[CuasMotionLMA.RSLT_X];
double
ytk
=
yc
+
target_pos
[
CuasMotionLMA
.
RSLT_Y
];
if
(
ytk
<=
horizon
)
{
filtered_tiles
[
nSeq
][
ntile
]
=
target_pos
;
if
(
remain
!=
null
)
{
remain
[
nSeq
]++;
}
}
}
}
}
}
};
}
ImageDtt
.
startAndJoin
(
threads
);
return
filtered_tiles
;
}
public
static
String
getParametersSuffix
(
CLTParameters
clt_parameters
,
...
...
src/main/java/com/elphel/imagej/cuas/CuasMotionLMA.java
View file @
b56ba447
...
...
@@ -39,14 +39,27 @@ public class CuasMotionLMA {
public
static
final
int
RSLT_Y
=
1
;
public
static
final
int
RSLT_A
=
2
;
public
static
final
int
RSLT_R0
=
3
;
public
static
final
int
RSLT_K
=
4
;
public
static
final
int
RSLT_C
=
5
;
public
static
final
int
RSLT_RMS
=
6
;
public
static
final
int
RSLT_ITERS
=
7
;
public
static
final
int
RSLT_LEN
=
RSLT_ITERS
+
1
;
public
static
final
String
[]
LMA_TITLES
=
{
"X-OFFS"
,
"Y-OFFS"
,
"AMPLITUDE"
,
"RADIUS"
,
"OVERSHOOT"
,
"OFFSET"
,
"RMSE"
,
"ITERATIONS"
};
public
static
final
int
RSLT_R1
=
4
;
public
static
final
int
RSLT_K
=
5
;
public
static
final
int
RSLT_C
=
6
;
public
static
final
int
RSLT_RMS
=
7
;
public
static
final
int
RSLT_RMS_A
=
8
;
public
static
final
int
RSLT_MAX2A
=
9
;
public
static
final
int
RSLT_ITERS
=
10
;
public
static
final
int
RSLT_FAIL
=
11
;
public
static
final
int
RSLT_LEN
=
RSLT_FAIL
+
1
;
public
static
final
String
[]
LMA_TITLES
=
{
"X-OFFS"
,
"Y-OFFS"
,
"AMPLITUDE"
,
"RADIUS"
,
"RAD_POS"
,
"OVERSHOOT"
,
"OFFSET"
,
"RMSE"
,
"RMSE/A"
,
"MAX2A"
,
"ITERATIONS"
,
"FAILURE"
};
public
static
final
int
FAIL_NONE
=
0
;
public
static
final
int
FAIL_A_LOW
=
1
;
// amplitude is too low
public
static
final
int
FAIL_ACENT
=
2
;
// ratio of maximal pixel to amplitude is too low
public
static
final
int
FAIL_RMSE
=
3
;
// RMSE is too high
public
static
final
int
FAIL_RMSE_R
=
4
;
// BOTH RMSE is not sufficient and RMSE/A is too high
public
static
final
int
FAIL_R0_HIGH
=
5
;
// Full radius (including negative overshoot) is too high
public
static
final
int
FAIL_R1_LOW
=
6
;
// Inner (positive) peak radius is too low
public
static
final
int
FAIL_K_LOW
=
7
;
// Overshoot is too low (not used, it can be down to 0)
public
static
final
int
FAIL_K_HIGH
=
8
;
// Overshoot is too high
public
static
final
int
FAIL_FAR
=
9
;
// Peak is too far from the center
private
int
width
;
private
double
[][]
window
;
...
...
@@ -62,6 +75,7 @@ public class CuasMotionLMA {
private
double
[]
last_ymfx
=
null
;
private
double
[][]
last_jt
=
null
;
private
int
iters
=
-
2
;
// never ran
private
double
max_val
=
0
;
public
CuasMotionLMA
(
int
width
,
...
...
@@ -110,11 +124,14 @@ public class CuasMotionLMA {
double
yc
,
// relative to center =width/2
double
r0
,
double
k
,
double
lmax_val
,
// maximal pixel value near the centroid maximum to be used for comparison with A
int
debugLevel
)
{
max_val
=
lmax_val
;
y_vector
=
tile_data
;
double
x0
=
Math
.
min
(
Math
.
max
(
xc
+
width
/
2
,
0
),
width
-
1
);
double
y0
=
Math
.
min
(
Math
.
max
(
yc
+
width
/
2
,
0
),
width
-
1
);
int
ix0
=
(
int
)
Math
.
round
(
x0
);
int
iy0
=
(
int
)
Math
.
round
(
y0
);
full_vector
[
INDX_A
]
=
tile_data
[
ix0
+
iy0
*
width
];
...
...
@@ -182,9 +199,12 @@ public class CuasMotionLMA {
rslt
[
RSLT_Y
]
=
getCenter
()[
1
];
rslt
[
RSLT_A
]
=
getA
();
rslt
[
RSLT_R0
]
=
getR0
();
rslt
[
RSLT_R1
]
=
getR0
()
/
((
getK
()>
1
)
?
getK
()
:
1.0
);
rslt
[
RSLT_K
]
=
getK
();
rslt
[
RSLT_C
]
=
getC
();
rslt
[
RSLT_RMS
]
=
getRMS
();
rslt
[
RSLT_RMS_A
]
=
getRMS
()/
getA
();
rslt
[
RSLT_MAX2A
]
=
max_val
/
getA
();
// ratio of maximal value to LMA amplitude
rslt
[
RSLT_ITERS
]
=
getIters
();
return
rslt
;
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
b56ba447
...
...
@@ -30,6 +30,7 @@ import java.util.Properties;
import
java.util.StringTokenizer
;
import
com.elphel.imagej.common.GenericJTabbedDialog
;
import
com.elphel.imagej.cuas.CuasMotion
;
import
com.elphel.imagej.orthomosaic.ComboMatch
;
import
com.elphel.imagej.vegetation.VegetationLMA
;
...
...
@@ -659,11 +660,11 @@ min_str_neib_fpn 0.35
public
int
cuas_discard_border
=
8
;
// Discard this number of pixels from each side when merging
public
double
cuas_max_fold
=
50
;
public
int
cuas_min_in_row_col
=
4
;
// Minimal number of defined tiles in a row/column
public
double
cuas_clt_variant
=
10
;
// threshold from the nearest to create a variant for the tile
public
double
cuas_clt_threshold
=
20
;
// threshold for CLT tile difference not merged when selecting the best
public
double
cuas_clt_variant
=
50
;
//
10; // threshold from the nearest to create a variant for the tile
public
double
cuas_clt_threshold
=
70
;
//
20; // threshold for CLT tile difference not merged when selecting the best
public
double
cuas_clt_decrease
=
0.01
;
// Scale CLT outliers weight
public
double
cuas_decay_average
=
10
0.0
;
// Decay in seconds for cimulative CLT
public
double
cuas_keep_fraction
=
0.
9
;
// Filter CLT variants for tiles keeping at least this fraction of the total weight
public
double
cuas_decay_average
=
3
0.0
;
// Decay in seconds for cimulative CLT
public
double
cuas_keep_fraction
=
0.
75
;
// Filter CLT variants for tiles keeping at least this fraction of the total weight
public
boolean
cuas_step
=
true
;
// recalculate template image after each fitting step
public
boolean
cuas_subtract_fpn
=
true
;
// Subtract FPN
...
...
@@ -671,11 +672,11 @@ min_str_neib_fpn 0.35
public
double
cuas_rot_period
=
175.0
;
// rotation period of te gimbal mount (in scenes)
public
double
cuas_min_series
=
180.0
;
// discard shorter series // FIXME: allow shorter, but modify FPN/row_col to copy parent's files if less than cuas_rot_period
public
boolean
cuas_subtract_rowcol
=
true
;
// Subtract row/column noise
public
boolean
cuas_calc_rowcol
=
tru
e
;
// Recalculate+save row/column noise, if false - try to read saved one first
public
double
cuas_um_sigma
=
2
0.0
;
// Apply Unsharp Mask filter sigma when calculating row/column noise
public
double
cuas_max_abs_rowcol
=
10
0.0
;
// consider pixels with abs(UM difference) does not exceed this value
public
boolean
cuas_calc_rowcol
=
fals
e
;
// Recalculate+save row/column noise, if false - try to read saved one first
public
double
cuas_um_sigma
=
1
0.0
;
// Apply Unsharp Mask filter sigma when calculating row/column noise
public
double
cuas_max_abs_rowcol
=
5
0.0
;
// consider pixels with abs(UM difference) does not exceed this value
public
double
cuas_outliers_rowcol
=
0.001
;
// scale weight of the outliers with high difference (to prevent undefined values
public
boolean
cuas_reset_first
=
false
;
// Reset average in first scene (for large diffirence in unfinished row/col)
public
boolean
cuas_reset_first
=
true
;
//
false; // Reset average in first scene (for large diffirence in unfinished row/col)
public
int
cuas_invert_margins
=
0
;
// Expand image each side when inverting tasks
public
int
cuas_invert_iters
=
4
;
// Enhance inversion iterations
public
double
cuas_invert_tolerance
=
0.001
;
// Finish enhancing when last change was lower than
...
...
@@ -700,7 +701,7 @@ min_str_neib_fpn 0.35
public
double
cuas_multi_strength
=
0.45
;
// maximal strength to use multi-tile DSI
public
double
cuas_reliable_str
=
0.8
;
// use for relaible tiles if INTER-INTRA-LMA is available, not just DSI_MAIN
public
double
cuas_fat_zero
=
100
.0
;
// phase correlation fat zero
public
double
cuas_fat_zero
=
25
.0
;
// phase correlation fat zero
public
double
cuas_cent_radius
=
3.0
;
// centroids center radius
public
int
cuas_n_recenter
=
2
;
// when cosine window, re-center window these many times
public
double
cuas_rstr
=
0.01
;
// minimal phase correlation maximums relative to max str
...
...
@@ -724,7 +725,7 @@ min_str_neib_fpn 0.35
public
double
cuas_speed_boost
=
1.0
;
// speed boost limit
// target filtering after constant velocity accumulation
public
double
cuas_lmax_fraction
=
0.
6
;
// Check if local maximum is separated from ty
e surrounding by this fraction of the maximum value
public
double
cuas_lmax_fraction
=
0.
7
;
// Check if local maximum is separated from th
e surrounding by this fraction of the maximum value
public
double
cuas_lmax_radius
=
4.5
;
// look inside ((int)cuas_lmax_radius) * 2 + 1 square for the local maximum isolation
public
boolean
cuas_lmax_zero
=
false
;
// true; // zero all data outside this radius from the maximum
...
...
@@ -734,10 +735,10 @@ min_str_neib_fpn 0.35
public
double
[][]
cuas_target_frac
=
{{
0
,
0.15
},{
2.5
,
0.18
},{
5
,
0.3
}};
public
boolean
cuas_no_border
=
true
;
// exclude targets with centers on the 16x16 tile edges
// CUAS Motion LMA parameters
public
double
cuas_lma_sigma
=
3.0
;
public
double
cuas_lma_sigma
=
2.5
;
public
double
cuas_wnd_pedestal
=
0.1
;
// Add constant to Gaussian weights
public
double
cuas_lma_r0
=
3.0
;
//maximum with with overshoot
public
double
cuas_lma_ovrsht
=
2.0
;
public
double
cuas_lma_ovrsht
=
1.75
;
public
boolean
cuas_lma_fit_xy
=
true
;
public
boolean
cuas_lma_fit_a
=
true
;
...
...
@@ -752,19 +753,28 @@ min_str_neib_fpn 0.35
public
int
cuas_num_iter
=
20
;
// CUAS Motion LMA filter parameters
public
double
cuas_lma_rms
=
1.5
;
// Maximal RMS (should always match, regardless if A)
public
double
cuas_lma_arms
=
0.06
;
// Maximal absolute RMS (should match one of cuas_lma_arms OR cuas_lma_rrms (0.484)
public
double
cuas_lma_rrms
=
0.15
;
// Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
public
double
cuas_lma_mina
=
1.0
;
// Minimal A (amplitude) = 1.0 (< 2.0)
public
double
cuas_lma_rms
=
2.5
;
//
1.5; // Maximal RMS (should always match, regardless if A)
public
double
cuas_lma_arms
=
0.
4
;
// 0.
06; // Maximal absolute RMS (should match one of cuas_lma_arms OR cuas_lma_rrms (0.484)
public
double
cuas_lma_rrms
=
0.
2
;
// 0.
15; // Maximal relative to A rms. OK is when (RMS < cuas_lma_arms) || (RMS < cuas_lma_rrms * A)
public
double
cuas_lma_mina
=
0.7
;
//
1.0; // Minimal A (amplitude) = 1.0 (< 2.0)
public
double
cuas_lma_maxr
=
5.0
;
// Maximal R (radius) =5.0 (> 3.8)
public
double
cuas_lma_minr1
=
1.0
;
// Minimal R1 (radius of positive peak)
public
double
cuas_lma_mink
=
0.0
;
// Minimal K (overshoot) = 0.0 (<0.007)
public
double
cuas_lma_maxk
=
5.0
;
// Maximal K (overshoot) = 5.0 (>3.8)
public
double
cuas_lma_a2a
=
0.7
;
// Minimal ratio of the maximal pixel to the amplitude
public
double
cuas_score_mv
=
0.0
;
// minimal score for the motion vectors
public
double
cuas_score_lma
=
0.0
;
// minimal score for the target LMA
public
double
cuas_factor_lim
=
5.0
;
// limit each individual score factor
public
double
cuas_factor_pow
=
1.0
;
// raise score factor to this power before combining
public
double
[]
cuas_score_coeff
=
{
1.0
,
0.5
,
1.0
};
//weights of amplitude, RMSE and RMSE/amplitude
public
boolean
cuas_isolated
=
true
;
// remove targets that do not have neighbors before/after
public
double
cuas_max_mismatch
=
2.0
;
// maximal position error between consecutive scene sequences
public
boolean
cuas_ignore_mismatch
=
false
;
// calculate mismatch but do not remove
public
boolean
cuas_by_horizon
=
true
;
// remove targets that are below horizon
public
double
cuas_horizon
=
390.0
;
// maximal Y - position of the sky
public
double
cuas_mask_width
=
9
;
public
double
cuas_mask_blur
=
3
;
...
...
@@ -790,7 +800,7 @@ min_str_neib_fpn 0.35
public
boolean
cuas_annotate
=
true
;
// save color rendered images (same as videos)
public
Color
cuas_text_color
=
new
Color
(
0
,
255
,
255
);
// 220);
public
String
cuas_font_name
=
"Monospaced"
;
public
int
cuas_font_size
=
6
;
// before scaling
public
int
cuas_font_size
=
7
;
// before scaling
public
int
cuas_font_type
=
1
;
// 0 - PLAIN, 1 - BOLD, 2 - ITALIC
// AZ/EL calibration
public
double
cuas_ifov
=
0.05
;
// degree per pixel
...
...
@@ -801,8 +811,8 @@ min_str_neib_fpn 0.35
public
boolean
cuas_debug
=
fals
e
;
// save debug images (and show them if not in batch mode)
public
boolean
cuas_step_debug
=
fals
e
;
// save debug images during per-step cuas recalculation (and show them if not in batch mode)
public
boolean
cuas_debug
=
tru
e
;
// save debug images (and show them if not in batch mode)
public
boolean
cuas_step_debug
=
tru
e
;
// save debug images during per-step cuas recalculation (and show them if not in batch mode)
public
boolean
cuas_target_debug
=
false
;
// save debug images during per-step cuas recalculation (and show them if not in batch mode)
public
boolean
cuas_overwrite
=
false
;
// overwrite num_orient and num_accum
public
int
cuas_num_orient
=
2
;
// initial value for num_orient
...
...
@@ -2315,10 +2325,32 @@ min_str_neib_fpn 0.35
"Filter out weak targets."
);
gd
.
addNumericField
(
"Maximal radius"
,
this
.
cuas_lma_maxr
,
5
,
8
,
"pix"
,
"Maximal target radius including negative overshoot."
);
gd
.
addNumericField
(
"Mimimal inner radius"
,
this
.
cuas_lma_minr1
,
5
,
8
,
"pix"
,
"Minimal radius of positive peak."
);
gd
.
addNumericField
(
"Minimal overshoot ratio"
,
this
.
cuas_lma_mink
,
5
,
8
,
""
,
"Minimal ratio of the overshoot radius to the first 0 radius (typical 1.0)."
);
gd
.
addNumericField
(
"Maximal overshoot ratio"
,
this
.
cuas_lma_maxk
,
5
,
8
,
""
,
"Maximal ratio of the overshoot radius to the first 0 radius (typical 3.0)."
);
gd
.
addNumericField
(
"Minimal max pixel to amplitude ratio"
,
this
.
cuas_lma_a2a
,
5
,
8
,
""
,
"Minimal ratio of the maximal pixel near fitted maximum to the LMA amplitude."
);
gd
.
addMessage
(
"=== Handling overall target scores ==="
);
gd
.
addNumericField
(
"Minimal MV score"
,
this
.
cuas_score_mv
,
5
,
8
,
""
,
"Remove potential motion tiles that have lower scores."
);
gd
.
addNumericField
(
"Minimal target LMA score"
,
this
.
cuas_score_lma
,
5
,
8
,
""
,
"Remove potential target LMA tiles that have lower scores."
);
gd
.
addNumericField
(
"Limit each individual score factor"
,
this
.
cuas_factor_lim
,
5
,
8
,
""
,
"Limit each contributing score factor by this value."
);
gd
.
addNumericField
(
"Raise score factor to this power"
,
this
.
cuas_factor_pow
,
5
,
8
,
""
,
"Raise each score factor to this power before combining them."
);
gd
.
addStringField
(
"Score factors weights"
,
IntersceneMatchParameters
.
doublesToString
(
cuas_score_coeff
),
80
,
"Relative importance of LMA amplitude, RMSE and RMSE/ampitude."
);
gd
.
addMessage
(
"=== Post-processing targets filtering ==="
);
gd
.
addCheckbox
(
"Remove single-frame targets"
,
this
.
cuas_isolated
,
"Remove targets that do not have neighbors before/afte."
);
...
...
@@ -2327,6 +2359,11 @@ min_str_neib_fpn 0.35
gd
.
addCheckbox
(
"Ignore mismatch"
,
this
.
cuas_ignore_mismatch
,
"Calculate mismatch, but keep targets for debugging (see cuas_target_debug)."
);
gd
.
addCheckbox
(
"Filter by horizon"
,
this
.
cuas_by_horizon
,
"Remove targets that are below the horizon."
);
gd
.
addNumericField
(
"Pixel Y of the horizon"
,
this
.
cuas_horizon
,
5
,
8
,
"pix"
,
"Pixel Y of the horizon."
);
gd
.
addMessage
(
"=== Targets video generation (see also Vidoe/Stereo tab) ==="
);
...
...
@@ -3398,13 +3435,24 @@ min_str_neib_fpn 0.35
this
.
cuas_lma_rrms
=
gd
.
getNextNumber
();
this
.
cuas_lma_mina
=
gd
.
getNextNumber
();
this
.
cuas_lma_maxr
=
gd
.
getNextNumber
();
this
.
cuas_lma_minr1
=
gd
.
getNextNumber
();
this
.
cuas_lma_mink
=
gd
.
getNextNumber
();
this
.
cuas_lma_maxk
=
gd
.
getNextNumber
();
this
.
cuas_lma_a2a
=
gd
.
getNextNumber
();
this
.
cuas_score_mv
=
gd
.
getNextNumber
();
this
.
cuas_score_lma
=
gd
.
getNextNumber
();
this
.
cuas_factor_lim
=
gd
.
getNextNumber
();
this
.
cuas_factor_pow
=
gd
.
getNextNumber
();
this
.
cuas_score_coeff
=
IntersceneMatchParameters
.
StringToDoubles
(
gd
.
getNextString
(),
CuasMotion
.
IMPORTANCE_LENGTH
);
this
.
cuas_isolated
=
gd
.
getNextBoolean
();
this
.
cuas_max_mismatch
=
gd
.
getNextNumber
();
this
.
cuas_ignore_mismatch
=
gd
.
getNextBoolean
();
this
.
cuas_by_horizon
=
gd
.
getNextBoolean
();
this
.
cuas_horizon
=
gd
.
getNextNumber
();
this
.
cuas_mask_width
=
gd
.
getNextNumber
();
this
.
cuas_mask_blur
=
gd
.
getNextNumber
();
this
.
cuas_mask_round
=
gd
.
getNextBoolean
();
...
...
@@ -4371,12 +4419,23 @@ min_str_neib_fpn 0.35
properties
.
setProperty
(
prefix
+
"cuas_lma_rrms"
,
this
.
cuas_lma_rrms
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_lma_mina"
,
this
.
cuas_lma_mina
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_lma_maxr"
,
this
.
cuas_lma_maxr
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_lma_minr1"
,
this
.
cuas_lma_minr1
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_lma_mink"
,
this
.
cuas_lma_mink
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_lma_maxk"
,
this
.
cuas_lma_maxk
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_lma_a2a"
,
this
.
cuas_lma_a2a
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_score_mv"
,
this
.
cuas_score_mv
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_score_lma"
,
this
.
cuas_score_lma
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_factor_lim"
,
this
.
cuas_factor_lim
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_factor_pow"
,
this
.
cuas_factor_pow
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_score_coeff"
,
IntersceneMatchParameters
.
doublesToString
(
this
.
cuas_score_coeff
));
properties
.
setProperty
(
prefix
+
"cuas_isolated"
,
this
.
cuas_isolated
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"cuas_max_mismatch"
,
this
.
cuas_max_mismatch
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_ignore_mismatch"
,
this
.
cuas_ignore_mismatch
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"cuas_by_horizon"
,
this
.
cuas_by_horizon
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"cuas_horizon"
,
this
.
cuas_horizon
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_mask_width"
,
this
.
cuas_mask_width
+
""
);
// double
properties
.
setProperty
(
prefix
+
"cuas_mask_blur"
,
this
.
cuas_mask_blur
+
""
);
// double
...
...
@@ -5312,13 +5371,24 @@ min_str_neib_fpn 0.35
if
(
properties
.
getProperty
(
prefix
+
"cuas_lma_rrms"
)!=
null
)
this
.
cuas_lma_rrms
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_lma_rrms"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_lma_mina"
)!=
null
)
this
.
cuas_lma_mina
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_lma_mina"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_lma_maxr"
)!=
null
)
this
.
cuas_lma_maxr
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_lma_maxr"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_lma_minr1"
)!=
null
)
this
.
cuas_lma_minr1
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_lma_minr1"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_lma_mink"
)!=
null
)
this
.
cuas_lma_mink
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_lma_mink"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_lma_maxk"
)!=
null
)
this
.
cuas_lma_maxk
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_lma_maxk"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_lma_a2a"
)!=
null
)
this
.
cuas_lma_a2a
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_lma_a2a"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_score_mv"
)!=
null
)
this
.
cuas_score_mv
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_score_mv"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_score_lma"
)!=
null
)
this
.
cuas_score_lma
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_score_lma"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_factor_lim"
)!=
null
)
this
.
cuas_factor_lim
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_factor_lim"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_factor_pow"
)!=
null
)
this
.
cuas_factor_pow
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_factor_pow"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_score_coeff"
)!=
null
)
this
.
cuas_score_coeff
=
IntersceneMatchParameters
.
StringToDoubles
(
properties
.
getProperty
(
prefix
+
"cuas_score_coeff"
),
3
);
if
(
properties
.
getProperty
(
prefix
+
"cuas_isolated"
)!=
null
)
this
.
cuas_isolated
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"cuas_isolated"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_max_mismatch"
)!=
null
)
this
.
cuas_max_mismatch
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_max_mismatch"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_ignore_mismatch"
)!=
null
)
this
.
cuas_ignore_mismatch
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"cuas_ignore_mismatch"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_by_horizon"
)!=
null
)
this
.
cuas_by_horizon
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"cuas_by_horizon"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_horizon"
)!=
null
)
this
.
cuas_horizon
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_horizon"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_mask_width"
)!=
null
)
this
.
cuas_mask_width
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_mask_width"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_mask_blur"
)!=
null
)
this
.
cuas_mask_blur
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"cuas_mask_blur"
));
if
(
properties
.
getProperty
(
prefix
+
"cuas_mask_round"
)!=
null
)
this
.
cuas_mask_round
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"cuas_mask_round"
));
...
...
@@ -6253,12 +6323,22 @@ min_str_neib_fpn 0.35
imp
.
cuas_lma_rrms
=
this
.
cuas_lma_rrms
;
imp
.
cuas_lma_mina
=
this
.
cuas_lma_mina
;
imp
.
cuas_lma_maxr
=
this
.
cuas_lma_maxr
;
imp
.
cuas_lma_minr1
=
this
.
cuas_lma_minr1
;
imp
.
cuas_lma_mink
=
this
.
cuas_lma_mink
;
imp
.
cuas_lma_maxk
=
this
.
cuas_lma_maxk
;
imp
.
cuas_lma_a2a
=
this
.
cuas_lma_a2a
;
imp
.
cuas_score_mv
=
this
.
cuas_score_mv
;
imp
.
cuas_score_lma
=
this
.
cuas_score_lma
;
imp
.
cuas_factor_lim
=
this
.
cuas_factor_lim
;
imp
.
cuas_factor_pow
=
this
.
cuas_factor_pow
;
imp
.
cuas_score_coeff
=
this
.
cuas_score_coeff
.
clone
();
imp
.
cuas_isolated
=
this
.
cuas_isolated
;
imp
.
cuas_max_mismatch
=
this
.
cuas_max_mismatch
;
imp
.
cuas_ignore_mismatch
=
this
.
cuas_ignore_mismatch
;
imp
.
cuas_by_horizon
=
this
.
cuas_by_horizon
;
imp
.
cuas_horizon
=
this
.
cuas_horizon
;
imp
.
cuas_mask_width
=
this
.
cuas_mask_width
;
imp
.
cuas_mask_blur
=
this
.
cuas_mask_blur
;
...
...
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