IVALab Python Libraries
Collection of code for computer vision and robotics with specific API.
Public Member Functions | Public Attributes | List of all members
CameraToWorkspace Class Reference

Class for aruco calibration and point transformations from workspace to camera. More...

Public Member Functions

def __init__ (self, float markerLength, Base cam=None, cameraMatrix=None, distortionCoeffs=None, int calibrationLoops=1000, arucoDict=cv2.aruco.DICT_6X6_100)
 
def calibrate (self)
 Calculate and return the transformation gCW. More...
 
def getCameraMatrix (self)
 gets the intrinsic camera matrix More...
 
def getDistoritionCoeffs (self)
 gets the camera distortion coefficients More...
 
def getgCW (self, bwImg)
 gets the transformation from workspace to camera More...
 
def process (self, np.ndarray img, np.ndarray depth=None)
 Process function to calibrate extrinsic matrix from rgb and depth frame. More...
 

Public Attributes

 arucoDict
 the dictionary the aruco tag belongs to More...
 
 calibrationLoops
 the number of frames to get before calibrating More...
 
 cam
 the camera to be used for calibration More...
 
 cameraMatrix
 the intrinsic camera matrix More...
 
 distortionCoeffs
 the camera distortion coefficients More...
 
 gCW
 the camera to world transformation matrix More...
 
 markerLength
 the length of the aruco marker in meters More...
 
 numberOfLoops
 the number of loops currently run More...
 
 objPoints
 the coordinates of the middle of the marker More...
 

Detailed Description

Class for aruco calibration and point transformations from workspace to camera.

Parameters
[in]markerLengthlength of the aruco marker in meters
[in]camcamera used to gather frames
[in]cameraMatrixthe intrinsic camera matrix
[in]distortionCoeffsthe distortion coefficients of the camera
[in]calibrationLoopsthe number of times a frame needs to be read from the camera before the image is stable
[in]arucoDictthe predefined aruco dictionary that the marker belongs to

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
float  markerLength,
Base   cam = None,
  cameraMatrix = None,
  distortionCoeffs = None,
int   calibrationLoops = 1000,
  arucoDict = cv2.aruco.DICT_6X6_100 
)
Args:
    markerLenght (any): length of the aruco marker in meters
    cam (optional): camera used to gather frames
        - if not provided, OAK-D SR camera from camera.OAK class will be used
    cameraMatrix (optional): the intrinsic camera matrix
        - if not provided, matrix will be from yaml file for OAK-D SR camera
    distortionCoeffs (optional): the distortion coefficients of the camera
        - if not provided, coefficients will be from yaml file for OAK-D SR camera
    calibrationLoops (optional): the number of times a frame needs to be read from the camera before the image is stable
    arucoDict (optional): the predefined aruco dictionary that the marker belongs to

Member Function Documentation

◆ calibrate()

def calibrate (   self)

Calculate and return the transformation gCW.

Returns
gCW
Calculate and return the transformation gCW
Returns:
    gCW: transformation in homogeneous coordinates

◆ getCameraMatrix()

def getCameraMatrix (   self)

gets the intrinsic camera matrix

Returns
cameraMatrix
Gets the intrinsic camera matrix
Returns:
    cameraMatrix: the intrinsic camera matrix

◆ getDistoritionCoeffs()

def getDistoritionCoeffs (   self)

gets the camera distortion coefficients

Returns
distCoeffs
Gets the camera distortion coefficients
Returns:
    distCoeffs: the camera distortion coefficients

◆ getgCW()

def getgCW (   self,
  bwImg 
)

gets the transformation from workspace to camera

Parameters
[in]bwImgblack and white image containing an aruco tag
Returns
gCW
gets the transformation from workspace to camera
Args:
    bwImg (np.array (H, W)): black and white image containing an aruco tag

◆ process()

def process (   self,
np.ndarray  img,
np.ndarray   depth = None 
)

Process function to calibrate extrinsic matrix from rgb and depth frame.

Parameters
[in]imgrgb image
[in]depthdepth map
Returns
gCW
Process function to calibrate extrinsic matrix from rgb and depth frame

Args:
    img (np.ndarray (H, W, 3)): rgb image
    depth (np.ndarray (H, W), optional): Depth map. Not used
Returns:
    gCW (np.ndarray (4,4)): Extrinsic aruco-to-camera transformation matrix

Member Data Documentation

◆ arucoDict

arucoDict

the dictionary the aruco tag belongs to

◆ calibrationLoops

calibrationLoops

the number of frames to get before calibrating

◆ cam

cam

the camera to be used for calibration

◆ cameraMatrix

cameraMatrix

the intrinsic camera matrix

◆ distortionCoeffs

distortionCoeffs

the camera distortion coefficients

◆ gCW

gCW

the camera to world transformation matrix

◆ markerLength

markerLength

the length of the aruco marker in meters

◆ numberOfLoops

numberOfLoops

the number of loops currently run

◆ objPoints

objPoints

the coordinates of the middle of the marker


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