Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Commits
8f16831f
Commit
8f16831f
authored
5 years ago
by
Sebastian Hahta
Browse files
Options
Downloads
Patches
Plain Diff
python: params from K
parent
50ddf5c9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/ftl/misc.py
+8
-1
8 additions, 1 deletion
python/ftl/misc.py
with
8 additions
and
1 deletion
python/ftl/misc.py
+
8
−
1
View file @
8f16831f
import
numpy
as
np
import
numpy
as
np
from
.
ftltype
import
Camera
def
get_camera_matrix
(
calib
):
def
get_camera_matrix
(
calib
):
K
=
np
.
identity
(
3
,
dtype
=
np
.
float64
)
K
=
np
.
identity
(
3
,
dtype
=
np
.
float64
)
...
@@ -41,6 +42,12 @@ def depth_to_disparity(depth, camera, invalid_value=0.0):
...
@@ -41,6 +42,12 @@ def depth_to_disparity(depth, camera, invalid_value=0.0):
return
disparity
return
disparity
class
Calibration
:
class
Calibration
:
@staticmethod
def
from_K
(
K
,
size
,
min_depth
=
0.0
,
max_depth
=
100.0
,
baseline
=
0.0
,
doff
=
0.0
):
calib
=
Camera
.
_make
([
K
[
0
,
0
],
K
[
1
,
1
],
K
[
0
,
2
],
K
[
1
,
2
],
size
[
1
],
size
[
0
],
min_depth
,
max_depth
,
baseline
,
doff
])
return
Calibration
(
calib
,
None
,
None
)
def
__init__
(
self
,
calib
,
channel
,
capabilities
):
def
__init__
(
self
,
calib
,
channel
,
capabilities
):
self
.
_calib
=
calib
self
.
_calib
=
calib
self
.
_capabilities
=
capabilities
self
.
_capabilities
=
capabilities
...
@@ -64,7 +71,7 @@ def point3d(calib, u, v, d):
...
@@ -64,7 +71,7 @@ def point3d(calib, u, v, d):
return
np
.
array
([(
u
+
calib
.
cx
)
*
d
/
calib
.
fx
,
(
v
+
calib
.
cy
)
*
d
/
calib
.
fy
,
d
],
dtype
=
np
.
float
)
return
np
.
array
([(
u
+
calib
.
cx
)
*
d
/
calib
.
fx
,
(
v
+
calib
.
cy
)
*
d
/
calib
.
fy
,
d
],
dtype
=
np
.
float
)
def
depth_image_to_3
D
(
depth
,
calib
):
def
depth_image_to_3
d
(
depth
,
calib
):
"""
Calculate 3D points from depth image and calibration paramters
"""
Calculate 3D points from depth image and calibration paramters
@param depth depth image
@param depth depth image
@param calib calibration paramters
@param calib calibration paramters
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment