3Gear Systems SDK  v0.9.34
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions | Properties | List of all members
ThreeGear.OpenCVCamera Class Reference

A class representing the intrinsic/extrinsic parameters of the depth camera. More...

Public Member Functions

 OpenCVCamera ()
 Initialize the camera with the settings for the Kinect. More...
 
 OpenCVCamera (uint imageWidth_in, uint imageHeight_in, Quaternion rot_in, Vector3D trans_in, double fx_in, double fy_in, double cx_in, double cy_in, double k1_in, double k2_in, double p1_in, double p2_in, double k3_in)
 
Point3D project (Point3D p_world)
 Takes a world space point and projects it to the image plane. More...
 
Point3D worldToCamera (Point3D p_world)
 Takes a world space point and transforms it into camera space. More...
 
Point3D cameraToImage (Point3D p_camera)
 Takes a point in camera space and transforms it to the image plane. More...
 

Properties

Vector3D Translation [get, set]
 The position component of the extrinsics matrix. More...
 
Quaternion Rotation [get, set]
 The rotation component of the extrinsics matrix. More...
 
uint ImageWidth [get, set]
 The width of the depth image, in pixels. More...
 
uint ImageHeight [get, set]
 The height of the depth image, in pixels. More...
 
Intrinsics
double Fx [get, set]
 x focal length (in pixels). More...
 
double Fy [get, set]
 y focal length (in pixels). More...
 
Distortion parameters
double Cx [get, set]
 Camera center x coordinate (in pixels, from left). More...
 
double Cy [get, set]
 Camera center y coordinate (in pixels, from top). More...
 
double K1 [get, set]
 Radial distortion quadratic term. More...
 
double K2 [get, set]
 Radial distortion r^4 term. More...
 
double K3 [get, set]
 Radial distortion r^6 term. More...
 
double P1 [get, set]
 Tangential distortion term More...
 
double P2 [get, set]
 Tangential distortion quadratic term. More...
 

Detailed Description

A class representing the intrinsic/extrinsic parameters of the depth camera.

Our camera model is identical to the one used in OpenCV (and in OpenNI). A full description can be found here: http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html

The extrinsic matrix is set up such that world space corresponds to the desk frame used in hand tracking, with y pointing up and z pointing toward the user.

Everything here will be in double precision, because this is necessary for dealing robustly with distortion (some distortion terms use the 6th power of the radius, which would cause precision loss when working with 32-bit floats).

One possible gotcha: in OpenCV camera space, the coordinate system has the positive z vector pointing into the frame and the positive y vector pointing down from the top of the image. Note that this is flipped from OpenGL (where the negative z vector points into the frame).

This class includes the worldToCamera and cameraToImage functions for projecting a world space point down to the image plane. Because inverting camera distortion is considerably complicated, the inverses of these functions are not provided. If you need undistortion functionality, you can find it within OpenCV; take a look at the undistortPoints function.

Constructor & Destructor Documentation

ThreeGear.OpenCVCamera.OpenCVCamera ( )
inline

Initialize the camera with the settings for the Kinect.

Member Function Documentation

Point3D ThreeGear.OpenCVCamera.cameraToImage ( Point3D  p_camera)
inline

Takes a point in camera space and transforms it to the image plane.

In image space, x and y correspond to actual pixel values, measured from the top left corner of the image.

The z coordinate gets passed straight through from camera space without modification.

Point3D ThreeGear.OpenCVCamera.project ( Point3D  p_world)
inline

Takes a world space point and projects it to the image plane.

Combines worldToCamera with cameraToImage.

Point3D ThreeGear.OpenCVCamera.worldToCamera ( Point3D  p_world)
inline

Takes a world space point and transforms it into camera space.

Camera space is the space aligned with the camera center where the positive z vector points into the frame.

Property Documentation

double ThreeGear.OpenCVCamera.Cx
getset

Camera center x coordinate (in pixels, from left).

double ThreeGear.OpenCVCamera.Cy
getset

Camera center y coordinate (in pixels, from top).

double ThreeGear.OpenCVCamera.Fx
getset

x focal length (in pixels).

double ThreeGear.OpenCVCamera.Fy
getset

y focal length (in pixels).

uint ThreeGear.OpenCVCamera.ImageHeight
getset

The height of the depth image, in pixels.

uint ThreeGear.OpenCVCamera.ImageWidth
getset

The width of the depth image, in pixels.

double ThreeGear.OpenCVCamera.K1
getset

Radial distortion quadratic term.

double ThreeGear.OpenCVCamera.K2
getset

Radial distortion r^4 term.

double ThreeGear.OpenCVCamera.K3
getset

Radial distortion r^6 term.

double ThreeGear.OpenCVCamera.P1
getset

Tangential distortion term

double ThreeGear.OpenCVCamera.P2
getset

Tangential distortion quadratic term.

Quaternion ThreeGear.OpenCVCamera.Rotation
getset

The rotation component of the extrinsics matrix.

Vector3D ThreeGear.OpenCVCamera.Translation
getset

The position component of the extrinsics matrix.

The OpenCV camera model has the camera looking straight down the z axis; to get from world space points to camera space points we need to transform using this position and rotation.


The documentation for this class was generated from the following file: