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
ba487fc2
Commit
ba487fc2
authored
Dec 18, 2023
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finished small steps to "pull" without regularization
parent
d87f98cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
2 deletions
+90
-2
Interscene.java
...main/java/com/elphel/imagej/tileprocessor/Interscene.java
+83
-2
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+7
-0
No files found.
src/main/java/com/elphel/imagej/tileprocessor/Interscene.java
View file @
ba487fc2
...
@@ -578,6 +578,7 @@ public class Interscene {
...
@@ -578,6 +578,7 @@ public class Interscene {
reliable_ref
,
//boolean [] reliable_ref, // null or bitmask of reliable reference tiles
reliable_ref
,
//boolean [] reliable_ref, // null or bitmask of reliable reference tiles
scenes_xyzatr
[
ref_index
],
// double [][] scene0_xyzatr,,
scenes_xyzatr
[
ref_index
],
// double [][] scene0_xyzatr,,
initial_pose
,
// double [][] scene1_xyzatr,
initial_pose
,
// double [][] scene1_xyzatr,
Double
.
NaN
,
// double average_z,
initial_pose
,
// double [] scene1_xyzatr_pull, // if both are not null, specify target values to pull to
initial_pose
,
// double [] scene1_xyzatr_pull, // if both are not null, specify target values to pull to
clt_parameters
.
ilp
.
ilma_lma_select
,
// boolean[] param_select,
clt_parameters
.
ilp
.
ilma_lma_select
,
// boolean[] param_select,
reg_weights
,
// double [] param_regweights,
reg_weights
,
// double [] param_regweights,
...
@@ -739,6 +740,7 @@ public class Interscene {
...
@@ -739,6 +740,7 @@ public class Interscene {
reliable_ref
,
//boolean [] reliable_ref, // null or bitmask of reliable reference tiles
reliable_ref
,
//boolean [] reliable_ref, // null or bitmask of reliable reference tiles
scenes_xyzatr
[
fpn_pairs
[
ipair
][
1
]],
// double [][] scene0_xyzatr,,
scenes_xyzatr
[
fpn_pairs
[
ipair
][
1
]],
// double [][] scene0_xyzatr,,
scenes_xyzatr
[
fpn_pairs
[
ipair
][
0
]],
// initial_pose, // double [][] scene1_xyzatr,
scenes_xyzatr
[
fpn_pairs
[
ipair
][
0
]],
// initial_pose, // double [][] scene1_xyzatr,
Double
.
NaN
,
// double average_z,
scenes_xyzatr
[
fpn_pairs
[
ipair
][
0
]],
// initial_pose, // double [] scene1_xyzatr_pull, // if both are not null, specify target values to pull to
scenes_xyzatr
[
fpn_pairs
[
ipair
][
0
]],
// initial_pose, // double [] scene1_xyzatr_pull, // if both are not null, specify target values to pull to
clt_parameters
.
ilp
.
ilma_lma_select
,
// boolean[] param_select,
clt_parameters
.
ilp
.
ilma_lma_select
,
// boolean[] param_select,
reg_weights
,
// double [] param_regweights,
reg_weights
,
// double [] param_regweights,
...
@@ -1388,8 +1390,8 @@ public class Interscene {
...
@@ -1388,8 +1390,8 @@ public class Interscene {
int
debugLevel
)
int
debugLevel
)
{
{
System
.
out
.
println
(
"reAdjustPairsLMAInterscene(): using mb_max_gain="
+
mb_max_gain
);
System
.
out
.
println
(
"reAdjustPairsLMAInterscene(): using mb_max_gain="
+
mb_max_gain
);
boolean
freeze_xy_pull
=
false
;
// true; // debugging freezing xy to xy_pull
boolean
freeze_xy_pull
=
true
;
//
false; // true; // debugging freezing xy to xy_pull
boolean
copy_pull_current
=
true
;
boolean
copy_pull_current
=
false
;
//
true;
final
boolean
[]
param_select
=
configured_lma
?
clt_parameters
.
ilp
.
ilma_lma_select
:
final
boolean
[]
param_select
=
configured_lma
?
clt_parameters
.
ilp
.
ilma_lma_select
:
ErsCorrection
.
getParamSelect
(
ErsCorrection
.
getParamSelect
(
!
freeze_xy_pull
&&
(!
readjust_xy_ims
||
(
reg_weight_xy
!=
0
)),
// false only in mode c): freeze X,Y// boolean use_XY
!
freeze_xy_pull
&&
(!
readjust_xy_ims
||
(
reg_weight_xy
!=
0
)),
// false only in mode c): freeze X,Y// boolean use_XY
...
@@ -1721,6 +1723,7 @@ public class Interscene {
...
@@ -1721,6 +1723,7 @@ public class Interscene {
reliable_ref
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
reliable_ref
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
scenes_xyzatr
[
ref_index
],
// double [][] scene0_xyzatr,
scenes_xyzatr
[
ref_index
],
// double [][] scene0_xyzatr,
scenes_xyzatr
[
nscene
],
// double [][] scene1_xyzatr,
scenes_xyzatr
[
nscene
],
// double [][] scene1_xyzatr,
avg_z
,
// double average_z,
scenes_xyzatr_pull
[
nscene
],
// double [][] scene1_xyzatr_pull,
scenes_xyzatr_pull
[
nscene
],
// double [][] scene1_xyzatr_pull,
param_select
,
// boolean[] param_select,
param_select
,
// boolean[] param_select,
param_regweights
,
// double [] param_regweights,
param_regweights
,
// double [] param_regweights,
...
@@ -1846,6 +1849,7 @@ public class Interscene {
...
@@ -1846,6 +1849,7 @@ public class Interscene {
reliable_ref
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
reliable_ref
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
scenes_xyzatr
[
fpn_pairs
[
ipair
][
1
]],
// double [][] scene0_xyzatr,
scenes_xyzatr
[
fpn_pairs
[
ipair
][
1
]],
// double [][] scene0_xyzatr,
scenes_xyzatr
[
fpn_pairs
[
ipair
][
0
]],
// double [][] scene1_xyzatr,
scenes_xyzatr
[
fpn_pairs
[
ipair
][
0
]],
// double [][] scene1_xyzatr,
avg_z
,
// double average_z,
scenes_xyzatr_pull
[
fpn_pairs
[
ipair
][
0
]],
// double [][] scene1_xyzatr_pull,
scenes_xyzatr_pull
[
fpn_pairs
[
ipair
][
0
]],
// double [][] scene1_xyzatr_pull,
param_select
,
// boolean[] param_select,
param_select
,
// boolean[] param_select,
param_regweights
,
// double [] param_regweights,
param_regweights
,
// double [] param_regweights,
...
@@ -1933,6 +1937,7 @@ public class Interscene {
...
@@ -1933,6 +1937,7 @@ public class Interscene {
boolean
[]
reliable_ref
,
// null or bitmask of reliable reference tiles
boolean
[]
reliable_ref
,
// null or bitmask of reliable reference tiles
double
[][]
scene0_xyzatr
,
double
[][]
scene0_xyzatr
,
double
[][]
scene1_xyzatr
,
double
[][]
scene1_xyzatr
,
double
average_z
,
double
[][]
scene1_xyzatr_pull
,
double
[][]
scene1_xyzatr_pull
,
boolean
[]
param_select
,
boolean
[]
param_select
,
double
[]
param_regweights
,
double
[]
param_regweights
,
...
@@ -2022,6 +2027,82 @@ public class Interscene {
...
@@ -2022,6 +2027,82 @@ public class Interscene {
0
,
// int shrink_gaps, // will gaps, but not more that grow by this
0
,
// int shrink_gaps, // will gaps, but not more that grow by this
debugLevel
);
// int debug_level)
debugLevel
);
// int debug_level)
}
}
// avg_z
double
pull_offset
=
0
;
if
(!
Double
.
isNaN
(
average_z
)
&&
(
scene1_xyzatr_pull
!=
null
)
&&
(
scene1_xyzatr_pull
[
0
]
!=
null
)
&&
(
scene1_xyzatr_pull
[
1
]
!=
null
)){
pull_offset
=
quadCLTs
[
ref_index
].
estimateAverageShift
(
scene1_xyzatr
,
// double [][] xyzatr0,
scene1_xyzatr_pull
,
// double [][] xyzatr1,
average_z
,
// double average_z,
false
,
// boolean use_rot,
true
);
// boolean rectilinear)
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"adjustDiffPairsLMAInterscene(): pull_offset="
+
pull_offset
);
}
while
(
pull_offset
>
clt_parameters
.
imp
.
max_pull_jump
)
{
// so far assuming only X and Y to be modified. Z - won't harm, angles are not used now,
// but if yes - quaternions are needed. Note, that angles are updated and will not now match pull
// here updtae all parameters that are NOT adjusted. For angles use individual angles, just avoid
// crossing 2pi
for
(
int
i
=
0
;
i
<
2
;
i
++)
{
scene1_xyzatr
[
0
][
i
]
+=
(
scene1_xyzatr_pull
[
0
][
i
]
-
scene1_xyzatr
[
0
][
i
])
*
clt_parameters
.
imp
.
max_pull_jump
/
pull_offset
;
}
// apply small scene1_xyzatr jump towards scene1_xyzatr_pull, run adjustPairsLMAInterscene, return if failed
double
[][]
new_xyzatr
=
adjustPairsLMAInterscene
(
// assumes reference GPU data is already set - once for multiple scenes
clt_parameters
,
// CLTParameters clt_parameters,
true
,
// boolean initial_adjust,
false
,
// boolean fpn_disable, // disable fpn filter if images are known to be too close
disable_ers
,
// boolean disable_ers,
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
quadCLTs
[
nscene0
],
// QuadCLT reference_QuadClt,
ref_disparity
,
// double [] ref_disparity, // null or alternative reference disparity
pXpYD_ref
,
// double [][] pXpYD_ref, // pXpYD for the reference scene
reliable_ref
,
// boolean [] reliable_ref, // null or bitmask of reliable reference tiles
tp_tasks_ref
[
0
],
// TpTask[] tp_tasks_ref, // only (main if MB correction) tasks for FPN correction
quadCLTs
[
nscene1
],
// QuadCLT scene_QuadClt,
scene1_xyzatr
[
0
],
// double [] camera_xyz,
scene1_xyzatr
[
1
],
// double [] camera_atr,
scene1_xyzatr_pull
[
0
],
// double [] scene_xyz_pull, // if both are not null, specify target values to pull to
scene1_xyzatr_pull
[
1
],
// double [] scene_atr_pull,
param_select
,
// boolean[] param_select,
param_regweights
,
// double [] param_regweights,
rms_out
,
// double [] rms_out, // null or double [2]
max_rms
,
// double max_rms,
// motion blur compensation
mb_tau
,
// double mb_tau, // 0.008; // time constant, sec
mb_max_gain
,
// double mb_max_gain, // 5.0; // motion blur maximal gain (if more - move second point more than a pixel
mb_vectors_scene1
,
// double [][] mb_vectors, // now [2][ntiles];
debugLevel
);
// int debug_level)
if
(
new_xyzatr
==
null
)
{
return
null
;
// failed
}
double
new_pull_offset
=
quadCLTs
[
ref_index
].
estimateAverageShift
(
new_xyzatr
,
// double [][] xyzatr0,
scene1_xyzatr_pull
,
// double [][] xyzatr1,
average_z
,
// double average_z,
false
,
// boolean use_rot,
true
);
// boolean rectilinear)
if
(
new_pull_offset
<
pull_offset
)
{
scene1_xyzatr
=
new_xyzatr
;
// later - watch which parameters are updated by LMA, update those
scene1_xyzatr_pull
[
1
]
=
new_xyzatr
[
1
];
// update adjusted orientation
scene1_xyzatr_pull
[
0
][
2
]
=
new_xyzatr
[
0
][
2
];
// update Z
pull_offset
=
new_pull_offset
;
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"adjustDiffPairsLMAInterscene(): new pull_offset="
+
pull_offset
);
}
}
else
{
System
.
out
.
println
(
"adjustDiffPairsLMAInterscene(): new pull_offset worsened = "
+
pull_offset
+
", using old one"
);
break
;
}
}
scene1_xyzatr
[
0
]
=
scene1_xyzatr_pull
[
0
].
clone
();
// maybe no-cloning?
scene1_xyzatr
[
1
]
=
scene1_xyzatr_pull
[
1
].
clone
();
}
return
adjustPairsLMAInterscene
(
// assumes reference GPU data is already set - once for multiple scenes
return
adjustPairsLMAInterscene
(
// assumes reference GPU data is already set - once for multiple scenes
clt_parameters
,
// CLTParameters clt_parameters,
clt_parameters
,
// CLTParameters clt_parameters,
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
ba487fc2
...
@@ -348,6 +348,7 @@ public class IntersceneMatchParameters {
...
@@ -348,6 +348,7 @@ public class IntersceneMatchParameters {
public
boolean
fpn_ignore_border
=
false
;
// only if fpn_mask != null - ignore tile if maximum touches fpn_mask
public
boolean
fpn_ignore_border
=
false
;
// only if fpn_mask != null - ignore tile if maximum touches fpn_mask
public
double
min_offset
=
1.5
;
// pixels - minimal average pixel offset between images to consider interscene matching
public
double
min_offset
=
1.5
;
// pixels - minimal average pixel offset between images to consider interscene matching
public
double
max_pull_jump
=
3.0
;
// pixels - maximal offset from the current pose to "pull" pose.
public
double
max_rel_offset
=
0.5
;
// maximal interscene offset as a fraction of image width
public
double
max_rel_offset
=
0.5
;
// maximal interscene offset as a fraction of image width
public
double
max_roll_deg
=
5.0
;
// maximal interscene roll to consider matching
public
double
max_roll_deg
=
5.0
;
// maximal interscene roll to consider matching
public
double
max_zoom_diff
=
0
;
// for down-views when changing altitude (0 - ignore)
public
double
max_zoom_diff
=
0
;
// for down-views when changing altitude (0 - ignore)
...
@@ -1041,6 +1042,8 @@ public class IntersceneMatchParameters {
...
@@ -1041,6 +1042,8 @@ public class IntersceneMatchParameters {
gd
.
addMessage
(
"Limit series, handle FPN-related problems"
);
gd
.
addMessage
(
"Limit series, handle FPN-related problems"
);
gd
.
addNumericField
(
"Minimal inter-scene offset"
,
this
.
min_offset
,
6
,
7
,
"pix"
,
gd
.
addNumericField
(
"Minimal inter-scene offset"
,
this
.
min_offset
,
6
,
7
,
"pix"
,
"Minimal average pixel offset between images to consider interscene matching"
);
"Minimal average pixel offset between images to consider interscene matching"
);
gd
.
addNumericField
(
"Maximal \"pull\" jump"
,
this
.
max_pull_jump
,
6
,
7
,
"pix"
,
"Maximal offset from the current pose to the \"pull\" pose."
);
gd
.
addNumericField
(
"Maximal interscene offset fraction of width"
,
this
.
max_rel_offset
,
6
,
7
,
"x width"
,
gd
.
addNumericField
(
"Maximal interscene offset fraction of width"
,
this
.
max_rel_offset
,
6
,
7
,
"x width"
,
"Maximal interscene offset as a fraction of image width to handle low overlap"
);
"Maximal interscene offset as a fraction of image width to handle low overlap"
);
gd
.
addNumericField
(
"Maximal interscene roll"
,
this
.
max_roll_deg
,
6
,
7
,
"degrees"
,
gd
.
addNumericField
(
"Maximal interscene roll"
,
this
.
max_roll_deg
,
6
,
7
,
"degrees"
,
...
@@ -1495,6 +1498,7 @@ public class IntersceneMatchParameters {
...
@@ -1495,6 +1498,7 @@ public class IntersceneMatchParameters {
this
.
fpn_ignore_border
=
gd
.
getNextBoolean
();
this
.
fpn_ignore_border
=
gd
.
getNextBoolean
();
this
.
min_offset
=
gd
.
getNextNumber
();
this
.
min_offset
=
gd
.
getNextNumber
();
this
.
max_pull_jump
=
gd
.
getNextNumber
();
this
.
max_rel_offset
=
gd
.
getNextNumber
();
this
.
max_rel_offset
=
gd
.
getNextNumber
();
this
.
max_roll_deg
=
gd
.
getNextNumber
();
this
.
max_roll_deg
=
gd
.
getNextNumber
();
this
.
max_zoom_diff
=
gd
.
getNextNumber
();
this
.
max_zoom_diff
=
gd
.
getNextNumber
();
...
@@ -1901,6 +1905,7 @@ public class IntersceneMatchParameters {
...
@@ -1901,6 +1905,7 @@ public class IntersceneMatchParameters {
properties
.
setProperty
(
prefix
+
"fpn_ignore_border"
,
this
.
fpn_ignore_border
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"fpn_ignore_border"
,
this
.
fpn_ignore_border
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"min_offset"
,
this
.
min_offset
+
""
);
// double
properties
.
setProperty
(
prefix
+
"min_offset"
,
this
.
min_offset
+
""
);
// double
properties
.
setProperty
(
prefix
+
"max_pull_jump"
,
this
.
max_pull_jump
+
""
);
// double
properties
.
setProperty
(
prefix
+
"max_rel_offset"
,
this
.
max_rel_offset
+
""
);
// double
properties
.
setProperty
(
prefix
+
"max_rel_offset"
,
this
.
max_rel_offset
+
""
);
// double
properties
.
setProperty
(
prefix
+
"max_roll_deg"
,
this
.
max_roll_deg
+
""
);
// double
properties
.
setProperty
(
prefix
+
"max_roll_deg"
,
this
.
max_roll_deg
+
""
);
// double
properties
.
setProperty
(
prefix
+
"max_zoom_diff"
,
this
.
max_zoom_diff
+
""
);
// double
properties
.
setProperty
(
prefix
+
"max_zoom_diff"
,
this
.
max_zoom_diff
+
""
);
// double
...
@@ -2265,6 +2270,7 @@ public class IntersceneMatchParameters {
...
@@ -2265,6 +2270,7 @@ public class IntersceneMatchParameters {
if
(
properties
.
getProperty
(
prefix
+
"fpn_ignore_border"
)!=
null
)
this
.
fpn_ignore_border
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"fpn_ignore_border"
));
if
(
properties
.
getProperty
(
prefix
+
"fpn_ignore_border"
)!=
null
)
this
.
fpn_ignore_border
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"fpn_ignore_border"
));
if
(
properties
.
getProperty
(
prefix
+
"min_offset"
)!=
null
)
this
.
min_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"min_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"min_offset"
)!=
null
)
this
.
min_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"min_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"max_pull_jump"
)!=
null
)
this
.
max_pull_jump
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"max_pull_jump"
));
if
(
properties
.
getProperty
(
prefix
+
"max_rel_offset"
)!=
null
)
this
.
max_rel_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"max_rel_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"max_rel_offset"
)!=
null
)
this
.
max_rel_offset
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"max_rel_offset"
));
if
(
properties
.
getProperty
(
prefix
+
"max_roll_deg"
)!=
null
)
this
.
max_roll_deg
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"max_roll_deg"
));
if
(
properties
.
getProperty
(
prefix
+
"max_roll_deg"
)!=
null
)
this
.
max_roll_deg
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"max_roll_deg"
));
if
(
properties
.
getProperty
(
prefix
+
"max_zoom_diff"
)!=
null
)
this
.
max_zoom_diff
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"max_zoom_diff"
));
if
(
properties
.
getProperty
(
prefix
+
"max_zoom_diff"
)!=
null
)
this
.
max_zoom_diff
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"max_zoom_diff"
));
...
@@ -2641,6 +2647,7 @@ public class IntersceneMatchParameters {
...
@@ -2641,6 +2647,7 @@ public class IntersceneMatchParameters {
imp
.
fpn_ignore_border
=
this
.
fpn_ignore_border
;
imp
.
fpn_ignore_border
=
this
.
fpn_ignore_border
;
imp
.
min_offset
=
this
.
min_offset
;
imp
.
min_offset
=
this
.
min_offset
;
imp
.
max_pull_jump
=
this
.
max_pull_jump
;
imp
.
max_rel_offset
=
this
.
max_rel_offset
;
imp
.
max_rel_offset
=
this
.
max_rel_offset
;
imp
.
max_roll_deg
=
this
.
max_roll_deg
;
imp
.
max_roll_deg
=
this
.
max_roll_deg
;
imp
.
max_zoom_diff
=
this
.
max_zoom_diff
;
imp
.
max_zoom_diff
=
this
.
max_zoom_diff
;
...
...
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