Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the depth camera intrinsics #81

Open
ShuangjunLiu opened this issue Feb 15, 2020 · 4 comments
Open

How to get the depth camera intrinsics #81

ShuangjunLiu opened this issue Feb 15, 2020 · 4 comments

Comments

@ShuangjunLiu
Copy link

From the source code, I see there is method in PyKinectV2 to get depth camera intrinsics.

However, I have no idea how to call this function.
Can you give an example how to use these com methods?

Thanks.

@KonstantinosAng
Copy link

KonstantinosAng commented Feb 15, 2020

I have a repository with all the mapper functions if you want to check it out:

https://github.com/KonstantinosAng/PyKinect2-Mapper-Functions

For the depth camera intrinsics you can use the code below:

from pykinect2.PyKinectV2 import *
from pykinect2 import PyKinectV2
from pykinect2 import PyKinectRuntime

kinect = PyKinectRuntime.PyKinectRuntime(PyKinectV2.FrameSourceTypes_Depth | PyKinectV2.FrameSourceTypes_Color)

while True:
if kinect.has_new_depth_frame():
intrinsics_matrix = kinect._mapper.GetDepthCameraIntrinsics()

Just make sure to have at least one depth frame otherwise the intrinsics matrix will return zero values.

and to access the values use:

focal_length_x = intrinsics_matrix.FocalLengthX
focal_length_y = intrinsics_matrix.FocalLengthY
principal_point_x = intrinsics_matrix.PrincipalPointX
principal_point_y = intrinsics_matrix.PrincipalPointY
radial_distortion_fourth_order = intrinsics_matrix.RadialDistortionFourthOrder
radial_distortion_second_order = intrinsics_matrix.RadialDistortionSecondOrder
radial_distortion_sixth_order = intrinsics_matrix.RadialDistortionSixthOrder

@ShuangjunLiu
Copy link
Author

ShuangjunLiu commented Feb 15, 2020 via email

@theonlyhacker
Copy link

How can I get the internal parameters of the kinect color camera? There should be a corresponding function, but I can't find it?I guess the color camera intrinsics function like GetColorCameraIntrinsics(),but it does not exist.

@KonstantinosAng
Copy link

Yes there is only a function to get the Depth intrinsic parameters:

intrinsics_matrix = kinect._mapper.GetDepthCameraIntrinsics()

But you can always calibrate the RGB sensor and calculate the intrinsics yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants