IVALab Python Libraries
Collection of code for computer vision and robotics with specific API.
Functions
camera.utils.transformations Namespace Reference

Functions

def pixelToWorkspace (np.ndarray coordinates, np.ndarray depthMap, np.ndarray gWC, np.ndarray camMTX)
 calculates the workspace coordinates given pixel coordinates and a depth map More...
 
def workspaceToPixel (np.ndarray coordinates, gCW=None, camMTX=None)
 calculates the pixel coordinates given the world coordinates More...
 

Detailed Description

@brief: useful transformations

@author: Kyle de Nobel

@note: Comments above file are for Doxygen support and are the same as the docstrings

Function Documentation

◆ pixelToWorkspace()

def camera.utils.transformations.pixelToWorkspace ( np.ndarray  coordinates,
np.ndarray  depthMap,
np.ndarray  gWC,
np.ndarray  camMTX 
)

calculates the workspace coordinates given pixel coordinates and a depth map

Parameters
[in]coordinatesan ndarray of the u,v coordinates of a pixel in an image
[in]gWCan ndarray (4, 4) of the transformation from camera to workspace
[in]camMTXan ndarray (3,3) of the camera's intrinsic parameters
[in]depthMapa 2D ndarray of the depth map of your image. This must be the same size as your color image
Returns
out an ndarray (3,1) of the X,Y,Z coordinates in the workspace frame
calculates the workspace coordinates given pixel coordinates and a depth map
Args:
    coordinates (ndarray (2,1)) : the u,v coordinates of a pixel in your image
    depthMap (ndarray (N,M)) : the depth map of your N by M image
    gWC (ndarray (4,4)) : an ndarray (4, 4) of the transformation from camera to workspace
    camMTX (ndarray (3,3)) : an ndarray (3,3) of the camera's intrinsic parameters
Returns:
    an ndarray (3,1) of the X,Y,Z coordinates in the workspace frame

◆ workspaceToPixel()

def camera.utils.transformations.workspaceToPixel ( np.ndarray  coordinates,
  gCW = None,
  camMTX = None 
)

calculates the pixel coordinates given the world coordinates

Parameters
[in]coordinatesan ndarray (3,1) of the X,Y,Z coordinates of an object in the workspace frame
[in]gCWan ndarray (4, 4) of the transformation from workspace to camera
[in]camMTXan ndarray (3,3) of the camera's intrinsic parameters
Returns
out an ndarray (2,1) of the pixel coordinates -> np.array([[u],[v]])
calculates the pixel coordinates given the world coordinates.
Args:
    coordinates (ndarray (3,1)) : the X,Y,Z coordinates of an object in the workspace frame
    gCW (ndarray (4,4)) : an ndarray (4, 4) of the transformation from workspace to camera
    camMTX (ndarray (3,3)) : an ndarray (3,3) of the camera's intrinsic parameters
Returns:
    an ndarray (2,1) of the pixel coordinates -> np.array([[u],[v]])