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
5e03168f
Commit
5e03168f
authored
Apr 14, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed affine inversion
parent
0da53711
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
375 additions
and
34 deletions
+375
-34
ComboMatch.java
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
+158
-15
OrthoMap.java
src/main/java/com/elphel/imagej/orthomosaic/OrthoMap.java
+2
-0
OrthoMapsCollection.java
...va/com/elphel/imagej/orthomosaic/OrthoMapsCollection.java
+163
-14
OrthoPairLMA.java
...main/java/com/elphel/imagej/orthomosaic/OrthoPairLMA.java
+11
-2
PairwiseOrthoMatch.java
...ava/com/elphel/imagej/orthomosaic/PairwiseOrthoMatch.java
+31
-1
IntersceneMatchParameters.java
...lphel/imagej/tileprocessor/IntersceneMatchParameters.java
+10
-2
No files found.
src/main/java/com/elphel/imagej/orthomosaic/ComboMatch.java
View file @
5e03168f
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/orthomosaic/OrthoMap.java
View file @
5e03168f
...
...
@@ -3005,6 +3005,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
}
return
true
;
}
public
static
double
[][]
combineAffine
(
double
[][]
ref_affine
,
double
[][]
other_affine
){
...
...
@@ -3023,6 +3024,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
}
/**
* Get planar approximation of the ground
*
...
...
src/main/java/com/elphel/imagej/orthomosaic/OrthoMapsCollection.java
View file @
5e03168f
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/orthomosaic/OrthoPairLMA.java
View file @
5e03168f
...
...
@@ -54,21 +54,26 @@ public class OrthoPairLMA {
private
double
[][]
last_jt
=
null
;
private
boolean
origin_center
=
false
;
// true - origin in overlap center, false - top left corner (as it was)
private
double
[]
origin
=
null
;
// either {0,0} for top-left or center of the woi
public
int
num_good_tiles
=
0
;
public
OrthoPairLMA
(
boolean
origin_center
)
{
this
.
origin_center
=
origin_center
;
}
public
void
prepareLMA
(
public
int
prepareLMA
(
// will always calculate relative affine, starting with unity
int
width
,
// tilesX
double
[][]
vector_XYS
,
// optical flow X,Y, confidence obtained from the correlate2DIterate()
double
[][]
centers
,
// tile centers (in pixels)
double
[]
weights_extra
,
// optional, may be null
boolean
first_run
,
int
min_good_tiles
,
double
max_std
,
// maximal standard deviation to limit center area
double
min_std_rad
,
// minimal radius of the central area (if less - fail)
final
int
debug_level
)
{
tile_centers
=
centers
;
this
.
width
=
width
;
int
height
=
vector_XYS
.
length
/
width
;
int
min_x
=
width
,
min_y
=
height
,
max_x
=
-
1
,
max_y
=-
1
;
num_good_tiles
=
0
;
for
(
int
tile
=
0
;
tile
<
vector_XYS
.
length
;
tile
++)
if
((
vector_XYS
[
tile
]
!=
null
))
{
int
tileX
=
tile
%
width
;
int
tileY
=
tile
/
width
;
...
...
@@ -76,8 +81,12 @@ public class OrthoPairLMA {
if
(
tileX
>
max_x
)
max_x
=
tileX
;
if
(
tileY
<
min_y
)
min_y
=
tileY
;
if
(
tileY
>
max_y
)
max_y
=
tileY
;
num_good_tiles
++;
}
woi
=
new
Rectangle
(
min_x
,
min_y
,
max_x
-
min_x
+
1
,
max_y
-
min_y
+
1
);
if
(
num_good_tiles
<
min_good_tiles
)
{
return
num_good_tiles
;
}
origin
=
new
double
[
2
];
if
(
origin_center
)
{
origin
=
new
double
[]
{
...
...
@@ -98,7 +107,7 @@ public class OrthoPairLMA {
last_rms
=
new
double
[
2
];
initial_rms
=
last_rms
.
clone
();
good_or_bad_rms
=
this
.
last_rms
.
clone
();
return
num_good_tiles
;
}
public
double
[][]
getAffine
(){
...
...
src/main/java/com/elphel/imagej/orthomosaic/PairwiseOrthoMatch.java
View file @
5e03168f
...
...
@@ -14,10 +14,40 @@ public class PairwiseOrthoMatch implements Serializable {
public
PairwiseOrthoMatch
()
{
}
public
PairwiseOrthoMatch
(
double
[][]
affine
,
double
[][]
jtj
,
double
rms
,
int
zoom_lev
)
{
public
PairwiseOrthoMatch
(
double
[][]
affine
,
double
[][]
jtj
,
double
rms
,
int
zoom_lev
)
{
this
.
affine
=
affine
;
this
.
jtj
=
jtj
;
this
.
zoom_lev
=
zoom_lev
;
}
public
PairwiseOrthoMatch
getInverse
(
double
[]
rd
)
{
double
[][]
affine
=
OrthoMap
.
invertAffine
(
getAffine
());
PairwiseOrthoMatch
inverted_match
=
new
PairwiseOrthoMatch
(
affine
,
// double [][] affine,
null
,
// double [][] jtj,
rms
,
// double rms,
zoom_lev
);
// int zoom_lev)
double
[]
corr
=
{
rd
[
0
]
*
(
affine
[
0
][
0
]-
1.0
)+
rd
[
1
]*
affine
[
0
][
1
],
rd
[
0
]
*
affine
[
1
][
0
]+
rd
[
1
]*(
affine
[
1
][
1
]-
1.0
)};
affine
[
0
][
2
]
+=
corr
[
0
];
affine
[
1
][
2
]
+=
corr
[
1
];
return
inverted_match
;
}
public
PairwiseOrthoMatch
getInverse
()
{
PairwiseOrthoMatch
inverted_match
=
new
PairwiseOrthoMatch
(
OrthoMap
.
invertAffine
(
getAffine
()),
// double [][] affine,
null
,
// double [][] jtj,
rms
,
// double rms,
zoom_lev
);
// int zoom_lev)
return
inverted_match
;
}
public
double
[][]
getAffine
(){
return
affine
;
}
...
...
src/main/java/com/elphel/imagej/tileprocessor/IntersceneMatchParameters.java
View file @
5e03168f
...
...
@@ -100,11 +100,12 @@ public class IntersceneMatchParameters {
public
double
rln_fat_zero
=
10000.0
;
// phase correlation fat zero
public
boolean
rln_use_neibs
=
true
;
// calculate TD neighbors in phase correlation
public
boolean
rln_neibs_fill
=
false
;
// fill empty neighbors centers
public
double
rln_neib_radius
=
2.9
;
// neighbors radius (tiles)
public
double
rln_neib_radius
=
5.9
;
// neighbors radius (tiles)
public
double
rln_radius_frac
=
0.1
;
// rln_neib_radius not less than this fraction of woi width/height
public
double
rln_cent_radius
=
4.0
;
// centroids center radius
public
int
rln_n_recenter
=
2
;
// when cosine window, re-center window these many times
public
double
rln_sngl_rstr
=
0.3
;
// minimal single-tile phase correlation maximums relative to max str
public
double
rln_neib_rstr
=
0.
5
;
// minimal neighbors phase correlation maximums relative to max str
public
double
rln_neib_rstr
=
0.
4
;
// minimal neighbors phase correlation maximums relative to max str
public
double
[]
getImsMountATR
()
{
return
new
double
[]
{
...
...
@@ -683,6 +684,8 @@ public class IntersceneMatchParameters {
"Fill empty neighbors centers (false - only non-empty)."
);
gd
.
addNumericField
(
"Neighbors radius"
,
this
.
rln_neib_radius
,
5
,
8
,
"tiles"
,
"Use these tiles around the center one."
);
gd
.
addNumericField
(
"Neighbors radius fraction woi"
,
this
.
rln_radius_frac
,
5
,
8
,
""
,
"Naighbors radius not less than this fraction of tiles WOI."
);
gd
.
addNumericField
(
"Centroids radius"
,
this
.
rln_cent_radius
,
5
,
8
,
""
,
"Centroids radius for maximums isolation."
);
gd
.
addNumericField
(
"Recenter centroid"
,
this
.
rln_n_recenter
,
0
,
3
,
""
,
...
...
@@ -1526,6 +1529,7 @@ public class IntersceneMatchParameters {
this
.
rln_use_neibs
=
gd
.
getNextBoolean
();
this
.
rln_neibs_fill
=
gd
.
getNextBoolean
();
this
.
rln_neib_radius
=
gd
.
getNextNumber
();
this
.
rln_radius_frac
=
gd
.
getNextNumber
();
this
.
rln_cent_radius
=
gd
.
getNextNumber
();
this
.
rln_n_recenter
=
(
int
)
gd
.
getNextNumber
();
this
.
rln_sngl_rstr
=
gd
.
getNextNumber
();
...
...
@@ -1986,6 +1990,7 @@ public class IntersceneMatchParameters {
properties
.
setProperty
(
prefix
+
"rln_use_neibs"
,
this
.
rln_use_neibs
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"rln_neibs_fill"
,
this
.
rln_neibs_fill
+
""
);
// boolean
properties
.
setProperty
(
prefix
+
"rln_neib_radius"
,
this
.
rln_neib_radius
+
""
);
// double
properties
.
setProperty
(
prefix
+
"rln_radius_frac"
,
this
.
rln_radius_frac
+
""
);
// double
properties
.
setProperty
(
prefix
+
"rln_cent_radius"
,
this
.
rln_cent_radius
+
""
);
// double
properties
.
setProperty
(
prefix
+
"rln_n_recenter"
,
this
.
rln_n_recenter
+
""
);
// int
properties
.
setProperty
(
prefix
+
"rln_sngl_rstr"
,
this
.
rln_sngl_rstr
+
""
);
// double
...
...
@@ -2409,6 +2414,7 @@ public class IntersceneMatchParameters {
if
(
properties
.
getProperty
(
prefix
+
"rln_use_neibs"
)!=
null
)
this
.
rln_use_neibs
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"rln_use_neibs"
));
if
(
properties
.
getProperty
(
prefix
+
"rln_neibs_fill"
)!=
null
)
this
.
rln_neibs_fill
=
Boolean
.
parseBoolean
(
properties
.
getProperty
(
prefix
+
"rln_neibs_fill"
));
if
(
properties
.
getProperty
(
prefix
+
"rln_neib_radius"
)!=
null
)
this
.
rln_neib_radius
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"rln_neib_radius"
));
if
(
properties
.
getProperty
(
prefix
+
"rln_radius_frac"
)!=
null
)
this
.
rln_radius_frac
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"rln_radius_frac"
));
if
(
properties
.
getProperty
(
prefix
+
"rln_cent_radius"
)!=
null
)
this
.
rln_cent_radius
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"rln_cent_radius"
));
if
(
properties
.
getProperty
(
prefix
+
"rln_n_recenter"
)!=
null
)
this
.
rln_n_recenter
=
Integer
.
parseInt
(
properties
.
getProperty
(
prefix
+
"rln_n_recenter"
));
if
(
properties
.
getProperty
(
prefix
+
"rln_sngl_rstr"
)!=
null
)
this
.
rln_sngl_rstr
=
Double
.
parseDouble
(
properties
.
getProperty
(
prefix
+
"rln_sngl_rstr"
));
...
...
@@ -2860,6 +2866,8 @@ public class IntersceneMatchParameters {
imp
.
rln_use_neibs
=
this
.
rln_use_neibs
;
imp
.
rln_neibs_fill
=
this
.
rln_neibs_fill
;
imp
.
rln_neib_radius
=
this
.
rln_neib_radius
;
imp
.
rln_radius_frac
=
this
.
rln_radius_frac
;
imp
.
rln_cent_radius
=
this
.
rln_cent_radius
;
imp
.
rln_n_recenter
=
this
.
rln_n_recenter
;
imp
.
rln_sngl_rstr
=
this
.
rln_sngl_rstr
;
...
...
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