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
83ce74fe
Commit
83ce74fe
authored
Aug 25, 2024
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LMA to adjust scene's presumably LMA-related affines (not tilt-related)
parent
203fad06
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1555 additions
and
106 deletions
+1555
-106
ERSTiltLMA.java
src/main/java/com/elphel/imagej/orthomosaic/ERSTiltLMA.java
+713
-0
OrthoAltitudeMatch.java
...ava/com/elphel/imagej/orthomosaic/OrthoAltitudeMatch.java
+130
-73
OrthoMap.java
src/main/java/com/elphel/imagej/orthomosaic/OrthoMap.java
+9
-0
PairwiseOrthoMatch.java
...ava/com/elphel/imagej/orthomosaic/PairwiseOrthoMatch.java
+8
-0
QuatUtils.java
src/main/java/com/elphel/imagej/orthomosaic/QuatUtils.java
+635
-32
SingularValueDecomposition.java
...elphel/imagej/orthomosaic/SingularValueDecomposition.java
+60
-1
No files found.
src/main/java/com/elphel/imagej/orthomosaic/ERSTiltLMA.java
0 → 100644
View file @
83ce74fe
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/orthomosaic/OrthoAltitudeMatch.java
View file @
83ce74fe
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/orthomosaic/OrthoMap.java
View file @
83ce74fe
...
...
@@ -114,6 +114,7 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
// affine convert (input) rectified coordinates (meters) relative to vert_meters to source image
// coordinates relative to vert_meters
public
double
[][]
affine
=
new
double
[][]
{{
1
,
0
,
0
},{
0
,
1
,
0
}};
// relative to vert_meters[], positive Y is down (as in images)
public
transient
double
[][]
ers_affine
=
new
double
[][]
{{
1
,
0
},{
0
,
1
}};
// orientation only for remaining ERS, positive Y is down (as in images)
public
double
orig_pix_meters
;
public
double
[]
vert_meters
;
// offset of the image vertical in meters (scale-invariant), right (X) and down (Y)
public
int
orig_width
;
...
...
@@ -190,6 +191,14 @@ public class OrthoMap implements Comparable <OrthoMap>, Serializable{
// pairwise_matches = new HashMap<Double, PairwiseOrthoMatch>();
}
public
double
[][]
getERSAffine
(){
return
ers_affine
;
}
public
void
setERSAffine
(
double
[][]
ers_affine
)
{
// cloned
// this.ers_affine = ers_affine;
this
.
ers_affine
=
new
double
[][]
{
ers_affine
[
0
].
clone
(),
ers_affine
[
1
].
clone
()};
}
double
getEqualized
(
double
d
)
{
return
d
*
equalize
[
0
]
+
equalize
[
1
];
}
...
...
src/main/java/com/elphel/imagej/orthomosaic/PairwiseOrthoMatch.java
View file @
83ce74fe
...
...
@@ -40,10 +40,18 @@ public class PairwiseOrthoMatch implements Serializable {
public
transient
double
overlap
=
0.0
;
public
transient
double
[]
alt_data
=
null
;
public
transient
double
[]
equalize1to0
=
{
1
,
0
};
// value1 = equalize2to1[0]*value2+equalize2to1[1]
public
transient
double
[]
quat
=
null
;
// relative orientation of the second scene (ERS affine removed). Will be eventually saved
// below - not saved/restored
public
transient
boolean
ok
=
false
;
// not saved/restored
public
transient
int
[]
nxy
=
null
;
// not saved, just to communicate for logging
public
double
[]
getQuaternion
()
{
return
quat
;
}
public
void
setQuaternion
(
double
[]
quat
)
{
// clone() by caller
this
.
quat
=
quat
;
}
// public PairwiseOrthoMatch() {}
public
double
getOverlap
()
{
return
overlap
;
...
...
src/main/java/com/elphel/imagej/orthomosaic/QuatUtils.java
View file @
83ce74fe
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/orthomosaic/SingularValueDecomposition.java
View file @
83ce74fe
...
...
@@ -49,13 +49,37 @@ public class SingularValueDecomposition {
public
double
getMinScale
()
{
return
Math
.
min
(
w1
,
w2
);}
public
double
getMaxScale
()
{
return
Math
.
max
(
w1
,
w2
);}
public
static
String
titleString
(
boolean
degrees
)
{
SingularValueDecomposition
svd
=
new
SingularValueDecomposition
(
0
,
0
,
0
,
0
,
0
);
return
svd
.
toString
(
degrees
,
2
);
}
public
String
toString
(
boolean
degrees
)
{
return
toString
(
degrees
,
0
);
}
/**
* generate String representation of SingularValueDecomposition instance
* @param degrees true - degrees, false - radians
* @param tab_mode 0 - commas, in-line names; 1 - tabs, data only; 2 tab-sepatated title string (does not start with a tab)
* @return formatted String
*/
public
String
toString
(
boolean
degrees
,
int
tab_mode
)
{
//System.out.println("svd_affine_pair= ["+svd_affine_pair.scale+ ","+svd_affine_pair.getTiltAngle()+ ","+svd_affine_pair.gamma+ ","+svd_affine_pair.rot+
// "] tilt="+(svd_affine_pair.getTiltAngle()*180/Math.PI)+ "\u00B0, dir="+(svd_affine_pair.gamma*180/Math.PI)+"\u00B0");
String
tab_title_rad
=
String
.
format
(
"%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s"
,
"scale"
,
"tilt"
,
"gamma"
,
"beta"
,
"rot"
,
"w1"
,
"w2"
,
"ratio"
);
String
tab_title_deg
=
String
.
format
(
"%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s\t%10s"
,
"scale"
,
"tilt\u00B0"
,
"gamma\u00B0"
,
"beta\u00B0"
,
"rot\u00B0"
,
"w1"
,
"w2"
,
"ratio"
);
String
tab_fmt_rad
=
"%10.8f\t%10.7f\t%10.7f\t%10.7f\t%10.7f\t%10.8f\t%10.8f\t%10.8f"
;
String
tab_fmt_deg
=
"%10.8f\t%10.5f\t%10.5f\t%10.5f\t%10.5f\t%10.8f\t%10.8f\t%10.8f"
;
String
fmt_rad
=
" scale=%10.8f,tilt= %10.7f, gamma=%10.7f, beta=%10.7f, rot=%10.7f, w1=%10.8f, w2=%10.8f, ratio=%10.8f"
;
String
fmt_deg
=
" scale=%10.8f,tilt= %10.5f\u00B0, gamma=%10.5f\u00B0, beta=%10.5f\u00B0, rot=%10.5f\u00B0, w1=%10.8f, w2=%10.8f, ratio=%10.8f"
;
if
(
tab_mode
==
2
)
{
return
degrees
?
tab_title_deg:
tab_title_rad
;
}
String
fmt
=
(
tab_mode
==
1
)?(
degrees
?
tab_fmt_deg
:
tab_fmt_rad
):(
degrees
?
fmt_deg
:
fmt_rad
);
double
s
=
degrees
?
(
180
/
Math
.
PI
):
1
;
String
fmt
=
degrees
?
fmt_deg
:
fmt_rad
;
//
String fmt=degrees ? fmt_deg : fmt_rad;
return
String
.
format
(
fmt
,
scale
,
s
*
getTiltAngle
(),
s
*
gamma
,
s
*
beta
,
s
*
rot
,
w1
,
w2
,
ratio
);
}
...
...
@@ -167,6 +191,41 @@ public class SingularValueDecomposition {
}
/**
* Get a pair of singular values (starting with smaller) and their derivatives
* @param AdA affine transform, followed by an array of affine transform derivatives
* (top index - number of derivative)
* @return {{w2,w1}, {dw2/dx1,dw1/dx1}, {dw2/dx2,dw1/dx2}, ...}
*/
public
static
double
[][]
getMinMaxEigenValues
(
double
[][][]
AdA
)
{
double
a00
=
AdA
[
0
][
0
][
0
],
a01
=
AdA
[
0
][
0
][
1
],
a10
=
AdA
[
0
][
1
][
0
],
a11
=
AdA
[
0
][
1
][
1
];
double
b00
=(
a00
+
a11
)/
2
;
//, b11 = b00;
double
c00
=(
a00
-
a11
)/
2
;
//, c11 =-c00;
double
b01
=(
a01
-
a10
)/
2
;
//, b10 =-b01;
double
c01
=(
a01
+
a10
)/
2
;
//, c10 = c01;
double
w1_p_w2_2
=
Math
.
sqrt
(
b00
*
b00
+
b01
*
b01
);
double
w1_m_w2_2
=
Math
.
sqrt
(
c00
*
c00
+
c01
*
c01
);
double
w1
=
w1_p_w2_2
+
w1_m_w2_2
;
double
w2
=
w1_p_w2_2
-
w1_m_w2_2
;
double
[][]
rslt
=
new
double
[
AdA
.
length
][];
rslt
[
0
]
=
new
double
[]
{
w2
,
w1
};
// w1=1, w2 <=1;
for
(
int
i
=
1
;
i
<
AdA
.
length
;
i
++)
{
double
d_a00
=
AdA
[
i
][
0
][
0
],
d_a01
=
AdA
[
i
][
0
][
1
],
d_a10
=
AdA
[
i
][
1
][
0
],
d_a11
=
AdA
[
i
][
1
][
1
];
double
d_b00
=(
d_a00
+
d_a11
)/
2
;
//, b11 = b00;
double
d_c00
=(
d_a00
-
d_a11
)/
2
;
//, c11 =-c00;
double
d_b01
=(
d_a01
-
d_a10
)/
2
;
//, b10 =-b01;
double
d_c01
=(
d_a01
+
d_a10
)/
2
;
//, c10 = c01;
double
d_w1_p_w2_2
=
(
b00
*
d_b00
+
b01
*
d_b01
)/
w1_p_w2_2
;
double
d_w1_m_w2_2
=
(
c00
*
d_c00
+
c01
*
d_c01
)/
w1_m_w2_2
;
double
d_w1
=
d_w1_p_w2_2
+
d_w1_m_w2_2
;
double
d_w2
=
d_w1_p_w2_2
-
d_w1_m_w2_2
;
rslt
[
i
]
=
new
double
[]
{
d_w2
,
d_w1
};
}
return
rslt
;
}
/**
* Use singular value decomposition and then split scaling {{w1,0},{0,w1}}
* into overall scaling caused by zoom != 1.0 because of altitude error
...
...
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