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
468688b4
Commit
468688b4
authored
Oct 17, 2020
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed derivatives at infinity
parent
aa3c316e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
21 deletions
+27
-21
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+27
-21
No files found.
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
468688b4
...
@@ -960,11 +960,11 @@ public class ErsCorrection extends GeometryCorrection {
...
@@ -960,11 +960,11 @@ public class ErsCorrection extends GeometryCorrection {
// double [] scene_xyz = new double [] {-.3,-0.2, 2.0}; // scene center in world coordinates
// double [] scene_xyz = new double [] {-.3,-0.2, 2.0}; // scene center in world coordinates
// double [] scene_atr = new double [] {0.05, -0.03, 0.05}; // scene orientation relative to world frame
// double [] scene_atr = new double [] {0.05, -0.03, 0.05}; // scene orientation relative to world frame
//
double [] reference_xyz = new double [] {0.5, 0.2,-3.0}; // reference center in world coordinates
double
[]
reference_xyz
=
new
double
[]
{
0.5
,
0.2
,-
3.0
};
// reference center in world coordinates
double
[]
reference_xyz
=
new
double
[
3
];
// reference center in world coordinates
//
double [] reference_xyz = new double [3]; // reference center in world coordinates
double
[]
reference_atr
=
new
double
[]
{
0.1
,
0.05
,
0.15
};
// reference orientation relative to world frame
double
[]
reference_atr
=
new
double
[]
{
0.1
,
0.05
,
0.15
};
// reference orientation relative to world frame
double
[]
scene_xyz
=
reference_xyz
.
clone
();
//new double[3]; //
double
[]
scene_xyz
=
new
double
[]
{
0.2
,
-
0.1
,
-
2.0
};
//
reference_xyz.clone(); //new double[3]; //
double
[]
scene_atr
=
new
double
[
3
];
// reference_atr.clone();
double
[]
scene_atr
=
new
double
[]
{
0.05
,
0.15
,
-
0.05
};
// new double
[3]; // reference_atr.clone();
System
.
out
.
println
(
String
.
format
(
"reference_xyz= {%8f, %8f, %8f}"
,
reference_xyz
[
0
],
reference_xyz
[
1
],
reference_xyz
[
2
]));
System
.
out
.
println
(
String
.
format
(
"reference_xyz= {%8f, %8f, %8f}"
,
reference_xyz
[
0
],
reference_xyz
[
1
],
reference_xyz
[
2
]));
System
.
out
.
println
(
String
.
format
(
"reference_atr= {%8f, %8f, %8f}"
,
reference_atr
[
0
],
reference_atr
[
1
],
reference_atr
[
2
]));
System
.
out
.
println
(
String
.
format
(
"reference_atr= {%8f, %8f, %8f}"
,
reference_atr
[
0
],
reference_atr
[
1
],
reference_atr
[
2
]));
System
.
out
.
println
(
String
.
format
(
"scene_xyz= {%8f, %8f, %8f}"
,
scene_xyz
[
0
],
scene_xyz
[
1
],
scene_xyz
[
2
]));
System
.
out
.
println
(
String
.
format
(
"scene_xyz= {%8f, %8f, %8f}"
,
scene_xyz
[
0
],
scene_xyz
[
1
],
scene_xyz
[
2
]));
...
@@ -986,10 +986,10 @@ public class ErsCorrection extends GeometryCorrection {
...
@@ -986,10 +986,10 @@ public class ErsCorrection extends GeometryCorrection {
System
.
out
.
println
(
String
.
format
(
"Scene ers_watr_center_dt= {%8f, %8f, %8f}"
,
scene_ers
.
ers_watr_center_dt
[
0
],
scene_ers
.
ers_watr_center_dt
[
1
],
scene_ers
.
ers_watr_center_dt
[
2
]));
System
.
out
.
println
(
String
.
format
(
"Scene ers_watr_center_dt= {%8f, %8f, %8f}"
,
scene_ers
.
ers_watr_center_dt
[
0
],
scene_ers
.
ers_watr_center_dt
[
1
],
scene_ers
.
ers_watr_center_dt
[
2
]));
}
}
if
(
fake_linear_ers
)
{
if
(
fake_linear_ers
)
{
//
this.ers_wxyz_center_dt= new double[] { 1.0, 0.25, -2.0}; // this.ers_watr_center_dt.clone(); // new double[3];
this
.
ers_wxyz_center_dt
=
new
double
[]
{
1.0
,
0.25
,
-
2.0
};
// this.ers_watr_center_dt.clone(); // new double[3];
//
scene_ers.ers_wxyz_center_dt= new double[] { 0.5, 0.3, -1.5}; // new double[3];
scene_ers
.
ers_wxyz_center_dt
=
new
double
[]
{
0.5
,
0.3
,
-
1.5
};
// new double[3];
this
.
ers_wxyz_center_dt
=
new
double
[
3
];
// { 1.0, 0.25, -2.0}; // this.ers_watr_center_dt.clone(); // new double[3];
//
this.ers_wxyz_center_dt= new double[3];// { 1.0, 0.25, -2.0}; // this.ers_watr_center_dt.clone(); // new double[3];
scene_ers
.
ers_wxyz_center_dt
=
new
double
[
3
];
// { 0.5, 0.3, -1.5}; // new double[3];
//
scene_ers.ers_wxyz_center_dt= new double[3];// { 0.5, 0.3, -1.5}; // new double[3];
System
.
out
.
println
(
"Updated2:"
);
System
.
out
.
println
(
"Updated2:"
);
System
.
out
.
println
(
String
.
format
(
"Reference ers_wxyz_center_dt= {%8f, %8f, %8f}"
,
this
.
ers_wxyz_center_dt
[
0
],
this
.
ers_wxyz_center_dt
[
1
],
this
.
ers_wxyz_center_dt
[
2
]));
System
.
out
.
println
(
String
.
format
(
"Reference ers_wxyz_center_dt= {%8f, %8f, %8f}"
,
this
.
ers_wxyz_center_dt
[
0
],
this
.
ers_wxyz_center_dt
[
1
],
this
.
ers_wxyz_center_dt
[
2
]));
System
.
out
.
println
(
String
.
format
(
"Reference ers_watr_center_dt= {%8f, %8f, %8f}"
,
this
.
ers_watr_center_dt
[
0
],
this
.
ers_watr_center_dt
[
1
],
this
.
ers_watr_center_dt
[
2
]));
System
.
out
.
println
(
String
.
format
(
"Reference ers_watr_center_dt= {%8f, %8f, %8f}"
,
this
.
ers_watr_center_dt
[
0
],
this
.
ers_watr_center_dt
[
1
],
this
.
ers_watr_center_dt
[
2
]));
...
@@ -1974,10 +1974,16 @@ public class ErsCorrection extends GeometryCorrection {
...
@@ -1974,10 +1974,16 @@ public class ErsCorrection extends GeometryCorrection {
scene_vectors
[
DW_DPX
+
1
].
toArray
(),
scene_vectors
[
DW_DPX
+
1
].
toArray
(),
scene_vectors
[
DW_DPY
+
1
].
toArray
(),
scene_vectors
[
DW_DPY
+
1
].
toArray
(),
scene_vectors
[
DW_DD
+
1
].
toArray
()}).
transpose
();
scene_vectors
[
DW_DD
+
1
].
toArray
()}).
transpose
();
double
x
=
xyz4
[
0
];
// next variables are {x,y,z} * disparity
double
y
=
xyz4
[
1
];
double
xref
=
xyz4
[
0
];
double
z
=
xyz4
[
2
];
double
yref
=
xyz4
[
1
];
double
z2
=
z
*
z
;
double
zref
=
xyz4
[
2
];
double
z2ref
=
zref
*
zref
;
double
xscene
=
scene_vectors
[
0
].
getX
();
double
yscene
=
scene_vectors
[
0
].
getY
();
double
zscene
=
scene_vectors
[
0
].
getZ
();
double
z2scene
=
zscene
*
zscene
;
if
(
is_infinity
)
{
if
(
is_infinity
)
{
// dividing X, Y by Z, getting 2x2 Matrix
// dividing X, Y by Z, getting 2x2 Matrix
/*
/*
...
@@ -1989,10 +1995,10 @@ public class ErsCorrection extends GeometryCorrection {
...
@@ -1989,10 +1995,10 @@ public class ErsCorrection extends GeometryCorrection {
* dV/dpX = 1/z * (dy/dpX) - y/z^2 * (dz/dpX)
* dV/dpX = 1/z * (dy/dpX) - y/z^2 * (dz/dpX)
* dV/dpY = 1/z * (dy/dpY) - y/z^2 * (dz/dpY)
* dV/dpY = 1/z * (dy/dpY) - y/z^2 * (dz/dpY)
*/
*/
double
dU_dpX
=
dx_dpscene
.
get
(
0
,
0
)
/
z
-
x
*
dx_dpscene
.
get
(
2
,
0
)
/
z2
;
double
dU_dpX
=
dx_dpscene
.
get
(
0
,
0
)
/
z
scene
-
xscene
*
dx_dpscene
.
get
(
2
,
0
)
/
z2scene
;
double
dU_dpY
=
dx_dpscene
.
get
(
0
,
1
)
/
z
-
x
*
dx_dpscene
.
get
(
2
,
1
)
/
z2
;
double
dU_dpY
=
dx_dpscene
.
get
(
0
,
1
)
/
z
scene
-
xscene
*
dx_dpscene
.
get
(
2
,
1
)
/
z2scene
;
double
dV_dpX
=
dx_dpscene
.
get
(
1
,
0
)
/
z
-
y
*
dx_dpscene
.
get
(
2
,
0
)
/
z2
;
double
dV_dpX
=
dx_dpscene
.
get
(
1
,
0
)
/
z
scene
-
yscene
*
dx_dpscene
.
get
(
2
,
0
)
/
z2scene
;
double
dV_dpY
=
dx_dpscene
.
get
(
1
,
1
)
/
z
-
y
*
dx_dpscene
.
get
(
2
,
1
)
/
z2
;
double
dV_dpY
=
dx_dpscene
.
get
(
1
,
1
)
/
z
scene
-
yscene
*
dx_dpscene
.
get
(
2
,
1
)
/
z2scene
;
dx_dpscene
=
new
Matrix
(
new
double
[][]
{
dx_dpscene
=
new
Matrix
(
new
double
[][]
{
{
dU_dpX
,
dU_dpY
,
0.0
},
{
dU_dpX
,
dU_dpY
,
0.0
},
{
dV_dpX
,
dV_dpY
,
0.0
},
{
dV_dpX
,
dV_dpY
,
0.0
},
...
@@ -2012,8 +2018,8 @@ public class ErsCorrection extends GeometryCorrection {
...
@@ -2012,8 +2018,8 @@ public class ErsCorrection extends GeometryCorrection {
int
vindx
=
indx
+
1
;
int
vindx
=
indx
+
1
;
if
(
is_infinity
)
{
if
(
is_infinity
)
{
Vector3D
dw_dp
=
new
Vector3D
(
Vector3D
dw_dp
=
new
Vector3D
(
reference_vectors
[
vindx
].
getX
()/
z
-
x
*
reference_vectors
[
vindx
].
getZ
()/
z2
,
reference_vectors
[
vindx
].
getX
()/
z
ref
-
xref
*
reference_vectors
[
vindx
].
getZ
()
/
z2ref
,
reference_vectors
[
vindx
].
getY
()/
z
-
y
*
reference_vectors
[
vindx
].
getZ
()/
z2
,
reference_vectors
[
vindx
].
getY
()/
z
ref
-
yref
*
reference_vectors
[
vindx
].
getZ
()
/
z2ref
,
0.0
);
0.0
);
derivatives
[
vindx
]
=
matrixTimesVector
(
dpscene_dxyz
,
dw_dp
).
toArray
();
derivatives
[
vindx
]
=
matrixTimesVector
(
dpscene_dxyz
,
dw_dp
).
toArray
();
}
else
{
}
else
{
...
@@ -2025,8 +2031,8 @@ public class ErsCorrection extends GeometryCorrection {
...
@@ -2025,8 +2031,8 @@ public class ErsCorrection extends GeometryCorrection {
int
indx_in
=
indx_out
-
DP_DSVAZ
+
DW_DVAZ
;
// 4, 5, ...
int
indx_in
=
indx_out
-
DP_DSVAZ
+
DW_DVAZ
;
// 4, 5, ...
if
(
is_infinity
)
{
if
(
is_infinity
)
{
Vector3D
dw_dp
=
new
Vector3D
(
Vector3D
dw_dp
=
new
Vector3D
(
scene_vectors
[
indx_in
].
getX
()/
z
-
x
*
scene_vectors
[
indx_in
].
getZ
()/
z2
,
scene_vectors
[
indx_in
].
getX
()/
z
scene
-
xscene
*
scene_vectors
[
indx_in
].
getZ
()
/
z2scene
,
scene_vectors
[
indx_in
].
getY
()/
z
-
y
*
scene_vectors
[
indx_in
].
getZ
()/
z2
,
scene_vectors
[
indx_in
].
getY
()/
z
scene
-
yscene
*
scene_vectors
[
indx_in
].
getZ
()
/
z2scene
,
0.0
);
0.0
);
derivatives
[
indx_out
]
=
matrixTimesVector
(
dpscene_dxyz_minus
,
dw_dp
).
toArray
();
derivatives
[
indx_out
]
=
matrixTimesVector
(
dpscene_dxyz_minus
,
dw_dp
).
toArray
();
}
else
{
}
else
{
...
...
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