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
aec8ae98
Commit
aec8ae98
authored
Sep 15, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added neibs_nofpn_init - separate averaging control for initial pose
calculation
parent
bd27e7b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
11 deletions
+42
-11
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+19
-3
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+20
-7
QuadCLTCPU.java
...main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
+3
-1
No files found.
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
aec8ae98
...
...
@@ -228,7 +228,8 @@ public class IntersceneMatchParameters {
// averaging with neighbors for interscene matching
public
boolean
use_neibs
=
true
;
// false; // true;
public
boolean
neibs_nofpn_only
=
false
;
// consolidate neighbors fot non-fpn tiles only!
public
boolean
neibs_nofpn_only
=
false
;
// consolidate neighbors for non-fpn tiles only!
public
boolean
neibs_nofpn_init
=
true
;
// Non-fpn only for initial adjustment
public
boolean
redo_both
=
true
;
// use average of neighbors for both pd,td if any of the center tile tests (td, pd) fails
public
int
min_num_neibs
=
4
;
// plus center, total number >= (min_num_neibs+1)
public
double
scale_neibs_pd
=
0.5
;
// scale threshold for the pixel-domain average maximums
...
...
@@ -247,6 +248,7 @@ public class IntersceneMatchParameters {
public
double
half_avg_diff
=
0.2
;
// when L2 of x,y difference from average of neibs - reduce twice
// Detect initial match
public
boolean
use_combo_relaible
=
true
;
// use combo dsi if available for relaib;le tiles
public
double
min_ref_str
=
0.33
;
// 0.22; // For orientations: use only tiles of the reference scene DSI_MAIN is stronger
public
double
min_ref_frac
=
0.2
;
// 0.22; if fraction number of reliable tiles is less than this, use best possible
public
int
pix_step
=
4
;
// Azimuth/tilt search step in pixels
...
...
@@ -753,8 +755,10 @@ public class IntersceneMatchParameters {
gd
.
addCheckbox
(
"Use averaging neighbors"
,
this
.
use_neibs
,
"Average tile 2D correlation with 8 immediate neighbors if single-tile correlation is not strong enough."
);
// TODO: Consider/Implement pure TD averaging
gd
.
addCheckbox
(
"No-FPN averaging only"
,
this
.
neibs_nofpn_only
,
"Use averaging with neighbors only if tile offset is large enough not to have FPN interference."
);
gd
.
addCheckbox
(
"No-FPN averaging only (all passes)"
,
this
.
neibs_nofpn_only
,
"Use averaging with neighbors only if tile offset is large enough not to have FPN interference (for all passes)."
);
gd
.
addCheckbox
(
"No-FPN averaging only during init"
,
this
.
neibs_nofpn_init
,
"Additionally disable FPN-prone tiles during initial scene pose adjustment."
);
gd
.
addCheckbox
(
"Use averaging for both PD and TD"
,
this
.
redo_both
,
"Recalculate tile average for both TD and PD if at least one of them is not strong enough."
);
gd
.
addNumericField
(
"Minimal neighbors to average"
,
this
.
min_num_neibs
,
0
,
3
,
""
,
...
...
@@ -786,6 +790,10 @@ public class IntersceneMatchParameters {
"Reduce twice for high difference from neighbors average."
);
gd
.
addMessage
(
"Initial search for the inter-scene match"
);
gd
.
addCheckbox
(
"Use combo DSI (if available) for reliable"
,
this
.
use_combo_relaible
,
"Use interscene DSI if available (instead of the single-scene) for selecting reliable tiles"
);
gd
.
addNumericField
(
"DSI_MAIN minimal strength"
,
this
.
min_ref_str
,
5
,
7
,
""
,
"Match only tiles where DSI_MAIN is stronger than that (and has LMA)."
);
gd
.
addNumericField
(
"DSI_MAIN minimal fraction"
,
this
.
min_ref_frac
,
5
,
7
,
""
,
...
...
@@ -1196,6 +1204,7 @@ public class IntersceneMatchParameters {
this
.
use_neibs
=
gd
.
getNextBoolean
();
this
.
neibs_nofpn_only
=
gd
.
getNextBoolean
();
this
.
neibs_nofpn_init
=
gd
.
getNextBoolean
();
this
.
redo_both
=
gd
.
getNextBoolean
();
this
.
min_num_neibs
=
(
int
)
gd
.
getNextNumber
();
this
.
scale_neibs_pd
=
gd
.
getNextNumber
();
...
...
@@ -1210,6 +1219,7 @@ public class IntersceneMatchParameters {
this
.
weight_zero_neibs
=
gd
.
getNextNumber
();
this
.
half_disparity
=
gd
.
getNextNumber
();
this
.
half_avg_diff
=
gd
.
getNextNumber
();
this
.
use_combo_relaible
=
gd
.
getNextBoolean
();
this
.
min_ref_str
=
gd
.
getNextNumber
();
this
.
min_ref_frac
=
gd
.
getNextNumber
();
this
.
pix_step
=
(
int
)
gd
.
getNextNumber
();
...
...
@@ -1544,6 +1554,7 @@ public class IntersceneMatchParameters {
properties
.
setProperty
(
prefix
+
"use_neibs"
,
this
.
use_neibs
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"neibs_nofpn_only"
,
this
.
neibs_nofpn_only
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"neibs_nofpn_init"
,
this
.
neibs_nofpn_init
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"redo_both"
,
this
.
redo_both
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"min_num_neibs"
,
this
.
min_num_neibs
+
""
);
// int
properties
.
setProperty
(
prefix
+
"scale_neibs_pd"
,
this
.
scale_neibs_pd
+
""
);
// double
...
...
@@ -1558,6 +1569,7 @@ public class IntersceneMatchParameters {
properties
.
setProperty
(
prefix
+
"weight_zero_neibs"
,
this
.
weight_zero_neibs
+
""
);
// double
properties
.
setProperty
(
prefix
+
"half_disparity"
,
this
.
half_disparity
+
""
);
// double
properties
.
setProperty
(
prefix
+
"half_avg_diff"
,
this
.
half_avg_diff
+
""
);
// double
properties
.
setProperty
(
prefix
+
"use_combo_relaible"
,
this
.
use_combo_relaible
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"pix_step"
,
this
.
pix_step
+
""
);
// int
properties
.
setProperty
(
prefix
+
"search_rad"
,
this
.
search_rad
+
""
);
// int
properties
.
setProperty
(
prefix
+
"maybe_sum"
,
this
.
maybe_sum
+
""
);
// double
...
...
@@ -1847,6 +1859,7 @@ public class IntersceneMatchParameters {
if
(
properties
.
getProperty
(
prefix
+
"use_neibs"
)!=
null
)
this
.
use_neibs
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"use_neibs"
));
if
(
properties
.
getProperty
(
prefix
+
"neibs_nofpn_only"
)!=
null
)
this
.
neibs_nofpn_only
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"neibs_nofpn_only"
));
if
(
properties
.
getProperty
(
prefix
+
"neibs_nofpn_init"
)!=
null
)
this
.
neibs_nofpn_init
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"neibs_nofpn_init"
));
if
(
properties
.
getProperty
(
prefix
+
"redo_both"
)!=
null
)
this
.
redo_both
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"redo_both"
));
if
(
properties
.
getProperty
(
prefix
+
"min_num_neibs"
)!=
null
)
this
.
min_num_neibs
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"min_num_neibs"
));
if
(
properties
.
getProperty
(
prefix
+
"scale_neibs_pd"
)!=
null
)
this
.
scale_neibs_pd
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"scale_neibs_pd"
));
...
...
@@ -1861,6 +1874,7 @@ public class IntersceneMatchParameters {
if
(
properties
.
getProperty
(
prefix
+
"weight_zero_neibs"
)!=
null
)
this
.
weight_zero_neibs
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"weight_zero_neibs"
));
if
(
properties
.
getProperty
(
prefix
+
"half_disparity"
)!=
null
)
this
.
half_disparity
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"half_disparity"
));
if
(
properties
.
getProperty
(
prefix
+
"half_avg_diff"
)!=
null
)
this
.
half_avg_diff
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"half_avg_diff"
));
if
(
properties
.
getProperty
(
prefix
+
"use_combo_relaible"
)!=
null
)
this
.
use_combo_relaible
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"use_combo_relaible"
));
if
(
properties
.
getProperty
(
prefix
+
"pix_step"
)!=
null
)
this
.
pix_step
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"pix_step"
));
if
(
properties
.
getProperty
(
prefix
+
"search_rad"
)!=
null
)
this
.
search_rad
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"search_rad"
));
if
(
properties
.
getProperty
(
prefix
+
"maybe_sum"
)!=
null
)
this
.
maybe_sum
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"maybe_sum"
));
...
...
@@ -2161,6 +2175,7 @@ public class IntersceneMatchParameters {
imp
.
use_neibs
=
this
.
use_neibs
;
imp
.
neibs_nofpn_only
=
this
.
neibs_nofpn_only
;
imp
.
neibs_nofpn_init
=
this
.
neibs_nofpn_init
;
imp
.
redo_both
=
this
.
redo_both
;
imp
.
min_num_neibs
=
this
.
min_num_neibs
;
imp
.
scale_neibs_pd
=
this
.
scale_neibs_pd
;
...
...
@@ -2175,6 +2190,7 @@ public class IntersceneMatchParameters {
imp
.
weight_zero_neibs
=
this
.
weight_zero_neibs
;
imp
.
half_disparity
=
this
.
half_disparity
;
imp
.
half_avg_diff
=
this
.
half_avg_diff
;
imp
.
use_combo_relaible
=
this
.
use_combo_relaible
;
imp
.
pix_step
=
this
.
pix_step
;
imp
.
search_rad
=
this
.
search_rad
;
imp
.
maybe_sum
=
this
.
maybe_sum
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
aec8ae98
...
...
@@ -4574,6 +4574,7 @@ public class OpticalFlow {
double
[]
reduced_strength
=
new
double
[
1
];
if
(
min_ref_str
>
0.0
)
{
reliable_ref
=
quadCLTs
[
ref_index
].
getReliableTiles
(
// will be null if does not exist.
false
,
// boolean use_combo,
min_ref_str
,
// double min_strength,
min_ref_frac
,
// double min_ref_frac,
true
,
// boolean needs_lma);
...
...
@@ -4996,6 +4997,7 @@ public class OpticalFlow {
int
test_ers0
=
clt_parameters
.
imp
.
test_ers0
;
// try adjusting a pair of scenes with ERS. Reference scene index
int
test_ers1
=
clt_parameters
.
imp
.
test_ers1
;
// try adjusting a pair of scenes with ERS. Other scene index
test_ers
&=
(
test_ers0
>=
0
)
&&
(
test_ers1
>=
0
);
boolean
use_combo_relaible
=
clt_parameters
.
imp
.
use_combo_relaible
;
double
min_ref_str
=
clt_parameters
.
imp
.
min_ref_str
;
double
min_ref_frac
=
clt_parameters
.
imp
.
min_ref_frac
;
double
[]
ref_blue_sky
=
null
;
// turn off "lma" in the ML output
...
...
@@ -5235,10 +5237,11 @@ public class OpticalFlow {
boolean
[]
reliable_ref
=
null
;
if
(
min_ref_str
>
0.0
)
{
reliable_ref
=
quadCLTs
[
ref_index
].
getReliableTiles
(
// will be null if does not exist.
min_ref_str
,
// double min_strength,
min_ref_frac
,
// double min_ref_frac,
true
,
// boolean needs_lma);
reduced_strength
);
// if not null will return >0 if had to reduce strength (no change if did not reduce)
use_combo_relaible
,
// boolean use_combo,
min_ref_str
,
// double min_strength,
min_ref_frac
,
// double min_ref_frac,
true
,
// boolean needs_lma);
reduced_strength
);
// if not null will return >0 if had to reduce strength (no change if did not reduce)
}
// if (reduced_strength[0] > 0) {
// use_lma_dsi = false; // too few points
...
...
@@ -7244,6 +7247,7 @@ public class OpticalFlow {
null
,
// final float [][][] dbg_corr_fpn,
false
,
// boolean near_important, // do not reduce weight of the near tiles
treat_serch_fpn
,
// true, // boolean all_fpn, // do not lower thresholds for non-fpn (used during search)
true
,
// boolean initial_adjust,
null
,
// double [][] mb_vectors, // now [2][ntiles];
clt_parameters
.
imp
.
debug_level
,
// int imp_debug_level,
clt_parameters
.
imp
.
debug_level
);
// 1); // -1); // int debug_level);
...
...
@@ -12714,6 +12718,7 @@ public class OpticalFlow {
final
float
[][]
dbg_corr_fpn
,
boolean
near_important
,
// do not reduce weight of the near tiles
boolean
all_fpn
,
// do not lower thresholds for non-fpn (used during search)
boolean
initial_adjust
,
// motion blur compensation
double
[][]
mb_vectors
,
// now [2][ntiles];
int
imp_debug_level
,
// MANUALLY change to 2 for debug!
...
...
@@ -13144,7 +13149,9 @@ public class OpticalFlow {
}
boolean
use_neibs
=
clt_parameters
.
imp
.
use_neibs
;
// false; // true;
boolean
neibs_nofpn_only
=
clt_parameters
.
imp
.
neibs_nofpn_only
;
// consolidate neighbors fot non-fpn tiles only!
boolean
neibs_nofpn_only
=
clt_parameters
.
imp
.
neibs_nofpn_only
|
(
initial_adjust
&&
clt_parameters
.
imp
.
neibs_nofpn_init
);
// consolidate neighbors fot non-fpn tiles only!
boolean
redo_both
=
clt_parameters
.
imp
.
redo_both
;
// use average of neighbors for both pd,td if any of the center tile tests (td, pd) fails
int
min_num_neibs
=
clt_parameters
.
imp
.
min_num_neibs
;
// plus center, total number >= (min_num_neibs+1)
double
scale_neibs_pd
=
use_neibs
?
clt_parameters
.
imp
.
scale_neibs_pd
:
0
;
// scale threshold for the pixel-domain average maximums
...
...
@@ -14655,7 +14662,8 @@ public class OpticalFlow {
}
double
[]
lma_rms
=
new
double
[
2
];
scenes_xyzatr
[
nscene
]
=
adjustPairsLMAInterscene
(
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
false
,
// boolean initial_adjust,
fpn_disable
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
min_max
,
// double [] min_max, // null or pair of minimal and maximal offsets
fail_reason
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
...
...
@@ -15053,7 +15061,8 @@ public class OpticalFlow {
debug_level
);
// int debug_level)
return
adjustPairsLMAInterscene
(
// assumes reference GPU data is already set - once for multiple scenes
clt_parameters
,
// CLTParameters clt_parameters,
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
true
,
// boolean initial_adjust,
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
min_max
,
// double [] min_max, // null or pair of minimal and maximal offsets
fail_reason
,
// int [] fail_reason, // null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
reference_QuadClt
,
// QuadCLT reference_QuadClt,
...
...
@@ -15080,6 +15089,7 @@ public class OpticalFlow {
public
static
double
[][]
adjustPairsLMAInterscene
(
// assumes reference scene already set in GPU.
CLTParameters
clt_parameters
,
boolean
initial_adjust
,
boolean
fpn_disable
,
// disable fpn filter if images are known to be too close
double
[]
min_max
,
// null or pair of minimal and maximal offsets
int
[]
fail_reason
,
// null or int[1]: 0 - OK, 1 - LMA, 2 - min, 3 - max
...
...
@@ -15150,6 +15160,7 @@ public class OpticalFlow {
null
,
// final float [][] dbg_corr_fpn,
near_important
,
// boolean near_important, // do not reduce weight of the near tiles
false
,
// boolean all_fpn, // do not lower thresholds for non-fpn (used during search)
initial_adjust
,
// boolean initial_adjust,
mb_vectors
,
// double [][] mb_vectors, // now [2][ntiles];
clt_parameters
.
imp
.
debug_level
,
// int imp_debug_level,
debug_level
);
// 1); // -1); // int debug_level);
...
...
@@ -15270,6 +15281,7 @@ public class OpticalFlow {
dbg_corr_fpn
,
// final float [][] dbg_corr_fpn,
true
,
// boolean near_important, // do not reduce weight of the near tiles
false
,
// boolean all_fpn, // do not lower thresholds for non-fpn (used during search)
initial_adjust
,
// boolean initial_adjust,
mb_vectors
,
// double [][] mb_vectors, // now [2][ntiles];
2
,
// int imp_debug_level,
debug_level
);
// 1); // -1); // int debug_level);
...
...
@@ -15320,6 +15332,7 @@ public class OpticalFlow {
dbg_corr_fpn
,
// final float [][] dbg_corr_fpn,
true
,
// boolean near_important, // do not reduce weight of the near tiles
false
,
// boolean all_fpn, // do not lower thresholds for non-fpn (used during search)
initial_adjust
,
// boolean initial_adjust,
mb_vectors
,
// double [][] mb_vectors, // now [2][ntiles];
2
,
// int imp_debug_level,
debug_level
);
// 1); // -1); // int debug_level);
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuadCLTCPU.java
View file @
aec8ae98
...
...
@@ -1594,13 +1594,15 @@ public class QuadCLTCPU {
}
//min_ref_frac
public
boolean
[]
getReliableTiles
(
boolean
use_combo
,
double
min_strength
,
double
min_ref_frac
,
boolean
needs_lma
,
double
[]
reduced_strength
// if not null will return >0 if had to reduce strength (no change if did not reduce)
)
{
int
NUM_BINS
=
1024
;
double
[][]
main_dsi
=
readDsiMain
();
boolean
silent
=
false
;
double
[][]
main_dsi
=
use_combo
?
readComboDSI
(
silent
):
readDsiMain
();
if
(
main_dsi
==
null
)
{
return
null
;
}
...
...
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