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
2cb7df5a
Commit
2cb7df5a
authored
Jan 06, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Debugging, next snapshot
parent
df05481d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
254 additions
and
51 deletions
+254
-51
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+8
-4
Interscene.java
...main/java/com/elphel/imagej/tileprocessor/Interscene.java
+97
-20
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+109
-9
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+25
-11
QuaternionLma.java
...n/java/com/elphel/imagej/tileprocessor/QuaternionLma.java
+15
-7
No files found.
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
2cb7df5a
...
...
@@ -220,18 +220,22 @@ public class ErsCorrection extends GeometryCorrection {
private
double
[][]
ers_atr_dt
;
// angular velocities per scan line. It is now actually 2*omega!
public
static
boolean
[]
getParamSelect
(
boolean
use_Z
,
boolean
use_R
,
boolean
use_XY
,
boolean
use_AT
,
boolean
use_ERS
,
boolean
use_ERS_tilt
)
{
boolean
use_ERS_tilt
,
boolean
use_ERS_roll
)
{
boolean
[]
param_select
=
new
boolean
[
DP_NUM_PARS
];
boolean
use_ERS_roll
=
use_ERS
&&
use_ERS_tilt
;
for
(
int
i:
DP_ZR_INDICES
)
param_select
[
i
]
=
true
;
// for (int i:DP_ZR_INDICES) param_select[i] = true;
if
(
use_Z
||
use_XY
)
param_select
[
DP_DSZ
]
=
true
;
if
(
use_R
||
use_AT
)
param_select
[
DP_DSRL
]
=
true
;
if
(
use_XY
)
for
(
int
i:
DP_XY_INDICES
)
param_select
[
i
]
=
true
;
if
(
use_AT
)
for
(
int
i:
DP_AT_INDICES
)
param_select
[
i
]
=
true
;
if
(
use_ERS
)
param_select
[
DP_DSVAZ
]
=
true
;
if
(
use_ERS
&&
use_ERS_tilt
)
param_select
[
DP_DSVTL
]
=
true
;
if
(
use_ERS
_roll
)
param_select
[
DP_DSVRL
]
=
true
;
if
(
use_ERS
&&
use_ERS_roll
)
param_select
[
DP_DSVRL
]
=
true
;
return
param_select
;
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/Interscene.java
View file @
2cb7df5a
...
...
@@ -322,7 +322,30 @@ public class Interscene {
start_ref_pointers
[
0
]
=
start_ref_pointers1
[
0
];
return
earliest_scene2
;
// cent_index;
}
if
(
generate_egomotion
)
{
String
ego_path
=
quadCLTs
[
cent_index
].
getX3dDirectory
()+
Prefs
.
getFileSeparator
()+
quadCLTs
[
ref_index
].
getImageName
()+
"-ego-preinvert-"
+
quadCLTs
[
cent_index
].
getNumOrient
()+
".csv"
;
String
ego_comment
=
null
;
Interscene
.
generateEgomotionTable
(
clt_parameters
,
// CLTParameters clt_parameters,
quadCLTs
,
// QuadCLT [] quadCLTs,
cent_index
,
// ref_indx,
earliest_scene
,
// int earliest_scene,
ego_path
,
// String path,
ego_comment
);
// String comment);
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"Egomotion table saved to "
+
ego_path
);
}
}
// invert first half, reference to the cent_index, add to cent_index map, generate ref_index ponter and cent_index,
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"pre invertInitialOrientation(): ref_index "
+
ref_index
+
", cent_index="
+
cent_index
+
", last_index="
+
". readjust="
+
readjust
+
"\n"
);
}
invertInitialOrientation
(
clt_parameters
,
// final CLTParameters clt_parameters,
...
...
@@ -335,6 +358,24 @@ public class Interscene {
ref_index
,
// final int ref_old, // original ref_index (normally == last_index)
earliest_scene2
,
//final int earliest_index// first to process
debugLevel
);
// final int debugLevel
if
(
generate_egomotion
)
{
String
ego_path
=
quadCLTs
[
cent_index
].
getX3dDirectory
()+
Prefs
.
getFileSeparator
()+
quadCLTs
[
ref_index
].
getImageName
()+
"-ego-afterinvert-"
+
quadCLTs
[
cent_index
].
getNumOrient
()+
".csv"
;
String
ego_comment
=
null
;
Interscene
.
generateEgomotionTable
(
clt_parameters
,
// CLTParameters clt_parameters,
quadCLTs
,
// QuadCLT [] quadCLTs,
cent_index
,
// ref_indx,
earliest_scene
,
// int earliest_scene,
ego_path
,
// String path,
ego_comment
);
// String comment);
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"Egomotion table saved to "
+
ego_path
);
}
}
String
cent_ts
=
quadCLTs
[
cent_index
].
getImageName
();
// write config for both ref_index and cent_index scenes
// ErsCorrection ers_reference = quadCLTs[ref_index].getErsCorrection();
...
...
@@ -425,12 +466,18 @@ public class Interscene {
}
return
0
;
}
else
{
// if (readjust) {
boolean
lma_use_Z
=
clt_parameters
.
imp
.
lma_use_Z
;
// true; // lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
boolean
lma_use_R
=
clt_parameters
.
imp
.
lma_use_R
;
// true; // lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
boolean
[]
param_select
=
ErsCorrection
.
getParamSelect
(
// ZR - always
lma_use_Z
,
// boolean use_Z,
lma_use_R
,
// boolean use_R,
true
,
// boolean use_XY
false
,
// boolean use_AT,
false
,
// boolean use_ERS);//clt_parameters.ilp.ilma_lma_select;
false
);
// boolean use_ERS_tilt);
false
,
// boolean use_ERS_tilt);
false
);
// boolean use_ERS_roll);
double
maximal_series_rms
=
0.0
;
double
[][][]
scenes_xyzatr
=
new
double
[
last_index
+
1
][][];
double
[][][]
dxyzatr_dt
=
new
double
[
last_index
+
1
][][];
...
...
@@ -761,12 +808,20 @@ public class Interscene {
double
max_zoom_diff
=
clt_parameters
.
imp
.
max_zoom_diff
;
boolean
fpn_skip
=
clt_parameters
.
imp
.
fpn_skip
;
// if false - fail as before
boolean
fpn_rematch
=
clt_parameters
.
imp
.
fpn_rematch
;
// if false - keep previous
boolean
lma_use_Z
=
clt_parameters
.
imp
.
lma_use_Z
;
// true; // lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
boolean
lma_use_R
=
clt_parameters
.
imp
.
lma_use_R
;
// true; // lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"setInitialOrientationsIms(): lma_use_Z="
+
lma_use_Z
+
", lma_use_R="
+
lma_use_R
);
}
boolean
[]
param_select
=
ErsCorrection
.
getParamSelect
(
// ZR - always
true
,
// boolean use_XY
false
,
// boolean use_AT,
lma_use_Z
,
// boolean use_Z,
lma_use_R
,
// boolean use_R,
true
,
// boolean use_XY, May change with oorient preference
false
,
// boolean use_AT, May change with oorient preference
false
,
// boolean use_ERS);//clt_parameters.ilp.ilma_lma_select;
false
);
// boolean use_ERS_tilt);
false
,
// boolean use_ERS_tilt);
false
);
// boolean use_ERS_roll);
int
[]
fail_reason
=
new
int
[
1
];
// null or int[1]: 0 - OK, 2 - LMA, 3 - min, 4 - max
for
(
int
scene_index
=
ref_index
-
1
;
scene_index
>=
0
;
scene_index
--)
{
...
...
@@ -1815,8 +1870,12 @@ public class Interscene {
public
static
int
reAdjustPairsLMAInterscene
(
// after combo dgi is available and preliminary poses are known
CLTParameters
clt_parameters
,
double
mb_max_gain
,
boolean
use_Z
,
boolean
use_R
,
boolean
disable_ers
,
boolean
disable_ers_y
,
boolean
disable_ers_r
,
boolean
lma_xyzatr
,
boolean
configured_lma
,
boolean
lpf_xy
,
// lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
double
avg_rlen
,
...
...
@@ -1833,16 +1892,20 @@ public class Interscene {
int
debugLevel
)
{
System
.
out
.
println
(
"reAdjustPairsLMAInterscene(): using mb_max_gain="
+
mb_max_gain
+
", disable_ers="
+
disable_ers
+
", disable_ers_y="
+
disable_ers_y
);
boolean
freeze_xy_pull
=
true
;
// false; // true; // debugging freezing xy to xy_pull
boolean
copy_pull_current
=
false
;
// true;
boolean
restore_imu
=
false
;
// restore imu omega-az and omega-tl, freeze ERS, adjust X,Y,Z,Az,Tl,Rl
", disable_ers="
+
disable_ers
+
", disable_ers_y="
+
disable_ers_y
+
", use_Z="
+
use_Z
+
", use_R="
+
use_R
);
boolean
freeze_xy_pull
=
clt_parameters
.
imp
.
freeze_xy_pull
;
// true; // false; // true; // debugging freezing xy to xy_pull
boolean
copy_pull_current
=
clt_parameters
.
imp
.
copy_pull_current
;
//false; // true;
boolean
restore_imu
=
clt_parameters
.
imp
.
restore_imu
;
//false; // restore imu omega-az and omega-tl, freeze ERS, adjust X,Y,Z,Az,Tl,Rl
boolean
[]
param_select
=
configured_lma
?
clt_parameters
.
ilp
.
ilma_lma_select
:
ErsCorrection
.
getParamSelect
(
true
,
// !freeze_xy_pull && (!readjust_xy_ims || (reg_weight_xy != 0)), // false only in mode c): freeze X,Y// boolean use_XY
true
,
// readjust_xy_ims || lpf_xy, // boolean use_AT,
lma_xyzatr
||
use_Z
,
// boolean use_Z,
lma_xyzatr
||
use_R
,
// boolean use_R,
lma_xyzatr
||
(
!
freeze_xy_pull
&&
(!
readjust_xy_ims
||
(
reg_weight_xy
!=
0
))),
// false only in mode c): freeze X,Y// boolean use_XY
lma_xyzatr
||
(
readjust_xy_ims
||
lpf_xy
),
// boolean use_AT,
!
disable_ers
,
//boolean use_ERS);//clt_parameters.ilp.ilma_lma_select;
!
disable_ers_y
);
// boolean use_ERS_tilt);
!
disable_ers_y
,
// boolean use_ERS_tilt,
!
disable_ers_r
);
// boolean use_ERS_roll);
final
double
[]
param_regweights
=
configured_lma
?
clt_parameters
.
ilp
.
ilma_regularization_weights
:
ErsCorrection
.
getParamRegWeights
(
(
freeze_xy_pull
?
0.0
:
reg_weight_xy
));
// double reg_weight,
...
...
@@ -1996,10 +2059,13 @@ public class Interscene {
}
}
param_select
=
ErsCorrection
.
getParamSelect
(
true
,
// boolean use_Z,
true
,
// boolean use_R,
true
,
// boolean use_XY
true
,
// boolean use_AT,
false
,
//boolean use_ERS);//clt_parameters.ilp.ilma_lma_select;
false
);
// boolean use_ERS_tilt);
false
,
// boolean use_ERS);//clt_parameters.ilp.ilma_lma_select;
false
,
// boolean use_ERS_tilt);
false
);
// boolean use_ERS_roll);
}
// optionally filter by averaging and "IMU" (actually current dxyzatr_dt).
...
...
@@ -5118,7 +5184,18 @@ public class Interscene {
sb
.
append
(
nscene
+
"\t"
+
timestamp
);
if
(
use_processed
)
{
double
[]
nan3
=
new
double
[]
{
Double
.
NaN
,
Double
.
NaN
,
Double
.
NaN
};
double
[][]
nan23
=
new
double
[][]
{
nan3
,
nan3
};
if
(
scenes_xyzatr
[
nscene
]
!=
null
)
{
if
(
scenes_xyzatr
[
nscene
][
0
]
==
null
)
scenes_xyzatr
[
nscene
][
0
]=
nan3
;
if
(
scenes_xyzatr
[
nscene
][
1
]
==
null
)
scenes_xyzatr
[
nscene
][
1
]=
nan3
;
if
(
dxyzatr_dt
[
nscene
]==
null
)
dxyzatr_dt
[
nscene
]
=
nan23
;
if
(
dxyzatr_dt
[
nscene
][
0
]
==
null
)
dxyzatr_dt
[
nscene
][
0
]=
nan3
;
if
(
dxyzatr_dt
[
nscene
][
0
]
==
null
)
dxyzatr_dt
[
nscene
][
0
]=
nan3
;
if
(
scenes_xyzatr_dt
[
nscene
]==
null
)
scenes_xyzatr_dt
[
nscene
]
=
nan23
;
if
(
scenes_xyzatr_dt
[
nscene
][
0
]
==
null
)
scenes_xyzatr_dt
[
nscene
][
0
]=
nan3
;
if
(
scenes_xyzatr_dt
[
nscene
][
0
]
==
null
)
scenes_xyzatr_dt
[
nscene
][
0
]=
nan3
;
// x,y,z - scene position in reference scene frame (reference scene is all 0-s)
sb
.
append
(
"\t"
+
scenes_xyzatr
[
nscene
][
0
][
0
]+
"\t"
+
scenes_xyzatr
[
nscene
][
0
][
1
]+
"\t"
+
scenes_xyzatr
[
nscene
][
0
][
2
]);
// a,tilt,roll - scene orientation in reference scene frame (reference scene is all 0-s)
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
2cb7df5a
...
...
@@ -370,7 +370,7 @@ public class IntersceneMatchParameters {
public
double
max_zoom_diff
=
0
;
// for down-views when changing altitude (0 - ignore)
public
boolean
fpn_skip
=
true
;
// skip too close scenes (false - abort, previous behavior)
public
boolean
fpn_rematch
=
true
;
// match fpn-failed scenes to later scenes with larger difference
public
boolean
refine_invert
=
true
;
// Refine with LMA while inverting relative poses from other reference
public
boolean
refine_invert
=
false
;
// Refine with LMA while inverting relative poses from other reference
// Remove moving objects (goal is not to detect slightest movement, but to improve pose matching
public
boolean
mov_en
=
true
;
// enable detection/removal of the moving objects during pose matching
...
...
@@ -413,11 +413,27 @@ public class IntersceneMatchParameters {
public
double
mb_tau
=
0.008
;
// time constant, sec
public
double
mb_max_gain
=
5.0
;
// motion blur maximal gain (if more - move second point more than a pixel
public
double
mb_max_gain_inter
=
2.0
;
// same for interscene correlation for pose adjustment
// TODO: move next parameters elsewhere - they are not the motion blur ones.
public
int
mb_gain_index_pose
=
5
;
// pose readjust pass to switch to full mb_max_gain from mb_max_gain_inter
public
int
mb_gain_index_depth
=
5
;
// depth map refine pass (SfM) to switch to full mb_max_gain from mb_max_gain_inter
public
int
mb_ers_index
=
2
;
// pose readjust pass to enable ERS
public
int
mb_ers_index
=
3
;
// pose readjust pass to enable ERS
public
int
mb_ers_y_index
=
3
;
// pose readjust pass to enable ERS in vertical (Y) direction - it competes with SfM
public
int
mb_ers_r_index
=
3
;
// pose readjust pass to enable ERS in vertical (Y) direction - it competes with SfM
public
int
mb_all_index
=
4
;
// simultaneously LMA-adjust XYZATR plus optional angular ERS
public
boolean
mb_pref_orient
=
true
;
// rely on IMU orientation before position
public
boolean
lma_use_Z
=
true
;
// LMA adjust Z
public
boolean
lma_use_R
=
true
;
// LMA adjust R
// FIXME: some of the following parameters will be modified or removed
public
boolean
configured_lma
=
false
;
public
boolean
freeze_xy_pull
=
true
;
// false; // true; // debugging freezing xy to xy_pull
public
boolean
copy_pull_current
=
false
;
// true;
public
boolean
restore_imu
=
false
;
// restore imu omega-az and omega-tl, freeze ERS, adjust X,Y,Z,Az,Tl,Rl
public
boolean
lpf_xy
=
false
;
// lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
public
boolean
readjust_xy_ims
=
true
;
// false;
public
double
reg_weight_xy
=
0
;
// 10.0; // 1.0; // 10.0; // 0.05; // TODO: find out reasonable values
public
boolean
stereo_merge
=
true
;
public
int
stereo_gap
=
32
;
// pixels between right and left frames
...
...
@@ -1186,7 +1202,8 @@ public class IntersceneMatchParameters {
"Maximal gain for motion blur correction (if needed more for 1 pixel, increase offset). Will be forced fro the last adjustment"
);
gd
.
addNumericField
(
"Maximal gain pose"
,
this
.
mb_max_gain_inter
,
5
,
7
,
"x"
,
"Maximal gain for motion blur correction during interscene correlation. Will be used for all but the last adjustment."
);
gd
.
addTab
(
"LMA sequence"
,
"Interscene LMA sequence control"
);
gd
.
addMessage
(
"Parameters for control of the LMA pose adjustment sequence"
);
gd
.
addNumericField
(
"Pose readjust number for full mb_gain"
,
this
.
mb_gain_index_pose
,
0
,
3
,
""
,
"Pose readjust pass to switch to full mb_max_gain from mb_max_gain_inter."
);
gd
.
addNumericField
(
"Depth map refine number for full mb_gain"
,
this
.
mb_gain_index_depth
,
0
,
3
,
""
,
...
...
@@ -1195,6 +1212,34 @@ public class IntersceneMatchParameters {
"Pose readjust pass to enable ERS."
);
gd
.
addNumericField
(
"Pose readjust number to enable tilt ERS LMA"
,
this
.
mb_ers_y_index
,
0
,
3
,
""
,
"Pose readjust pass to enable ERS in vertical (Y) direction - it competes with SfM."
);
gd
.
addNumericField
(
"Pose readjust number to enable roll ERS LMA"
,
this
.
mb_ers_r_index
,
0
,
3
,
""
,
"Pose readjust pass to enable ERS roll adjustment."
);
gd
.
addNumericField
(
"Pose readjust number to enable all XYZATR"
,
this
.
mb_all_index
,
0
,
3
,
""
,
"Enables 6 DOF adjustment for one pass, ERS parameters adjusted separately above."
);
gd
.
addCheckbox
(
"Rely on IMS orientation before position"
,
this
.
mb_pref_orient
,
"First use IMS orientation, later use IMS position. If false - reverse order."
);
gd
.
addCheckbox
(
"LMA adjust Z"
,
this
.
lma_use_Z
,
"Always adjust Z (altitude) when running interscene LMA. False - same as X and Y."
);
gd
.
addCheckbox
(
"LMA adjust roll"
,
this
.
lma_use_R
,
"Always adjust roll when running interscene LMA. False - same as Azimuth and Tilt."
);
gd
.
addMessage
(
"Other Interscene LMA parameters to be modified/replaced/removed"
);
gd
.
addCheckbox
(
"Use configuration LMA parameters"
,
this
.
configured_lma
,
"Use configuration LMA parameters, disregard onther parameters that influence LMA parameters."
);
gd
.
addCheckbox
(
"Freeze XY pull"
,
this
.
freeze_xy_pull
,
"Freeze XY target values, approach with smaller steps if needed ."
);
gd
.
addCheckbox
(
"Copy pull values to current"
,
this
.
copy_pull_current
,
"Replace current (start) values with the \"pull\" ones."
);
gd
.
addCheckbox
(
"Restore ERS to IMU velocities"
,
this
.
restore_imu
,
"restore imu omega-az and omega-tl, freeze ERS, adjust X,Y,Z,Az,Tl,Rl."
);
gd
.
addCheckbox
(
"LPF X and Y"
,
this
.
lpf_xy
,
"LPF x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables - what?."
);
gd
.
addCheckbox
(
"Readjust XY from IMS"
,
this
.
readjust_xy_ims
,
"Readjust X,Y from IMS linear/angular and full X,Y movement."
);
gd
.
addNumericField
(
"LMA regularization weight"
,
this
.
reg_weight_xy
,
5
,
7
,
""
,
"Regularization weight for LMA"
);
gd
.
addTab
(
"Stereo/Video"
,
"Parameters for stereo video generation"
);
...
...
@@ -1609,11 +1654,24 @@ public class IntersceneMatchParameters {
this
.
mb_tau
=
gd
.
getNextNumber
();
this
.
mb_max_gain
=
gd
.
getNextNumber
();
this
.
mb_max_gain_inter
=
gd
.
getNextNumber
();
this
.
mb_gain_index_pose
=
(
int
)
gd
.
getNextNumber
();
this
.
mb_gain_index_depth
=(
int
)
gd
.
getNextNumber
();
this
.
mb_ers_index
=
(
int
)
gd
.
getNextNumber
();
this
.
mb_ers_y_index
=
(
int
)
gd
.
getNextNumber
();
this
.
mb_ers_r_index
=
(
int
)
gd
.
getNextNumber
();
this
.
mb_all_index
=
(
int
)
gd
.
getNextNumber
();
this
.
mb_pref_orient
=
gd
.
getNextBoolean
();
this
.
lma_use_Z
=
gd
.
getNextBoolean
();
this
.
lma_use_R
=
gd
.
getNextBoolean
();
this
.
configured_lma
=
gd
.
getNextBoolean
();
this
.
freeze_xy_pull
=
gd
.
getNextBoolean
();
this
.
copy_pull_current
=
gd
.
getNextBoolean
();
this
.
restore_imu
=
gd
.
getNextBoolean
();
this
.
lpf_xy
=
gd
.
getNextBoolean
();
this
.
readjust_xy_ims
=
gd
.
getNextBoolean
();
this
.
reg_weight_xy
=
gd
.
getNextNumber
();
if
(
stereo_views
.
length
>
0
)
{
int
i
=
gd
.
getNextChoiceIndex
();
...
...
@@ -2030,8 +2088,22 @@ public class IntersceneMatchParameters {
properties
.
setProperty
(
prefix
+
"mb_gain_index_pose"
,
this
.
mb_gain_index_pose
+
""
);
// int
properties
.
setProperty
(
prefix
+
"mb_gain_index_depth"
,
this
.
mb_gain_index_depth
+
""
);
// int
properties
.
setProperty
(
prefix
+
"mb_ers_index"
,
this
.
mb_ers_index
+
""
);
// int
properties
.
setProperty
(
prefix
+
"mb_ers_y_index"
,
this
.
mb_ers_y_index
+
""
);
// int
properties
.
setProperty
(
prefix
+
"mb_ers_r_index"
,
this
.
mb_ers_r_index
+
""
);
// int
properties
.
setProperty
(
prefix
+
"mb_all_index"
,
this
.
mb_all_index
+
""
);
// int
properties
.
setProperty
(
prefix
+
"mb_pref_orient"
,
this
.
mb_pref_orient
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"lma_use_Z"
,
this
.
lma_use_Z
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"lma_use_R"
,
this
.
lma_use_R
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"configured_lma"
,
this
.
configured_lma
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"freeze_xy_pull"
,
this
.
freeze_xy_pull
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"copy_pull_current"
,
this
.
copy_pull_current
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"restore_imu"
,
this
.
restore_imu
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"lpf_xy"
,
this
.
lpf_xy
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"readjust_xy_ims"
,
this
.
readjust_xy_ims
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"reg_weight_xy"
,
this
.
reg_weight_xy
+
""
);
// double
properties
.
setProperty
(
prefix
+
"stereo_merge"
,
this
.
stereo_merge
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"stereo_gap"
,
this
.
stereo_gap
+
""
);
// int
...
...
@@ -2409,8 +2481,22 @@ public class IntersceneMatchParameters {
if
(
properties
.
getProperty
(
prefix
+
"mb_gain_index_pose"
)!=
null
)
this
.
mb_gain_index_pose
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"mb_gain_index_pose"
));
if
(
properties
.
getProperty
(
prefix
+
"mb_gain_index_depth"
)!=
null
)
this
.
mb_gain_index_depth
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"mb_gain_index_depth"
));
if
(
properties
.
getProperty
(
prefix
+
"mb_ers_index"
)!=
null
)
this
.
mb_ers_index
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"mb_ers_index"
));
if
(
properties
.
getProperty
(
prefix
+
"mb_ers_y_index"
)!=
null
)
this
.
mb_ers_y_index
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"mb_ers_y_index"
));
if
(
properties
.
getProperty
(
prefix
+
"mb_ers_r_index"
)!=
null
)
this
.
mb_ers_r_index
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"mb_ers_r_index"
));
if
(
properties
.
getProperty
(
prefix
+
"mb_all_index"
)!=
null
)
this
.
mb_all_index
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"mb_all_index"
));
if
(
properties
.
getProperty
(
prefix
+
"mb_pref_orient"
)!=
null
)
this
.
mb_pref_orient
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"mb_pref_orient"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_use_Z"
)!=
null
)
this
.
lma_use_Z
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"lma_use_Z"
));
if
(
properties
.
getProperty
(
prefix
+
"lma_use_R"
)!=
null
)
this
.
lma_use_R
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"lma_use_R"
));
if
(
properties
.
getProperty
(
prefix
+
"configured_lma"
)!=
null
)
this
.
configured_lma
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"configured_lma"
));
if
(
properties
.
getProperty
(
prefix
+
"freeze_xy_pull"
)!=
null
)
this
.
freeze_xy_pull
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"freeze_xy_pull"
));
if
(
properties
.
getProperty
(
prefix
+
"copy_pull_current"
)!=
null
)
this
.
copy_pull_current
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"copy_pull_current"
));
if
(
properties
.
getProperty
(
prefix
+
"restore_imu"
)!=
null
)
this
.
restore_imu
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"restore_imu"
));
if
(
properties
.
getProperty
(
prefix
+
"lpf_xy"
)!=
null
)
this
.
lpf_xy
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"lpf_xy"
));
if
(
properties
.
getProperty
(
prefix
+
"readjust_xy_ims"
)!=
null
)
this
.
readjust_xy_ims
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"readjust_xy_ims"
));
if
(
properties
.
getProperty
(
prefix
+
"reg_weight_xy"
)!=
null
)
this
.
reg_weight_xy
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"reg_weight_xy"
));
if
(
properties
.
getProperty
(
prefix
+
"stereo_merge"
)!=
null
)
this
.
stereo_merge
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"stereo_merge"
));
if
(
properties
.
getProperty
(
prefix
+
"stereo_gap"
)!=
null
)
this
.
stereo_gap
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"stereo_gap"
));
...
...
@@ -2798,13 +2884,27 @@ public class IntersceneMatchParameters {
imp
.
mb_gain_index_pose
=
this
.
mb_gain_index_pose
;
imp
.
mb_gain_index_depth
=
this
.
mb_gain_index_depth
;
imp
.
mb_ers_index
=
this
.
mb_ers_index
;
imp
.
mb_ers_y_index
=
this
.
mb_ers_y_index
;
imp
.
mb_ers_r_index
=
this
.
mb_ers_r_index
;
imp
.
mb_all_index
=
this
.
mb_all_index
;
imp
.
mb_pref_orient
=
this
.
mb_pref_orient
;
imp
.
lma_use_Z
=
this
.
lma_use_Z
;
imp
.
lma_use_R
=
this
.
lma_use_R
;
imp
.
configured_lma
=
this
.
configured_lma
;
imp
.
freeze_xy_pull
=
this
.
freeze_xy_pull
;
imp
.
copy_pull_current
=
this
.
copy_pull_current
;
imp
.
restore_imu
=
this
.
restore_imu
;
imp
.
lpf_xy
=
this
.
lpf_xy
;
imp
.
readjust_xy_ims
=
this
.
readjust_xy_ims
;
imp
.
reg_weight_xy
=
this
.
reg_weight_xy
;
imp
.
stereo_merge
=
this
.
stereo_merge
;
imp
.
stereo_gap
=
this
.
stereo_gap
;
imp
.
stereo_intereye
=
this
.
stereo_intereye
;
imp
.
stereo_phone_width
=
this
.
stereo_phone_width
;
imp
.
stereo_intereye
=
this
.
stereo_intereye
;
imp
.
stereo_phone_width
=
this
.
stereo_phone_width
;
imp
.
extra_hor_tile
=
this
.
extra_hor_tile
;
imp
.
extra_vert_tile
=
this
.
extra_vert_tile
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
2cb7df5a
...
...
@@ -5032,6 +5032,7 @@ public class OpticalFlow {
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"Egomotion table saved to "
+
ego_path
);
}
/*
// reference to earliest
String ego_path_early = quadCLTs[ref_index].getX3dDirectory()+Prefs.getFileSeparator()+
quadCLTs[ref_index].getImageName()+
...
...
@@ -5057,6 +5058,7 @@ public class OpticalFlow {
if (debugLevel> -3) {
System.out.println("Egomotion referenced to earliest scene table saved to "+ego_path_early);
}
*/
}
}
else
if
(
ims_use
)
{
...
...
@@ -5289,18 +5291,26 @@ public class OpticalFlow {
}
// TODO: move to config
// boolean freeze_xy_pull = true; // false; // true; // debugging freezing xy to xy_pull
boolean
configured_lma
=
false
;
boolean
lpf_xy
=
false
;
// lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
boolean
configured_lma
=
clt_parameters
.
imp
.
configured_lma
;
//
false;
boolean
lpf_xy
=
clt_parameters
.
imp
.
lpf_xy
;
//
false; // lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
double
avg_rlen
=
clt_parameters
.
imp
.
avg_len
;
// 3.0;
boolean
readjust_xy_ims
=
true
;
// false;
double
reg_weight_xy
=
0
;
// 10.0; // 1.0; // 10.0; // 0.05; // TODO: find out reasonable values
boolean
readjust_xy_ims
=
clt_parameters
.
imp
.
readjust_xy_ims
;
//
true; // false;
double
reg_weight_xy
=
clt_parameters
.
imp
.
reg_weight_xy
;
//
0; // 10.0; // 1.0; // 10.0; // 0.05; // TODO: find out reasonable values
int
mb_ers_index
=
clt_parameters
.
imp
.
mb_ers_index
;
int
mb_ers_y_index
=
clt_parameters
.
imp
.
mb_ers_y_index
;
int
mb_ers_r_index
=
clt_parameters
.
imp
.
mb_ers_r_index
;
int
mb_all_index
=
clt_parameters
.
imp
.
mb_all_index
;
int
mb_gain_index_pose
=
clt_parameters
.
imp
.
mb_gain_index_pose
;
// pose readjust pass to switch to full mb_max_gain from mb_max_gain_inter
boolean
disable_ers
=
(
quadCLTs
[
ref_index
].
getNumOrient
()
<
mb_ers_index
);
boolean
disable_ers_y
=
(
quadCLTs
[
ref_index
].
getNumOrient
()
<
mb_ers_y_index
);
boolean
disable_ers_r
=
(
quadCLTs
[
ref_index
].
getNumOrient
()
<
mb_ers_r_index
);
boolean
lma_xyzatr
=
(
quadCLTs
[
ref_index
].
getNumOrient
()
==
mb_all_index
);
boolean
lma_use_Z
=
clt_parameters
.
imp
.
lma_use_Z
;
// true; // lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
boolean
lma_use_R
=
clt_parameters
.
imp
.
lma_use_R
;
// true; // lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
boolean
ers_from_ims
=
true
;
// false; // change later
int
ers_mode
=
0
;
// keep
...
...
@@ -5324,8 +5334,12 @@ public class OpticalFlow {
earliest_scene
=
Interscene
.
reAdjustPairsLMAInterscene
(
// after combo dsi is available and preliminary poses are known
clt_parameters
,
// CLTParameters clt_parameters,
mb_max_gain
,
// double mb_max_gain,
lma_use_Z
,
// boolean use_Z,
lma_use_R
,
// boolean use_R,
disable_ers
,
// boolean disable_ers,
disable_ers_y
,
// boolean disable_ers_y,
disable_ers_r
,
// boolean disable_ers_r,
lma_xyzatr
,
// boolean lma_xyzatr,
configured_lma
,
// boolean configured_lma,
lpf_xy
,
// boolean lpf_xy, // lpf x and y, re-adjust X,Y,Z,A,T,R with pull for X,Y. Disables
avg_rlen
,
// double avg_rlen,
...
...
@@ -5372,7 +5386,7 @@ public class OpticalFlow {
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"Egomotion table saved to "
+
ego_path
);
}
/*
// reference to earliest
String ego_path_early = quadCLTs[ref_index].getX3dDirectory()+Prefs.getFileSeparator()+
quadCLTs[ref_index].getImageName()+
...
...
@@ -5398,7 +5412,7 @@ public class OpticalFlow {
if (debugLevel> -3) {
System.out.println("Egomotion referenced to earliest scene table saved to "+ego_path_early);
}
*/
}
}
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/QuaternionLma.java
View file @
2cb7df5a
...
...
@@ -68,6 +68,13 @@ public class QuaternionLma {
parameters_vector
=
quat0
.
clone
();
double
sw
=
0
;
for
(
int
i
=
0
;
i
<
N
;
i
++)
{
if
((
vect_x
[
i
]==
null
)
||
(
vect_y
[
i
]==
null
))
{
for
(
int
j
=
0
;
j
<
3
;
j
++)
{
x_vector
[
3
*
i
+
j
]
=
0.0
;
y_vector
[
3
*
i
+
j
]
=
0.0
;
weights
[
3
*
i
+
j
]
=
0.0
;
}
}
else
{
for
(
int
j
=
0
;
j
<
3
;
j
++)
{
x_vector
[
3
*
i
+
j
]
=
vect_x
[
i
][
j
];
y_vector
[
3
*
i
+
j
]
=
vect_y
[
i
][
j
];
...
...
@@ -76,6 +83,7 @@ public class QuaternionLma {
sw
+=
w
;
}
}
}
double
k
=
(
pure_weight
)/
sw
;
for
(
int
i
=
0
;
i
<
weights
.
length
;
i
++)
weights
[
i
]
*=
k
;
weights
[
3
*
N
]
=
1.0
-
pure_weight
;
...
...
@@ -84,7 +92,7 @@ public class QuaternionLma {
}
// TODO: Consider adding differences between x and y for regularization (or it won't work)
// goal - to minimize "unne
ded" rotation along the common
n axis
// goal - to minimize "unne
eded" rotation along the commo
n axis
private
double
[]
getFxDerivs
(
double
[]
vector
,
final
double
[][]
jt
,
// should be null or initialized with [vector.length][]
...
...
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