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
decd04ed
Commit
decd04ed
authored
Mar 20, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Making intersceneLma produce same results regardless of threads
parent
f2cc84fd
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
785 additions
and
116 deletions
+785
-116
pom.xml
pom.xml
+8
-0
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+9
-0
IntersceneLma.java
...n/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
+225
-37
IntersceneLmaParameters.java
.../elphel/imagej/tileprocessor/IntersceneLmaParameters.java
+32
-2
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+509
-77
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+2
-0
No files found.
pom.xml
View file @
decd04ed
...
@@ -155,6 +155,14 @@
...
@@ -155,6 +155,14 @@
<artifactId>
ant-launcher
</artifactId>
<artifactId>
ant-launcher
</artifactId>
<version>
1.10.10
</version>
<version>
1.10.10
</version>
</dependency>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<dependency>
<groupId>
javax.xml.bind
</groupId>
<artifactId>
jaxb-api
</artifactId>
<version>
2.3.1
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
decd04ed
...
@@ -250,6 +250,15 @@ public class ErsCorrection extends GeometryCorrection {
...
@@ -250,6 +250,15 @@ public class ErsCorrection extends GeometryCorrection {
this
.
ers_wxyz_center_dt
=
ers_xyz_dt
;
this
.
ers_wxyz_center_dt
=
ers_xyz_dt
;
this
.
ers_watr_center_dt
=
ers_atr_dt
;
this
.
ers_watr_center_dt
=
ers_atr_dt
;
}
}
public
void
setErsDt_test
(
double
[]
ers_xyz_dt
,
double
[]
ers_atr_dt
)
{
double
k
=
1.0
;
// 0.5;
this
.
ers_wxyz_center_dt
=
new
double
[]
{-
ers_xyz_dt
[
0
],-
ers_xyz_dt
[
1
],-
ers_xyz_dt
[
2
]};
this
.
ers_watr_center_dt
=
new
double
[]
{
k
*
ers_atr_dt
[
0
],-
k
*
ers_atr_dt
[
1
],
k
*
ers_atr_dt
[
2
]};
//ers_atr_dt;
}
public
void
setErsD2t
(
public
void
setErsD2t
(
double
[]
ers_xyz_d2t
,
double
[]
ers_xyz_d2t
,
double
[]
ers_atr_d2t
)
{
double
[]
ers_atr_d2t
)
{
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLma.java
View file @
decd04ed
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/IntersceneLmaParameters.java
View file @
decd04ed
...
@@ -29,15 +29,19 @@ import java.util.Properties;
...
@@ -29,15 +29,19 @@ import java.util.Properties;
import
com.elphel.imagej.common.GenericJTabbedDialog
;
import
com.elphel.imagej.common.GenericJTabbedDialog
;
public
class
IntersceneLmaParameters
{
public
class
IntersceneLmaParameters
{
public
boolean
ilma_thread_invariant
=
true
;
// Do not use DoubleAdder, provide results not dependent on threads
public
boolean
[]
ilma_lma_select
=
new
boolean
[
ErsCorrection
.
DP_NUM_PARS
];
// first three will not be used
public
boolean
[]
ilma_lma_select
=
new
boolean
[
ErsCorrection
.
DP_NUM_PARS
];
// first three will not be used
public
double
[]
ilma_regularization_weights
=
new
double
[
ErsCorrection
.
DP_NUM_PARS
];
// first three will not be used
public
double
[]
ilma_regularization_weights
=
new
double
[
ErsCorrection
.
DP_NUM_PARS
];
// first three will not be used
public
double
ilma_lambda
=
0.1
;
public
boolean
ilma_ignore_ers
=
false
;
// ignore linear and angular velocities, assume tham zeroes
public
boolean
ilma_ers_adj_lin
=
false
;
// adjust linear ERS for scene-to-ref (LWIR does not work, check with high-speed)
public
boolean
ilma_ers_adj_ang
=
false
;
// adjust angular ERS for scene-to-ref (LWIR does not work, check with high-speed)
public
double
ilma_lambda
=
0.1
;
public
double
ilma_lambda_scale_good
=
0.5
;
public
double
ilma_lambda_scale_good
=
0.5
;
public
double
ilma_lambda_scale_bad
=
8.0
;
public
double
ilma_lambda_scale_bad
=
8.0
;
public
double
ilma_lambda_max
=
100
;
public
double
ilma_lambda_max
=
100
;
public
double
ilma_rms_diff
=
0.001
;
public
double
ilma_rms_diff
=
0.001
;
public
int
ilma_num_iter
=
20
;
public
int
ilma_num_iter
=
20
;
public
int
ilma_num_corr
=
10
;
// maximal number of full correlatio
b
n+LMA cycles
public
int
ilma_num_corr
=
10
;
// maximal number of full correlation+LMA cycles
public
int
ilma_debug_level
=
1
;
public
int
ilma_debug_level
=
1
;
public
IntersceneLmaParameters
()
{
public
IntersceneLmaParameters
()
{
...
@@ -94,6 +98,8 @@ public class IntersceneLmaParameters {
...
@@ -94,6 +98,8 @@ public class IntersceneLmaParameters {
public
void
dialogQuestions
(
GenericJTabbedDialog
gd
)
{
public
void
dialogQuestions
(
GenericJTabbedDialog
gd
)
{
gd
.
addMessage
(
"Interframe LMA parameters selection"
);
gd
.
addMessage
(
"Interframe LMA parameters selection"
);
gd
.
addCheckbox
(
"Thread-invariant execution"
,
this
.
ilma_thread_invariant
,
"Do not use DoubleAdder and provide results not dependent on threads"
);
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
gd
.
addCheckbox
(
ErsCorrection
.
DP_DERIV_NAMES
[
i
],
this
.
ilma_lma_select
[
i
],
gd
.
addCheckbox
(
ErsCorrection
.
DP_DERIV_NAMES
[
i
],
this
.
ilma_lma_select
[
i
],
"Adjust parameter "
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
" with interscene LMA"
);
"Adjust parameter "
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
" with interscene LMA"
);
...
@@ -105,6 +111,14 @@ public class IntersceneLmaParameters {
...
@@ -105,6 +111,14 @@ public class IntersceneLmaParameters {
" will cause error equal to all reprojection ones"
);
" will cause error equal to all reprojection ones"
);
}
}
gd
.
addMessage
(
"LMA other parameters"
);
gd
.
addMessage
(
"LMA other parameters"
);
gd
.
addCheckbox
(
"Ignore linear and angular velocities"
,
this
.
ilma_ignore_ers
,
"Ignore calculated linear and angular velocities when correlating scenes to the reference one"
);
gd
.
addCheckbox
(
"Adjust linear ERS for scene-to-ref"
,
this
.
ilma_ers_adj_lin
,
"Adjust linear velocities during LMA for scene-to-reference matching. So far does not work for LWIR (not stable - effect is samll)"
);
gd
.
addCheckbox
(
"Aadjust angular ERS for scene-to-ref"
,
this
.
ilma_ers_adj_ang
,
"Adjust angular velocities during LMA for scene-to-reference matching. So far does not work for LWIR (not stable - effect is samll)"
);
gd
.
addNumericField
(
"LMA lambda"
,
this
.
ilma_lambda
,
6
,
8
,
""
,
gd
.
addNumericField
(
"LMA lambda"
,
this
.
ilma_lambda
,
6
,
8
,
""
,
"Initial value of the LMA lambda"
);
"Initial value of the LMA lambda"
);
gd
.
addNumericField
(
"Scale lambda after successful LMA iteration"
,
this
.
ilma_lambda_scale_good
,
3
,
5
,
""
,
gd
.
addNumericField
(
"Scale lambda after successful LMA iteration"
,
this
.
ilma_lambda_scale_good
,
3
,
5
,
""
,
...
@@ -125,12 +139,16 @@ public class IntersceneLmaParameters {
...
@@ -125,12 +139,16 @@ public class IntersceneLmaParameters {
"Debug level of interscene LMA operation."
);
"Debug level of interscene LMA operation."
);
}
}
public
void
dialogAnswers
(
GenericJTabbedDialog
gd
)
{
public
void
dialogAnswers
(
GenericJTabbedDialog
gd
)
{
this
.
ilma_thread_invariant
=
gd
.
getNextBoolean
();
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
this
.
ilma_lma_select
[
i
]
=
gd
.
getNextBoolean
();
this
.
ilma_lma_select
[
i
]
=
gd
.
getNextBoolean
();
}
}
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
this
.
ilma_regularization_weights
[
i
]
=
gd
.
getNextNumber
();
this
.
ilma_regularization_weights
[
i
]
=
gd
.
getNextNumber
();
}
}
this
.
ilma_ignore_ers
=
gd
.
getNextBoolean
();
this
.
ilma_ers_adj_lin
=
gd
.
getNextBoolean
();
this
.
ilma_ers_adj_ang
=
gd
.
getNextBoolean
();
this
.
ilma_lambda
=
gd
.
getNextNumber
();
this
.
ilma_lambda
=
gd
.
getNextNumber
();
this
.
ilma_lambda_scale_good
=
gd
.
getNextNumber
();
this
.
ilma_lambda_scale_good
=
gd
.
getNextNumber
();
this
.
ilma_lambda_scale_bad
=
gd
.
getNextNumber
();
this
.
ilma_lambda_scale_bad
=
gd
.
getNextNumber
();
...
@@ -141,10 +159,14 @@ public class IntersceneLmaParameters {
...
@@ -141,10 +159,14 @@ public class IntersceneLmaParameters {
this
.
ilma_debug_level
=
(
int
)
gd
.
getNextNumber
();
this
.
ilma_debug_level
=
(
int
)
gd
.
getNextNumber
();
}
}
public
void
setProperties
(
String
prefix
,
Properties
properties
){
public
void
setProperties
(
String
prefix
,
Properties
properties
){
properties
.
setProperty
(
prefix
+
"ilma_thread_invariant"
,
this
.
ilma_thread_invariant
+
""
);
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
properties
.
setProperty
(
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_sel"
,
this
.
ilma_lma_select
[
i
]+
""
);
properties
.
setProperty
(
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_sel"
,
this
.
ilma_lma_select
[
i
]+
""
);
properties
.
setProperty
(
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_regweight"
,
this
.
ilma_regularization_weights
[
i
]+
""
);
properties
.
setProperty
(
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_regweight"
,
this
.
ilma_regularization_weights
[
i
]+
""
);
}
}
properties
.
setProperty
(
prefix
+
"ilma_ignore_ers"
,
this
.
ilma_ignore_ers
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_ers_adj_lin"
,
this
.
ilma_ers_adj_lin
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_ers_adj_ang"
,
this
.
ilma_ers_adj_ang
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda"
,
this
.
ilma_lambda
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda"
,
this
.
ilma_lambda
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_scale_good"
,
this
.
ilma_lambda_scale_good
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_scale_good"
,
this
.
ilma_lambda_scale_good
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_scale_bad"
,
this
.
ilma_lambda_scale_bad
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_lambda_scale_bad"
,
this
.
ilma_lambda_scale_bad
+
""
);
...
@@ -155,6 +177,7 @@ public class IntersceneLmaParameters {
...
@@ -155,6 +177,7 @@ public class IntersceneLmaParameters {
properties
.
setProperty
(
prefix
+
"ilma_debug_level"
,
this
.
ilma_debug_level
+
""
);
properties
.
setProperty
(
prefix
+
"ilma_debug_level"
,
this
.
ilma_debug_level
+
""
);
}
}
public
void
getProperties
(
String
prefix
,
Properties
properties
){
public
void
getProperties
(
String
prefix
,
Properties
properties
){
if
(
properties
.
getProperty
(
prefix
+
"ilma_thread_invariant"
)!=
null
)
this
.
ilma_thread_invariant
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_thread_invariant"
));
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
for
(
int
i
=
ErsCorrection
.
DP_DVAZ
;
i
<
ErsCorrection
.
DP_NUM_PARS
;
i
++)
{
String
pn_sel
=
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_sel"
;
String
pn_sel
=
prefix
+
ErsCorrection
.
DP_DERIV_NAMES
[
i
]+
"_sel"
;
if
(
properties
.
getProperty
(
pn_sel
)!=
null
)
this
.
ilma_lma_select
[
i
]=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
pn_sel
));
if
(
properties
.
getProperty
(
pn_sel
)!=
null
)
this
.
ilma_lma_select
[
i
]=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
pn_sel
));
...
@@ -162,6 +185,9 @@ public class IntersceneLmaParameters {
...
@@ -162,6 +185,9 @@ public class IntersceneLmaParameters {
if
(
properties
.
getProperty
(
pn_sel
)!=
null
)
this
.
ilma_regularization_weights
[
i
]=
Double
.
parseDouble
(
properties
.
getProperty
(
pn_sel
));
if
(
properties
.
getProperty
(
pn_sel
)!=
null
)
this
.
ilma_regularization_weights
[
i
]=
Double
.
parseDouble
(
properties
.
getProperty
(
pn_sel
));
}
}
if
(
properties
.
getProperty
(
prefix
+
"ilma_ignore_ers"
)!=
null
)
this
.
ilma_ignore_ers
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ignore_ers"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_lin"
)!=
null
)
this
.
ilma_ers_adj_lin
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_lin"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_ang"
)!=
null
)
this
.
ilma_ers_adj_ang
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"ilma_ers_adj_ang"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda"
)!=
null
)
this
.
ilma_lambda
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda"
)!=
null
)
this
.
ilma_lambda
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_good"
)!=
null
)
this
.
ilma_lambda_scale_good
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_good"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_good"
)!=
null
)
this
.
ilma_lambda_scale_good
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_good"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_bad"
)!=
null
)
this
.
ilma_lambda_scale_bad
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_bad"
));
if
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_bad"
)!=
null
)
this
.
ilma_lambda_scale_bad
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"ilma_lambda_scale_bad"
));
...
@@ -175,8 +201,12 @@ public class IntersceneLmaParameters {
...
@@ -175,8 +201,12 @@ public class IntersceneLmaParameters {
@Override
@Override
public
IntersceneLmaParameters
clone
()
throws
CloneNotSupportedException
{
public
IntersceneLmaParameters
clone
()
throws
CloneNotSupportedException
{
IntersceneLmaParameters
ilp
=
new
IntersceneLmaParameters
();
IntersceneLmaParameters
ilp
=
new
IntersceneLmaParameters
();
ilp
.
ilma_thread_invariant
=
this
.
ilma_thread_invariant
;
System
.
arraycopy
(
this
.
ilma_lma_select
,
0
,
ilp
.
ilma_lma_select
,
0
,
ilma_lma_select
.
length
);
System
.
arraycopy
(
this
.
ilma_lma_select
,
0
,
ilp
.
ilma_lma_select
,
0
,
ilma_lma_select
.
length
);
System
.
arraycopy
(
this
.
ilma_regularization_weights
,
0
,
ilp
.
ilma_regularization_weights
,
0
,
ilma_regularization_weights
.
length
);
System
.
arraycopy
(
this
.
ilma_regularization_weights
,
0
,
ilp
.
ilma_regularization_weights
,
0
,
ilma_regularization_weights
.
length
);
ilp
.
ilma_ignore_ers
=
this
.
ilma_ignore_ers
;
ilp
.
ilma_ers_adj_lin
=
this
.
ilma_ers_adj_lin
;
ilp
.
ilma_ers_adj_ang
=
this
.
ilma_ers_adj_ang
;
ilp
.
ilma_lambda
=
this
.
ilma_lambda
;
ilp
.
ilma_lambda
=
this
.
ilma_lambda
;
ilp
.
ilma_lambda_scale_good
=
this
.
ilma_lambda_scale_good
;
ilp
.
ilma_lambda_scale_good
=
this
.
ilma_lambda_scale_good
;
ilp
.
ilma_lambda_scale_bad
=
this
.
ilma_lambda_scale_bad
;
ilp
.
ilma_lambda_scale_bad
=
this
.
ilma_lambda_scale_bad
;
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
decd04ed
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
decd04ed
...
@@ -8310,6 +8310,8 @@ if (debugLevel > -100) return true; // temporarily !
...
@@ -8310,6 +8310,8 @@ if (debugLevel > -100) return true; // temporarily !
pose
[
1
],
// atr
pose
[
1
],
// atr
clt_parameters
.
ilp
.
ilma_lma_select
,
// final boolean[] param_select,
clt_parameters
.
ilp
.
ilma_lma_select
,
// final boolean[] param_select,
clt_parameters
.
ilp
.
ilma_regularization_weights
,
// final double [] param_regweights,
clt_parameters
.
ilp
.
ilma_regularization_weights
,
// final double [] param_regweights,
null
,
// double [] rms, // null or double [2]
null
,
// double [][] dbg_img,
clt_parameters
.
ofp
.
debug_level_optical
);
// 1); // -1); // int debug_level);
clt_parameters
.
ofp
.
debug_level_optical
);
// 1); // -1); // int debug_level);
}
}
...
...
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