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
82ae5d53
Commit
82ae5d53
authored
Oct 05, 2020
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
preparing macro tiles for optical flow with CLT
parent
ca22efc3
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
391 additions
and
189 deletions
+391
-189
ErsCorrection.java
...n/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
+71
-13
OpticalFlow.java
...ain/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
+314
-173
TwoQuadCLT.java
...main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
+6
-3
No files found.
src/main/java/com/elphel/imagej/tileprocessor/ErsCorrection.java
View file @
82ae5d53
...
...
@@ -397,6 +397,8 @@ public class ErsCorrection extends GeometryCorrection {
public
void
setupERS
()
{
double
ers_sign
=
1.0
;
// -1.0; // invert all corrections to opposite?
ers_xyz
=
new
double
[
pixelCorrectionHeight
][
3
];
ers_xyz_dt
=
new
double
[
pixelCorrectionHeight
][
3
];
ers_quaternion
=
new
Quaternion
[
pixelCorrectionHeight
];
...
...
@@ -414,12 +416,12 @@ public class ErsCorrection extends GeometryCorrection {
Quaternion
quat_center2
=
new
Quaternion
(
0.0
,
ers_watr_center_d2t
[
1
],
ers_watr_center_d2t
[
0
],
ers_watr_center_d2t
[
2
]);
// angular velocity 1/s :tilt, az, roll
// integration to the bottom of the image
double
dt
=
line_time
;
double
dt
=
ers_sign
*
line_time
;
double
[]
wxy0
=
ers_wxyz_center
.
clone
();
double
[]
wxy1
=
ers_wxyz_center_dt
.
clone
();
double
[]
wxy2
=
ers_wxyz_center_d2t
.
clone
();
// bottom half rotations
dt
=
line_time
;
dt
=
ers_sign
*
line_time
;
Quaternion
q0
=
quat_center0
.
multiply
(
1.0
);
// clone() orientation
Quaternion
q1
=
quat_center1
.
multiply
(
1.0
);
// clone() angular velocity (pure)
Quaternion
q2
=
quat_center2
.
multiply
(
1.0
);
// clone() angular accelerations (pure)
...
...
@@ -432,7 +434,7 @@ public class ErsCorrection extends GeometryCorrection {
q1
=
q1_next
;
}
// top half-frame rotations
dt
=
-
line_time
;
dt
=
-
ers_sign
*
line_time
;
q0
=
quat_center0
.
multiply
(
1.0
);
// clone() orientation
q1
=
quat_center1
.
multiply
(
1.0
);
// clone() angular velocity (pure)
q2
=
quat_center2
.
multiply
(
1.0
);
// clone() angular accelerations (pure)
...
...
@@ -470,7 +472,7 @@ public class ErsCorrection extends GeometryCorrection {
wxy1
[
i
]
=
wxy1_next
;
}
}
dt
=
-
line_time
;
dt
=
-
ers_sign
*
line_time
;
wxy0
=
ers_wxyz_center
.
clone
();
wxy1
=
ers_wxyz_center_dt
.
clone
();
for
(
int
h
=
cent_h
;
h
>=
0
;
h
--)
{
...
...
@@ -502,10 +504,9 @@ public class ErsCorrection extends GeometryCorrection {
public
double
[]
getImageCoordinatesERS
(
QuadCLT
cameraQuadCLT
,
// camera station that got image to be to be matched
double
px
,
// pixel coordinate X in this camera view
double
py
,
// pixel coordinate Y in this camera view
double
disparity
,
// this view disparity
double
px
,
// pixel coordinate X in the reference view
double
py
,
// pixel coordinate Y in the reference view
double
disparity
,
// this reference disparity
boolean
distortedView
,
// This camera view is distorted (diff.rect), false - rectilinear
double
[]
reference_xyz
,
// this view position in world coordinates (typically zero3)
double
[]
reference_atr
,
// this view orientation relative to world frame (typically zero3)
...
...
@@ -540,14 +541,14 @@ public class ErsCorrection extends GeometryCorrection {
if
(
xyzw
[
2
]
>
0
)
{
return
null
;
// can not match object behind the camera
}
ErsCorrection
ers_
other
=
this
;
ErsCorrection
ers_
camera
=
this
;
if
(
cameraQuadCLT
!=
null
)
{
ers_
other
=
cameraQuadCLT
.
getErsCorrection
();
ers_
camera
=
cameraQuadCLT
.
getErsCorrection
();
}
if
(
camera_xyz
==
null
)
camera_xyz
=
ers_
other
.
camera_xyz
;
if
(
camera_atr
==
null
)
camera_atr
=
ers_
other
.
camera_atr
;
if
(
camera_xyz
==
null
)
camera_xyz
=
ers_
camera
.
camera_xyz
;
if
(
camera_atr
==
null
)
camera_atr
=
ers_
camera
.
camera_atr
;
double
[]
pXpYD
=
ers_
other
.
getImageCoordinatesERS
(
// USED in lwir
double
[]
pXpYD
=
ers_
camera
.
getImageCoordinatesERS
(
// USED in lwir
xyzw
,
distortedCamera
,
camera_xyz
,
// camera center in world coordinates
...
...
@@ -557,6 +558,63 @@ public class ErsCorrection extends GeometryCorrection {
return
pXpYD
;
}
public
double
[]
getImageCoordinatesReferenceERS
(
QuadCLT
cameraQuadCLT
,
// camera station that got image to be to be matched
double
px
,
// pixel coordinate X in this camera view
double
py
,
// pixel coordinate Y in this camera view
double
disparity
,
// this view disparity
boolean
distortedView
,
// This camera view is distorted (diff.rect), false - rectilinear
double
[]
reference_xyz
,
// this view position in world coordinates (typically zero3)
double
[]
reference_atr
,
// this view orientation relative to world frame (typically zero3)
boolean
distortedCamera
,
// camera view is distorted (false - rectilinear)
double
[]
camera_xyz
,
// camera center in world coordinates
double
[]
camera_atr
,
// camera orientation relative to world frame
double
line_err
)
// threshold error in scan lines (1.0)
{
if
(
reference_xyz
==
null
)
reference_xyz
=
this
.
camera_xyz
;
if
(
reference_atr
==
null
)
reference_atr
=
this
.
camera_atr
;
ErsCorrection
ers_camera
=
this
;
if
(
cameraQuadCLT
!=
null
)
{
ers_camera
=
cameraQuadCLT
.
getErsCorrection
();
}
if
(
camera_xyz
==
null
)
camera_xyz
=
ers_camera
.
camera_xyz
;
if
(
camera_atr
==
null
)
camera_atr
=
ers_camera
.
camera_atr
;
// Find world coordinates of the camera pixel
double
[]
xyzw
=
ers_camera
.
getWorldCoordinatesERS
(
// {x - left,y - up, z (0 at camera, negative away), 1} for real, {x,y,z,0} - for infinity
px
,
py
,
disparity
,
distortedView
,
// correct distortion (will need corrected background too !)
camera_xyz
,
// camera center in world coordinates
camera_atr
);
// camera orientation relative to world frame
if
(
xyzw
==
null
)
{
return
null
;
}
if
(
xyzw
[
3
]
==
0.0
)
{
// infinity
/*
if (xyzw[2] > 0) {
for (int i = 0; i < 3; i++) {
xyzw[i] = -xyzw[i];
}
}
*/
}
if
(
xyzw
[
2
]
>
0
)
{
return
null
;
// can not match object behind the camera
}
double
[]
pXpYD
=
ers_camera
.
getImageCoordinatesERS
(
// USED in lwir
xyzw
,
distortedCamera
,
reference_xyz
,
// camera center in world coordinates
reference_atr
,
// camera orientation relative to world frame
line_err
);
// threshold error in scan lines (1.0)
return
pXpYD
;
}
/**
* Get real world coordinates from pixel coordinates and nominal disparity
...
...
src/main/java/com/elphel/imagej/tileprocessor/OpticalFlow.java
View file @
82ae5d53
This diff is collapsed.
Click to expand it.
src/main/java/com/elphel/imagej/tileprocessor/TwoQuadCLT.java
View file @
82ae5d53
...
...
@@ -8262,17 +8262,20 @@ if (debugLevel > -100) return true; // temporarily !
OpticalFlow
opticalFlow
=
new
OpticalFlow
(
threadsMax
,
// int threadsMax, // maximal number of threads to launch
updateStatus
);
// boolean updateStatus);
int
margin
=
4
;
// extra margins over 16x16 tiles to accommodate distorted destination tiles
// int margin = 4; // extra margins over 16x16 tiles to accommodate distorted destination tiles
/*
double tolerance_absolute = 0.25; // absolute disparity half-range in each tile
double tolerance_relative = 0.2; // relative disparity half-range in each tile
double center_occupancy = 0.25; // fraction of remaining tiles in the center 8x8 area (<1.0)
int num_passes = 100;
double max_change = 0.005 ;
*/
for
(
int
i
=
1
;
i
<
quadCLTs
.
length
;
i
++)
{
QuadCLT
qPrev
=
(
i
>
0
)
?
quadCLTs
[
i
-
1
]
:
null
;
/*
double [][][] source_tiles = opticalFlow.prepareReferenceTiles(
quadCLTs[i], // final QuadCLT qthis,
// margin, // final int margin, // extra margins over 16x16 tiles to accommodate distorted destination tiles
...
...
@@ -8289,7 +8292,7 @@ if (debugLevel > -100) return true; // temporarily !
num_passes, // final int num_passes,
max_change, // final double max_change,
2); // final int debug_level)
*/
double
[][][]
pair_sets
=
...
...
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