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
b3e9f364
Commit
b3e9f364
authored
Feb 19, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tested LMA converging
parent
c3fb4172
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
139 additions
and
69 deletions
+139
-69
OrthoMap.java
src/main/java/com/elphel/imagej/orthomosaic/OrthoMap.java
+17
-0
OrthoMapsCollection.java
...va/com/elphel/imagej/orthomosaic/OrthoMapsCollection.java
+98
-69
OrthoPairLMA.java
...main/java/com/elphel/imagej/orthomosaic/OrthoPairLMA.java
+24
-0
No files found.
src/main/java/com/elphel/imagej/orthomosaic/OrthoMap.java
View file @
b3e9f364
...
@@ -861,4 +861,21 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
...
@@ -861,4 +861,21 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
}
}
return
true
;
return
true
;
}
}
public
static
double
[][]
combineAffine
(
double
[][]
ref_affine
,
double
[][]
other_affine
){
Matrix
m_ref
=
new
Matrix
(
ref_affine
);
Matrix
m_other
=
new
Matrix
(
other_affine
);
Matrix
A1
=
m_ref
.
getMatrix
(
0
,
1
,
0
,
1
);
Matrix
A2
=
m_other
.
getMatrix
(
0
,
1
,
0
,
1
);
Matrix
B1
=
m_ref
.
getMatrix
(
0
,
1
,
2
,
2
);
Matrix
B2
=
m_other
.
getMatrix
(
0
,
1
,
2
,
2
);
Matrix
A
=
A2
.
times
(
A1
);
Matrix
B
=
A2
.
times
(
B1
).
plus
(
B2
);
double
[][]
affine
=
{
{
A
.
get
(
0
,
0
),
A
.
get
(
0
,
1
),
B
.
get
(
0
,
0
)},
{
A
.
get
(
1
,
0
),
A
.
get
(
1
,
1
),
B
.
get
(
1
,
0
)}};
return
affine
;
}
}
}
src/main/java/com/elphel/imagej/orthomosaic/OrthoMapsCollection.java
View file @
b3e9f364
...
@@ -533,6 +533,10 @@ public class OrthoMapsCollection implements Serializable{
...
@@ -533,6 +533,10 @@ public class OrthoMapsCollection implements Serializable{
// uses fixed_size gpu image size
// uses fixed_size gpu image size
// TDCorrTile [] td_corr_tiles =
// TDCorrTile [] td_corr_tiles =
TpTask
[][]
tp_tasks
=
new
TpTask
[
2
][];
TpTask
[][]
tp_tasks
=
new
TpTask
[
2
][];
int
num_tries
=
5
;
double
prev_rms
=
Double
.
NaN
;
double
rel_improve
=
1
E
-
3
;
for
(
int
ntry
=
0
;
ntry
<
num_tries
;
ntry
++)
{
double
[][][]
vector_field
=
double
[][][]
vector_field
=
ComboMatch
.
rectilinearVectorField
(
//rectilinearCorrelate_TD( // scene0/scene1
ComboMatch
.
rectilinearVectorField
(
//rectilinearCorrelate_TD( // scene0/scene1
clt_parameters
,
// final CLTParameters clt_parameters,
clt_parameters
,
// final CLTParameters clt_parameters,
...
@@ -601,7 +605,32 @@ public class OrthoMapsCollection implements Serializable{
...
@@ -601,7 +605,32 @@ public class OrthoMapsCollection implements Serializable{
num_iter
,
// int num_iter, // 20
num_iter
,
// int num_iter, // 20
last_run
,
// boolean last_run,
last_run
,
// boolean last_run,
debugLevel
);
// int debug_level)
debugLevel
);
// int debug_level)
if
(
debugLevel
>
-
1
)
{
System
.
out
.
println
(
"LMA result = "
+
lma_rslt
);
System
.
out
.
println
(
"LMA result = "
+
lma_rslt
);
}
if
(
lma_rslt
<
0
)
{
System
.
out
.
println
(
"LMA failed, result="
+
lma_rslt
);
return
null
;
}
double
rms
=
orthoPairLMA
.
getRms
();
if
(
rms
>
prev_rms
)
{
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"LMA RMSE worsened: new"
+
rms
+
" ("
+
orthoPairLMA
.
getInitialRms
()+
"), prev="
+
prev_rms
);
}
break
;
}
affines_gpu
[
1
]=
OrthoMap
.
combineAffine
(
affines_gpu
[
1
],
orthoPairLMA
.
getAffine
());
double
[][]
jtj
=
orthoPairLMA
.
getLastJtJ
();
if
((
prev_rms
-
rms
)/
prev_rms
<
rel_improve
)
{
if
(
debugLevel
>
-
2
)
{
System
.
out
.
println
(
"LMA relative RMSE improvement = "
+((
prev_rms
-
rms
)/
prev_rms
)+
" < "
+
rel_improve
+
", exiting."
);
}
break
;
}
prev_rms
=
rms
;
}
// for (int ntry = 0; ntry < num_tries; ntry++) {
// analyze result, re-run correlation
// analyze result, re-run correlation
/*
/*
...
@@ -637,7 +666,7 @@ public class OrthoMapsCollection implements Serializable{
...
@@ -637,7 +666,7 @@ public class OrthoMapsCollection implements Serializable{
}
}
*/
*/
if
(
debugLevel
>
1
)
{
if
(
debugLevel
>
1
)
{
// show result here
String
[]
map_names
=
{
ortho_maps
[
gpu_pair
[
0
]].
getName
(),
ortho_maps
[
gpu_pair
[
1
]].
getName
()};
String
[]
map_names
=
{
ortho_maps
[
gpu_pair
[
0
]].
getName
(),
ortho_maps
[
gpu_pair
[
1
]].
getName
()};
ShowDoubleFloatArrays
.
showArrays
(
ShowDoubleFloatArrays
.
showArrays
(
gpu_pair_img
,
gpu_pair_img
,
...
...
src/main/java/com/elphel/imagej/orthomosaic/OrthoPairLMA.java
View file @
b3e9f364
...
@@ -99,6 +99,30 @@ public class OrthoPairLMA {
...
@@ -99,6 +99,30 @@ public class OrthoPairLMA {
}
}
public
double
[][]
getAffine
(){
return
new
double
[][]
{
{
parameters_vector
[
0
],
parameters_vector
[
1
],
parameters_vector
[
4
]},
{
parameters_vector
[
2
],
parameters_vector
[
3
],
parameters_vector
[
5
]}};
}
public
double
getRms
()
{
return
last_rms
[
0
];
}
public
double
getInitialRms
()
{
return
initial_rms
[
0
];
}
public
double
getWeight
()
{
return
weight
;
}
public
double
[][]
getLastJtJ
(){
return
getWJtJlambda
(
0.0
,
// lambda, // *10, // temporary
this
.
last_jt
);
}
//getWJtJlambda(
// lambda, // *10, // temporary
// this.last_jt)
private
void
setSamplesWeightsYCenters
(
private
void
setSamplesWeightsYCenters
(
final
double
[][]
vector_XYS
,
final
double
[][]
vector_XYS
,
final
double
[]
weights_extra
,
// null or additional weights (such as elevation-based)
final
double
[]
weights_extra
,
// null or additional weights (such as elevation-based)
...
...
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