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
f468c5ba
Commit
f468c5ba
authored
Apr 15, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed incorrect combining of the affine transformation and the
LMA-calculated correction.
parent
c48eb737
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
8 deletions
+50
-8
ComboMatch.java
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
+1
-1
OrthoMap.java
src/main/java/com/elphel/imagej/orthomosaic/OrthoMap.java
+1
-3
OrthoMapsCollection.java
...va/com/elphel/imagej/orthomosaic/OrthoMapsCollection.java
+6
-3
OrthoPairLMA.java
...main/java/com/elphel/imagej/orthomosaic/OrthoPairLMA.java
+42
-1
No files found.
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
View file @
f468c5ba
...
...
@@ -1053,7 +1053,7 @@ public class ComboMatch {
double
maximal_rms
=
0.25
;
//
int
min_overlap
=
3000
;
// do not try to match if there is too small overlap (scaled pixels)
int
num_iter_lma
=
5
;
GenericJTabbedDialog
gd
=
new
GenericJTabbedDialog
(
"Setup SpiralMatch"
,
1200
,
9
00
);
GenericJTabbedDialog
gd
=
new
GenericJTabbedDialog
(
"Setup SpiralMatch"
,
1200
,
3
00
);
if
(
pairwiseOrthoMatch
!=
null
)
{
gd
.
addCheckbox
(
"Use existing image pair"
,
use_exixting_pair
,
"Use existing affine settings for this pair, do not use spiral search."
);
}
...
...
src/main/java/com/elphel/imagej/orthomosaic/OrthoMap.java
View file @
f468c5ba
...
...
@@ -3016,14 +3016,12 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
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
(
B
1
).
plus
(
B2
);
Matrix
B
=
A2
.
times
(
B
2
).
plus
(
B1
);
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
;
}
/**
* Get planar approximation of the ground
...
...
src/main/java/com/elphel/imagej/orthomosaic/OrthoMapsCollection.java
View file @
f468c5ba
...
...
@@ -1132,6 +1132,7 @@ public class OrthoMapsCollection implements Serializable{
boolean
show_vf
,
double
[][]
ground_planes
,
// null or double[2] - will return ground planes:
int
debugLevel
){
boolean
show_lma_dbg
=
!
batch_mode
&&
(
debugLevel
>
1
);
if
(
woi
==
null
)
{
woi
=
new
Rectangle
();
}
...
...
@@ -1491,7 +1492,8 @@ public class OrthoMapsCollection implements Serializable{
boolean
last_run
=
false
;
int
min_good_tiles
=
min_tiles_overlap
/
2
;
// show_lma_dbg
String
dbg_lma_prefix
=
show_lma_dbg
?
(
"LMA_"
+
gpu_pair
[
0
]+
"-"
+
gpu_pair
[
1
]+
"_ntry"
+
ntry
+
"_"
):
null
;
int
num_good_tiles
=
orthoPairLMA
.
prepareLMA
(
// will always calculate relative affine, starting with unity
...
...
@@ -1532,7 +1534,8 @@ public class OrthoMapsCollection implements Serializable{
rms_diff
,
// double rms_diff, // 0.001
num_iter
,
// int num_iter, // 20
last_run
,
// boolean last_run,
debugLevel
);
// int debug_level)
dbg_lma_prefix
,
// String dbg_prefix,
debugLevel
);
// int debug_level)
if
(
debugLevel
>
-
3
)
{
System
.
out
.
println
(
"LMA result = "
+
lma_rslt
);
}
...
...
@@ -3714,7 +3717,7 @@ public class OrthoMapsCollection implements Serializable{
lines
[
indx
]=
String
.
format
(
"%3d %17s %26s %6.2f"
,
indx
,
name
,
sdt
,
agl
);
}
GenericJTabbedDialog
gd
=
new
GenericJTabbedDialog
(
"Select the "
+
fs
[
num_scene
]+
" image from the list "
,
1200
,
100
0
);
GenericJTabbedDialog
gd
=
new
GenericJTabbedDialog
(
"Select the "
+
fs
[
num_scene
]+
" image from the list "
,
1200
,
100
);
gd
.
addChoice
(
fs
[
num_scene
]+
" image:"
,
lines
,
lines
[
default_choice
],
...
...
src/main/java/com/elphel/imagej/orthomosaic/OrthoPairLMA.java
View file @
f468c5ba
...
...
@@ -29,6 +29,7 @@ package com.elphel.imagej.orthomosaic;
import
java.awt.Rectangle
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
com.elphel.imagej.common.ShowDoubleFloatArrays
;
import
com.elphel.imagej.gpu.GPUTileProcessor
;
import
com.elphel.imagej.tileprocessor.ImageDtt
;
import
com.elphel.imagej.tileprocessor.QuadCLT
;
...
...
@@ -62,6 +63,38 @@ public class OrthoPairLMA {
public
double
getCenterRadius
()
{
return
center_radius
;
}
public
void
debugStateImage
(
String
title
)
{
String
[]
titles
=
{
"Yhor"
,
"Yvert"
,
"fXhor"
,
"fXvert"
,
"Dhor"
,
"Dvert"
,
"DWhor"
,
"DWvert"
,
"Whor"
,
"Wvert"
};
double
[][]
dbg_img
=
new
double
[
titles
.
length
][
N
];
double
[]
fx
=
getFxDerivs
(
parameters_vector
,
// double [] vector,
null
,
// final double [][] jt, // should be null or initialized with [vector.length][]
0
);
// debug_level); // final int debug_level)
for
(
int
i
=
0
;
i
<
N
;
i
++)
{
dbg_img
[
0
][
i
]
=
y_vector
[
2
*
i
+
0
];
dbg_img
[
1
][
i
]
=
y_vector
[
2
*
i
+
1
];
dbg_img
[
2
][
i
]
=
fx
[
2
*
i
+
0
];
dbg_img
[
3
][
i
]
=
fx
[
2
*
i
+
1
];
dbg_img
[
4
][
i
]
=
y_vector
[
2
*
i
+
0
]-
fx
[
2
*
i
+
0
];
dbg_img
[
5
][
i
]
=
y_vector
[
2
*
i
+
1
]-
fx
[
2
*
i
+
1
];
if
(
last_ymfx
!=
null
)
{
dbg_img
[
6
][
i
]
=
last_ymfx
[
2
*
i
+
0
];
dbg_img
[
7
][
i
]
=
last_ymfx
[
2
*
i
+
1
];
}
dbg_img
[
8
][
i
]
=
weights
[
2
*
i
+
0
];
dbg_img
[
9
][
i
]
=
weights
[
2
*
i
+
1
];
}
ShowDoubleFloatArrays
.
showArrays
(
dbg_img
,
woi
.
width
,
woi
.
height
,
true
,
title
,
titles
);
}
public
int
prepareLMA
(
// will always calculate relative affine, starting with unity
int
width
,
// tilesX
...
...
@@ -397,16 +430,24 @@ public class OrthoPairLMA {
double
rms_diff
,
// 0.001
int
num_iter
,
// 20
boolean
last_run
,
String
dbg_prefix
,
int
debug_level
)
{
boolean
[]
rslt
=
{
false
,
false
};
this
.
last_rms
=
null
;
// remove?
int
iter
=
0
;
if
(
dbg_prefix
!=
null
)
{
debugStateImage
(
dbg_prefix
+
"-initial"
);
}
for
(
iter
=
0
;
iter
<
num_iter
;
iter
++)
{
rslt
=
lmaStep
(
lambda
,
rms_diff
,
debug_level
);
if
(
dbg_prefix
!=
null
)
{
debugStateImage
(
dbg_prefix
+
"-step_"
+
iter
);
}
if
(
rslt
==
null
)
{
return
-
1
;
// false; // need to check
}
...
...
@@ -676,7 +717,7 @@ public class OrthoPairLMA {
public
void
run
()
{
for
(
int
iTile
=
ai
.
getAndIncrement
();
iTile
<
N
;
iTile
=
ai
.
getAndIncrement
())
if
(
tile_centers
[
iTile
]
!=
null
)
{
double
x
=
tile_centers
[
iTile
][
0
]
-
origin
[
0
];
double
y
=
tile_centers
[
iTile
][
1
]
-
origin
[
0
];
double
y
=
tile_centers
[
iTile
][
1
]
-
origin
[
1
];
double
vx
=
(
vector
[
0
]
-
1.0
)
*
x
+
vector
[
1
]
*
y
+
vector
[
4
];
double
vy
=
vector
[
2
]
*
x
+
(
vector
[
3
]
-
1.0
)
*
y
+
vector
[
5
];
fx
[
2
*
iTile
+
0
]
=
vx
;
...
...
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