Module
pyPhase is a python wrapper package over I3DR’s Phase library.
- phase.pyphase.bgr2bgra(bgr: numpy.ndarray) numpy.ndarray
Convert BGR image to BGRA.
- Parameters
- bgrnumpy.ndarray
BGR image to convert
- Returns
- numpy.ndarray
BGRA image
- phase.pyphase.bgr2rgba(bgr: numpy.ndarray) numpy.ndarray
Convert BGR image to RGBA.
- Parameters
- bgrnumpy.ndarray
BGR image to convert
- Returns
- numpy.ndarray
RGBA image
- phase.pyphase.bgra2rgba(bgra: numpy.ndarray) numpy.ndarray
Convert BGRA image to RGBA.
- Parameters
- bgranumpy.ndarray
BGRA image to convert
- Returns
- numpy.ndarray
RGBA image
- phase.pyphase.cvMatIsEqual(mat1: numpy.ndarray, mat2: numpy.ndarray) bool
Check if two numpy.ndarray objects are equal.
- Parameters
- mat1numpy.ndarray
First numpy.ndarray object
- mat2numpy.ndarray
Second numpy.ndarray object
- Returns
- bool
True if equal
- phase.pyphase.depth2xyz(xyz: numpy.ndarray, hfov: float) numpy.ndarray
Calculate Point cloud (xyz) from depth image.
- Parameters
- xyznumpy.ndarray
Point cloud (xyz)
- hfovfloat
Horizontal field of view (degrees)
- Returns
- numpy.ndarray
Point cloud (xyz)
- phase.pyphase.disparity2depth(disparity: numpy.ndarray, Q: numpy.ndarray) numpy.ndarray
Calculate depth image from disparity image.
- Parameters
- disparitynumpy.ndarray
Disparity image
- Q: numpy.ndarray
Q Matrix from calibration (e.g. ‘calibration.getQ()’)
- Returns
- numpy.ndarray
Depth image
- phase.pyphase.disparity2xyz(disparity: numpy.ndarray, Q: numpy.ndarray) numpy.ndarray
Calculate point cloud (xyz) from disparity image.
- Parameters
- disparitynumpy.ndarray
Disparity image
- Q: numpy.ndarray
Q Matrix from calibration (e.g. ‘calibration.getQ()’)
- Returns
- numpy.ndarray
Point clouds (xyz)
- phase.pyphase.flip(image: numpy.ndarray, flip_code: int) numpy.ndarray
Flip image horizontally or vertically based on flip code.
- Parameters
- imagenumpy.ndarray
Image to flip
- flip_codeint
Flip code (0 = horizontal, 1 = vertical)
- Returns
- numpy.ndarray
Flipped image
- phase.pyphase.getAPIVersionMajor() int
Get major of Phase
- Returns
- valueint
- phase.pyphase.getAPIVersionMinor() int
Get minor of Phase
- Returns
- valueint
- phase.pyphase.getAPIVersionPatch() int
Get version patch of Phase
- Returns
- valueint
- phase.pyphase.getAPIVersionString() str
Get version of Phase
- Returns
- stringstr
- phase.pyphase.normaliseDisparity(disparity: numpy.ndarray) numpy.ndarray
Normalise disparity image.
- Parameters
- disparitynumpy.ndarray
Dispairty image to normalise
- Returns
- numpy.ndarray
Normalised disparity image
- phase.pyphase.readImage(image_filepath: str) numpy.ndarray
Read image from file.
- Parameters
- image_filepathstr
Filepath of image
- Returns
- numpy.ndarray
Image
- phase.pyphase.savePLY(ply_filepath: str, xyz: numpy.ndarray, rgb: numpy.ndarray) bool
Save point cloud to PLY file.
- Parameters
- ply_filepathstr
Filepath of PLY file
- xyznumpy.ndarray
Point cloud (xyz)
- rgbnumpy.ndarray
RGB image for point cloud colours
- Returns
- bool
True if successful
- phase.pyphase.scaleImage(image: numpy.ndarray, scale_factor: float) numpy.ndarray
Scale image to a new size.
- Parameters
- imagenumpy.ndarray
Image to scale
- scale_factorfloat
Scale factor to apply to image
- Returns
- numpy.ndarray
Scaled image
- phase.pyphase.showImage(window_name: str, image: numpy.ndarray) int
Display image in GUI window.
- Parameters
- window_namestr
Name of window
- imagenumpy.ndarray
Point cloud (xyz)
- phase.pyphase.toMono(image_in: numpy.ndarray, image_out: numpy.ndarray) bool
Convert image to monochrome
- Parameters
- image_innumpy.ndarray
Input image
- image_outnumpy.ndarray
Mono output image
- phase.pyphase.xyz2depth(xyz: numpy.ndarray) numpy.ndarray
Calculate depth image from point cloud (xyz).
- Parameters
- xyznumpy.ndarray
Point cloud (xyz)
- Returns
- numpy.ndarray
Depth image
custom Phase types
- class phase.pyphase.types.MatrixFloat
Bases:
pybind11_object
Matrix data (float) storage. Targeted towards storing image data.
Methods
getAt
(self, row, column, layer)Get the value of an element in the Matrix
getColumns
(self)Get number of columns in Matrix
getLayers
(self)Get number of layers in Matrix
getLength
(self)Get length of Matrix (rows * columns * layers)
getRows
(self)Get number of rows in Matrix
getSize
(self)Get size of Matrix in bytes (element_byte_size * matrix_length)
isEmpty
(self)Check if the matrix is empty
setAt
(self, row, column, layer, value)Set the value of an element in the Matrix
- getAt(self: phase.pyphase.types.MatrixFloat, row: int, column: int, layer: int) float
Get the value of an element in the Matrix
- Parameters
- rowint
- columnint
- layerint
- Returns
- datafloat
The value of data in float
- getColumns(self: phase.pyphase.types.MatrixFloat) int
Get number of columns in Matrix
- Returns
- columnsint
Column of the matrix
- getLayers(self: phase.pyphase.types.MatrixFloat) int
Get number of layers in Matrix
- Returns
- layersint
Layer of the matrix
- getLength(self: phase.pyphase.types.MatrixFloat) int
Get length of Matrix (rows * columns * layers)
- Returns
- valueint
Length of the matrix
- getRows(self: phase.pyphase.types.MatrixFloat) int
Get number of rows in Matrix
- Returns
- rowsint
Row of the matrix
- getSize(self: phase.pyphase.types.MatrixFloat) int
Get size of Matrix in bytes (element_byte_size * matrix_length)
- Returns
- valueint
Size of the matrix
- isEmpty(self: phase.pyphase.types.MatrixFloat) bool
Check if the matrix is empty
- Returns
- bool
True if empty
- setAt(self: phase.pyphase.types.MatrixFloat, row: int, column: int, layer: int, value: float) None
Set the value of an element in the Matrix
- Parameters
- rowint
- columnint
- layerint
- valuefloat
- class phase.pyphase.types.MatrixUInt8
Bases:
pybind11_object
Matrix data (uint8) storage. Targeted towards storing image data.
Methods
getAt
(self, arg0, arg1, arg2)Get the value of an element in the Matrix
getColumns
(self)Get number of columns in Matrix
getLayers
(self)Get number of layers in Matrix
getLength
(self)Get length of Matrix (rows * columns * layers)
getRows
(self)Get number of rows in Matrix
getSize
(self)Get size of Matrix in bytes (element_byte_size * matrix_length)
isEmpty
(self)Check if the matrix is empty
setAt
(self, row, column, layer, value)Set the value of an element in the Matrix
- getAt(self: phase.pyphase.types.MatrixUInt8, arg0: int, arg1: int, arg2: int) int
Get the value of an element in the Matrix
- Parameters
- rowint
- columnint
- layerint
- Returns
- dataint
The value of data in float
- getColumns(self: phase.pyphase.types.MatrixUInt8) int
Get number of columns in Matrix
- Returns
- columnsint
Column of the matrix
- getLayers(self: phase.pyphase.types.MatrixUInt8) int
Get number of layers in Matrix
- Returns
- layersint
Layer of the matrix
- getLength(self: phase.pyphase.types.MatrixUInt8) int
Get length of Matrix (rows * columns * layers)
- Returns
- valueint
Length of the matrix
- getRows(self: phase.pyphase.types.MatrixUInt8) int
Get number of rows in Matrix
- Returns
- rowsint
Row of the matrix
- getSize(self: phase.pyphase.types.MatrixUInt8) int
Get size of Matrix in bytes (element_byte_size * matrix_length)
- Returns
- valueint
Size of the matrix
- isEmpty(self: phase.pyphase.types.MatrixUInt8) bool
Check if the matrix is empty
- Returns
- bool
True if empty
- setAt(self: phase.pyphase.types.MatrixUInt8, row: int, column: int, layer: int, value: int) None
Set the value of an element in the Matrix
- Parameters
- rowint
- columnint
- layerint
- valueint
- class phase.pyphase.types.StereoImagePair
Bases:
pybind11_object
Struture to store stereo image pair (left, right)
- Attributes
- left
- right
- property left
- property right
camera calibration
- class phase.pyphase.calib.CalibrationBoardType
Bases:
pybind11_object
Enum to indicate calibration board type.
Members:
- CHECKERBOARD
Checkerboard calibration board type
- INVALID_BOARD
Invalid calibration board type
- Attributes
name
name(self: handle) -> str
- value
- CHECKERBOARD = <CalibrationBoardType.CHECKERBOARD: 0>
- INVALID_BOARD = <CalibrationBoardType.INVALID_BOARD: 1>
- property name
- property value
- class phase.pyphase.calib.CalibrationFileType
Bases:
pybind11_object
Enum to indicate calibration file type. OpenCV uses different YAML standard from ROS.
Members:
- ROS_YAML
ROS YAML calibration file type (YAML v1.2 used by ROS)
- OPENCV_YAML
OpenCV YAML calibration file type (YAML v1.0 used by OpenCV)
- INVALID_YAML
Invalid calibration file type
- Attributes
name
name(self: handle) -> str
- value
- INVALID_YAML = <CalibrationFileType.INVALID_YAML: 2>
- OPENCV_YAML = <CalibrationFileType.OPENCV_YAML: 1>
- ROS_YAML = <CalibrationFileType.ROS_YAML: 0>
- property name
- property value
- class phase.pyphase.calib.CalibrationSelection
Bases:
pybind11_object
Enum to indicate calibration from left or right camera/image
Members:
LEFT
RIGHT
- Attributes
name
name(self: handle) -> str
- value
- LEFT = <CalibrationSelection.LEFT: 0>
- RIGHT = <CalibrationSelection.RIGHT: 1>
- property name
- property value
- class phase.pyphase.calib.CameraCalibration
Bases:
pybind11_object
Store and manipulate mono camera calibration data.
Methods
calibrationFromIdeal
(width, height, ...)Create ideal calibration from camera information
getCameraCX
(self)Get camera principle point in X in calibration (in pixels)
getCameraCY
(self)Get camera principle point in Y in calibration (in pixels)
getCameraFX
(self)Get camera focal length in X in calibration (in pixels)
getCameraFY
(self)Get camera focal length in Y in calibration (in pixels)
getCameraMatrix
(self)Get the camera matrix of calibration file
Get the distortion coefficients of calibration
getDownsampleFactor
(self)Get the downsample factor
getImageHeight
(self)Get the image height from calibration
getImageWidth
(self)Get the image width from calibration
getProjectionCX
(self)Get camera principle point in X in calibration projection (in pixels)
getProjectionCY
(self)Get camera principle point in Y in calibration projection (in pixels)
getProjectionFX
(self)Get camera focal length in X in calibration projection (in pixels)
getProjectionFY
(self)Get camera focal length in Y in calibration projection (in pixels)
getProjectionMatrix
(self)Get the projection matrix of calibration
getProjectionTX
(self)Get camera baseline in calibration projection (in pixels)
getRectificationMatrix
(self)Get the rectification matrix of calibration file
isValid
(self)Check if loaded calibration is valid
rectify
(self, left_image, right_image)Rectify image based on calibration
setDownsampleFactor
(self, value)Set the downsample factor
- static calibrationFromIdeal(width: int, height: int, pixel_pitch: float, focal_length: float, translation_x: float, translation_y: float) phase.pyphase.calib.CameraCalibration
Create ideal calibration from camera information
- Parameters
- widthint
Image width of camera
- heightint
Image height of camera
- pixel_pitchfloat
Pixel pitch of camera
- focal_lengthfloat
Focal length of camera
- translation_xfloat
Translation of principle point in X
- translation_yfloat
Translation of principle point in Y
- getCameraCX(self: phase.pyphase.calib.CameraCalibration) float
Get camera principle point in X in calibration (in pixels)
- Returns
- cameraCXfloat
Principle point in X
- getCameraCY(self: phase.pyphase.calib.CameraCalibration) float
Get camera principle point in Y in calibration (in pixels)
- Returns
- cameraCYfloat
Principle point in Y
- getCameraFX(self: phase.pyphase.calib.CameraCalibration) float
Get camera focal length in X in calibration (in pixels)
- Returns
- cameraFXfloat
Focal length in X
- getCameraFY(self: phase.pyphase.calib.CameraCalibration) float
Get camera focal length in Y in calibration (in pixels)
- Returns
- cameraFYfloat
Focal length in Y
- getCameraMatrix(self: phase.pyphase.calib.CameraCalibration) numpy.ndarray
Get the camera matrix of calibration file
- Returns
- camera_matrixnumpy.ndarray
Camera matrix of calibration
- getDistortionCoefficients(self: phase.pyphase.calib.CameraCalibration) numpy.ndarray
Get the distortion coefficients of calibration
- Returns
- distortion_coefficientsnumpy.ndarray
Distortion coefficients of calibration
- getDownsampleFactor(self: phase.pyphase.calib.CameraCalibration) float
Get the downsample factor
- Returns
- valuefloat
Value of downsample factor
- getImageHeight(self: phase.pyphase.calib.CameraCalibration) int
Get the image height from calibration
- Returns
- heightint
Value of image height from calibration
- getImageWidth(self: phase.pyphase.calib.CameraCalibration) int
Get the image width from calibration
- Returns
- widthint
Value of image width from calibration
- getProjectionCX(self: phase.pyphase.calib.CameraCalibration) float
Get camera principle point in X in calibration projection (in pixels)
- Returns
- projectionCXfloat
Principle point in X
- getProjectionCY(self: phase.pyphase.calib.CameraCalibration) float
Get camera principle point in Y in calibration projection (in pixels)
- Returns
- projectionCYfloat
Principle point in Y
- getProjectionFX(self: phase.pyphase.calib.CameraCalibration) float
Get camera focal length in X in calibration projection (in pixels)
- Returns
- projectionFXfloat
Focal length in X
- getProjectionFY(self: phase.pyphase.calib.CameraCalibration) float
Get camera focal length in Y in calibration projection (in pixels)
- Returns
- projectionFYfloat
Focal length in Y
- getProjectionMatrix(self: phase.pyphase.calib.CameraCalibration) numpy.ndarray
Get the projection matrix of calibration
- Returns
- projection_matrixnumpy.ndarray
Projection matrix of calibration
- getProjectionTX(self: phase.pyphase.calib.CameraCalibration) float
Get camera baseline in calibration projection (in pixels)
- Returns
- projectionTXfloat
Baseline
- getRectificationMatrix(self: phase.pyphase.calib.CameraCalibration) numpy.ndarray
Get the rectification matrix of calibration file
- Returns
- rectification_matrixnumpy.ndarray
Rectification matrix of calibration
- isValid(self: phase.pyphase.calib.CameraCalibration) bool
Check if loaded calibration is valid
- Returns
- bool
True if calibration is valid
- rectify(self: phase.pyphase.calib.CameraCalibration, left_image: numpy.ndarray, right_image: numpy.ndarray) None
Rectify image based on calibration
- Parameters
- left_imagenumpy.ndarray
Image to rectify
- right_imagenumpy.ndarray
Image to store rectified image
- setDownsampleFactor(self: phase.pyphase.calib.CameraCalibration, value: float) None
Set the downsample factor
- Parameters
- valuefloat
- class phase.pyphase.calib.StereoCameraCalibration
Bases:
pybind11_object
Store and manipulate stereo camera calibration data.
- Attributes
left_calibration
Stores left camera calibration
right_calibration
Stores right camera calibration
Methods
calibrationFromIdeal
(width, height, ...)Create ideal stereo calibration from camera information
calibrationFromImages
(left_cal_folder, ...)Create ideal stereo calibration from camera information
calibrationFromYAML
(left_calibration, ...)Load calibration from yaml files
getBaseline
(self)Get the baseline from calibration
getDownsampleFactor
(self)Get downsample factor
getHFOV
(self)Get horitonzal Field Of View of camera from calibration
getQ
(self)Get the Q matrix
isValid
(self)Check if loaded calibration is valid
isValidSize
(self, width, height)Check if loaded calibration image width and height match specified values
rectify
(self, left_image, right_image)Rectify stereo images based on calibration
saveToYAML
(self, left_calibration_filepath, ...)Save stereo camera calibration to YAML files
setDownsampleFactor
(self, value)Set downsample factor
- static calibrationFromIdeal(width: int, height: int, pixel_pitch: float, focal_length: float, baseline: float) phase.pyphase.calib.StereoCameraCalibration
Create ideal stereo calibration from camera information
- Parameters
- widthint
Image width of cameras
- heightint
Image height of cameras
- pixel_pitchfloat
Pixel pitch of cameras
- focal_lengthfloat
Focal length of cameras
- baselinefloat
Baseline of stereo camera
- static calibrationFromImages(left_cal_folder: str, right_cal_folder: str, left_img_wildcard: str, right_img_wildcard: str, board_type: phase.pyphase.calib.CalibrationBoardType, pattern_size_x: int, pattern_size_y: int, square_size: float) phase.pyphase.calib.StereoCameraCalibration
Create ideal stereo calibration from camera information
- Parameters
- left_cal_folderstr
Path to folder with left calibration images
- right_cal_folderstr
Path to folder with right calibration images
- left_img_wildcardstr
Wildcard to use for identifying left images
- right_img_wildcardstr
Wildcard to use for identifying right images
- board_typephase.pyphase.calib.CalibrationBoardType
Calibration board type used in calibration images
- pattern_size_xint
Number of rows in calibration board pattern
- pattern_size_yint
Number of columns in calibration board pattern
- square_sizefloat
Width of single square in calibration board pattern (in meters)
- Returns
Stereo camera calibration
- static calibrationFromYAML(left_calibration: str, right_calibration: str) phase.pyphase.calib.StereoCameraCalibration
Load calibration from yaml files
- Parameters
- left_calibration_filepathstr
Left side calibration file path directory
- right_calibration_filepathstr
Right side calibration file path directory
- getBaseline(self: phase.pyphase.calib.StereoCameraCalibration) float
Get the baseline from calibration
- Returns
- valuefloat
Baseline value of calibration file
- getDownsampleFactor(self: phase.pyphase.calib.StereoCameraCalibration) float
Get downsample factor
- Returns
- valuefloat
Downsample value of calibration files
- getHFOV(self: phase.pyphase.calib.StereoCameraCalibration) float
Get horitonzal Field Of View of camera from calibration
- Returns
- fov_xfloat
Horitonzal Field Of View of camera
- getQ(self: phase.pyphase.calib.StereoCameraCalibration) numpy.ndarray
Get the Q matrix
- Returns
- Qnumpy.ndarray
Q matrix
- isValid(self: phase.pyphase.calib.StereoCameraCalibration) bool
Check if loaded calibration is valid
- Returns
- bool
True if calibration file is valid
- isValidSize(self: phase.pyphase.calib.StereoCameraCalibration, width: int, height: int) bool
Check if loaded calibration image width and height match specified values
- Parameters
- widthint
Image width to check against
- heightint
Image height to check against
- Returns
- bool
True if calibration file is valid in size
- property left_calibration
Stores left camera calibration
- rectify(self: phase.pyphase.calib.StereoCameraCalibration, left_image: numpy.ndarray, right_image: numpy.ndarray) phase.pyphase.types.StereoImagePair
Rectify stereo images based on calibration
- Parameters
- left_imagenumpy.ndarray
Left image to rectify
- right_imagenumpy.ndarray
Right image to rectify
- Returns
- rect_pairphase.pyphase.types.StereoImagePair
Rectified stereo image pair
- property right_calibration
Stores right camera calibration
- saveToYAML(self: phase.pyphase.calib.StereoCameraCalibration, left_calibration_filepath: str, right_calibration_filepath: str, cal_file_type: phase.pyphase.calib.CalibrationFileType) bool
Save stereo camera calibration to YAML files
- Parameters
- left_calibration_filepathstr
Desired path directory to save calibration file
- right_calibration_filepathstr
Desired path directory to save calibration file
- cal_file_typephase.pyphase.calib.CalibrationFileType
Type of calibration file, e.g. ROS_YAML/OPENCV_YAML
- Returns
- bool
True if calibration yaml files are saved
- setDownsampleFactor(self: phase.pyphase.calib.StereoCameraCalibration, value: float) None
Set downsample factor
- Parameters
- valuefloat
Desired value of downsample factor
stereo camera
- class phase.pyphase.stereocamera.AbstractStereoCamera
Bases:
pybind11_object
Abstract base class for building stereo camera classes. Includes functions/structures common across all stereo cameras.
Methods
connect
(self)Connect to camera
disconnect
(self)Disconnect camera
enableDataCapture
(self, enable)Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
enableHardwareTrigger
(self, enable)Enable camera hardware trigger
getCaptureCount
(self)Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
getDownsampleFactor
(self)Get the value of Downsample Factor
getFrameRate
(self)Get the value of frame rate
getHeight
(self)Get camera image height
getReadThreadResult
(self)Get results from threaded read process Should be used with startReadThread()
getWidth
(self)Get camera image width
isCapturing
(self)Check if camera is capturing
isConnected
(self)Check if camera is connected
Check if continous read thread is running Should be used with startContinousReadThread()
isReadThreadRunning
(self)Check if camera read thread is running
read
(self[, timeout])Read image frame from camera
resetCaptureCount
(self)Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
setDataCapturePath
(self, path)Set data capture path to save images Use with enableDataCapture() to toggle saving images to file
setDownsampleFactor
(self, value)Set downsample factor
setExposure
(self, value)Set exposure value of camera
setFrameRate
(self, value)Set frame rate of camera
setLeftAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for left camera
setLeftFlipX
(self, enable)Flip left image in x axis
setLeftFlipY
(self, enable)Flip left image in y axis
setReadThreadCallback
(self, callback)Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
setRightAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for right camera
setRightFlipX
(self, enable)Flip right image in x axis
setRightFlipY
(self, enable)Flip right image in y axis
setTestImagePaths
(self, ...)Set the path for test images, input both left and right image path
startCapture
(self)Start stereo camera capture Must be started before read() is called
startContinousReadThread
(self[, timeout])Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
startReadThread
(self[, timeout])Read camera thread
stopCapture
(self)Stop stereo camera capture Will no longer be able to read() after this is called
stopContinousReadThread
(self)Stop continous read thread
- connect(self: phase.pyphase.stereocamera.AbstractStereoCamera) bool
Connect to camera
- disconnect(self: phase.pyphase.stereocamera.AbstractStereoCamera) None
Disconnect camera
- enableDataCapture(self: phase.pyphase.stereocamera.AbstractStereoCamera, enable: bool) None
Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
- Parameters
- enablebool
Enable/disable saving images to file
- enableHardwareTrigger(self: phase.pyphase.stereocamera.AbstractStereoCamera, enable: bool) None
Enable camera hardware trigger
- Parameters
- enablebool
Set “True” to enable hardware trigger
- getCaptureCount(self: phase.pyphase.stereocamera.AbstractStereoCamera) int
Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
- Returns
- valueint
Number of frames captured
- getDownsampleFactor(self: phase.pyphase.stereocamera.AbstractStereoCamera) float
- Get the value of Downsample Factor
Get current downsample factor
- Returns
- valuefloat
Downsample factor
- getFrameRate(self: phase.pyphase.stereocamera.AbstractStereoCamera) float
Get the value of frame rate
- getHeight(self: phase.pyphase.stereocamera.AbstractStereoCamera) int
Get camera image height
- Returns
- valueint
Camera image height
- getReadThreadResult(self: phase.pyphase.stereocamera.AbstractStereoCamera) phase.pyphase.stereocamera.CameraReadResult
Get results from threaded read process Should be used with startReadThread()
- Returns
- CameraReadResult
Result from read
- getWidth(self: phase.pyphase.stereocamera.AbstractStereoCamera) int
Get camera image width
- Returns
- valueint
Camera image width
- isCapturing(self: phase.pyphase.stereocamera.AbstractStereoCamera) bool
Check if camera is capturing
- isConnected(self: phase.pyphase.stereocamera.AbstractStereoCamera) bool
Check if camera is connected
- isContinousReadThreadRunning(self: phase.pyphase.stereocamera.AbstractStereoCamera) bool
Check if continous read thread is running Should be used with startContinousReadThread()
- Returns
- bool
Continous read thread running status
- isReadThreadRunning(self: phase.pyphase.stereocamera.AbstractStereoCamera) bool
Check if camera read thread is running
- Returns
- bool
True if read thread is running
- read(self: phase.pyphase.stereocamera.AbstractStereoCamera, timeout: int = 1000) phase.pyphase.stereocamera.CameraReadResult
Read image frame from camera
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- leftnumpy.ndarray, rightnumpy.ndarray
Return stereo images left, right
- resetCaptureCount(self: phase.pyphase.stereocamera.AbstractStereoCamera) None
Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
- setDataCapturePath(self: phase.pyphase.stereocamera.AbstractStereoCamera, path: str) None
Set data capture path to save images Use with enableDataCapture() to toggle saving images to file
- pathstr
Directory of desired storage of captured data
- setDownsampleFactor(self: phase.pyphase.stereocamera.AbstractStereoCamera, value: float) None
Set downsample factor
- Parameters
- valuefloat
Downsample factor value
- setExposure(self: phase.pyphase.stereocamera.AbstractStereoCamera, value: int) None
Set exposure value of camera
- Parameters
- valueint
Value of exposure (us)
- setFrameRate(self: phase.pyphase.stereocamera.AbstractStereoCamera, value: float) None
Set frame rate of camera
- Parameters
- valuefloat
Value of frame rate
- setLeftAOI(self: phase.pyphase.stereocamera.AbstractStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for left camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setLeftFlipX(self: phase.pyphase.stereocamera.AbstractStereoCamera, enable: bool) None
Flip left image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setLeftFlipY(self: phase.pyphase.stereocamera.AbstractStereoCamera, enable: bool) None
Flip left image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setReadThreadCallback(self: phase.pyphase.stereocamera.AbstractStereoCamera, callback: Callable[[phase.pyphase.stereocamera.CameraReadResult], None]) None
Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
- Parameters
- fcallback
- setRightAOI(self: phase.pyphase.stereocamera.AbstractStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for right camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setRightFlipX(self: phase.pyphase.stereocamera.AbstractStereoCamera, enable: bool) None
Flip right image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setRightFlipY(self: phase.pyphase.stereocamera.AbstractStereoCamera, enable: bool) None
Flip right image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setTestImagePaths(self: phase.pyphase.stereocamera.AbstractStereoCamera, left_test_image_path: str, right_test_image_path: str) None
Set the path for test images, input both left and right image path
- Parameters
- left_test_image_pathstr
- right_test_image_pathstr
- startCapture(self: phase.pyphase.stereocamera.AbstractStereoCamera) bool
Start stereo camera capture Must be started before read() is called
- startContinousReadThread(self: phase.pyphase.stereocamera.AbstractStereoCamera, timeout: int = 1000) bool
Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
Success of starting continous read thread
- startReadThread(self: phase.pyphase.stereocamera.AbstractStereoCamera, timeout: int = 1000) bool
Read camera thread
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
True if thread was started successfully
- stopCapture(self: phase.pyphase.stereocamera.AbstractStereoCamera) None
Stop stereo camera capture Will no longer be able to read() after this is called
- stopContinousReadThread(self: phase.pyphase.stereocamera.AbstractStereoCamera) None
Stop continous read thread
- class phase.pyphase.stereocamera.CameraDeviceInfo
Bases:
pybind11_object
Camera info class contains camera serials, camera type and connection type
- Attributes
device_type
Device type in enum
interface_type
Interface type in enum
Methods
getLeftCameraSerial
(self)Get the left camera serial
getRightCameraSerial
(self)Get the right camera serial
getUniqueSerial
(self)Get the camera unique serial
setLeftCameraSerial
(self, left_camera_serial)Set the left camera serial
setRightCameraSerial
(self, right_camera_serial)Set the right camera serial
setUniqueSerial
(self, unique_serial)Set the camera unique serial
- property device_type
Device type in enum
- getLeftCameraSerial(self: phase.pyphase.stereocamera.CameraDeviceInfo) str
Get the left camera serial
- Returns
- left_camera_serialstr
- getRightCameraSerial(self: phase.pyphase.stereocamera.CameraDeviceInfo) str
Get the right camera serial
- Returns
- right_camera_serialstr
- getUniqueSerial(self: phase.pyphase.stereocamera.CameraDeviceInfo) str
Get the camera unique serial
- Returns
- unique_serialstr
- property interface_type
Interface type in enum
- setLeftCameraSerial(self: phase.pyphase.stereocamera.CameraDeviceInfo, left_camera_serial: str) None
Set the left camera serial
- Parameters
- left_camera_serialstr
- setRightCameraSerial(self: phase.pyphase.stereocamera.CameraDeviceInfo, right_camera_serial: str) None
Set the right camera serial
- Parameters
- right_camera_serialstr
- setUniqueSerial(self: phase.pyphase.stereocamera.CameraDeviceInfo, unique_serial: str) None
Set the camera unique serial
- Parameters
- unique_serialstr
- class phase.pyphase.stereocamera.CameraDeviceType
Bases:
pybind11_object
Structure of CameraDeviceType
Members:
DEVICE_TYPE_GENERIC_PYLON
DEVICE_TYPE_GENERIC_UVC
DEVICE_TYPE_DEIMOS
DEVICE_TYPE_PHOBOS
DEVICE_TYPE_TITANIA
DEVICE_TYPE_INVALID
- Attributes
name
name(self: handle) -> str
- value
- DEVICE_TYPE_DEIMOS = <CameraDeviceType.DEVICE_TYPE_DEIMOS: 2>
- DEVICE_TYPE_GENERIC_PYLON = <CameraDeviceType.DEVICE_TYPE_GENERIC_PYLON: 0>
- DEVICE_TYPE_GENERIC_UVC = <CameraDeviceType.DEVICE_TYPE_GENERIC_UVC: 1>
- DEVICE_TYPE_INVALID = <CameraDeviceType.DEVICE_TYPE_INVALID: 5>
- DEVICE_TYPE_PHOBOS = <CameraDeviceType.DEVICE_TYPE_PHOBOS: 3>
- DEVICE_TYPE_TITANIA = <CameraDeviceType.DEVICE_TYPE_TITANIA: 4>
- property name
- property value
- class phase.pyphase.stereocamera.CameraInterfaceType
Bases:
pybind11_object
Structure of CameraInterfaceType
Members:
INTERFACE_TYPE_USB
INTERFACE_TYPE_GIGE
INTERFACE_TYPE_VIRTUAL
- Attributes
name
name(self: handle) -> str
- value
- INTERFACE_TYPE_GIGE = <CameraInterfaceType.INTERFACE_TYPE_GIGE: 1>
- INTERFACE_TYPE_USB = <CameraInterfaceType.INTERFACE_TYPE_USB: 0>
- INTERFACE_TYPE_VIRTUAL = <CameraInterfaceType.INTERFACE_TYPE_VIRTUAL: 2>
- property name
- property value
- class phase.pyphase.stereocamera.CameraReadResult
Bases:
pybind11_object
Struture to store the result from reading a camera frame. Used in the stereo camera classes.
- Attributes
- left
- right
- valid
- property left
- property right
- property valid
- class phase.pyphase.stereocamera.DeimosStereoCamera
Bases:
pybind11_object
Capture data from I3DR’s Deimos stereo camera.
Methods
connect
(self)Connect to camera
disconnect
(self)Disconnect camera
enableDataCapture
(self, enable)Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
enableHardwareTrigger
(self, enable)Enable camera hardware trigger
getCaptureCount
(self)Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
getDownsampleFactor
(self)Get current downsample factor
getFrameRate
(self)Get the value of frame rate
getHeight
(self)Get camera image height
getReadThreadResult
(self)Get results from threaded read process Should be used with startReadThread()
getWidth
(self)Get camera image width
isCapturing
(self)Check if camera is capturing
isConnected
(self)Check if camera is connected
Check if continous read thread is running Should be used with startContinousReadThread()
isReadThreadRunning
(self)Check if camera read thread is running
read
(self[, timeout])Read image frame from camera
resetCaptureCount
(self)Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
setDataCapturePath
(self, path)Set path of saved directory for capture data
setDownsampleFactor
(self, value)Set downsample factor
setExposure
(self, value)Set exposure value of camera
setFrameRate
(self, value)Set frame rate of camera
setLeftAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for left camera
setLeftFlipX
(self, enable)Flip left image in x axis
setLeftFlipY
(self, enable)Flip left image in y axis
setReadThreadCallback
(self, callback)Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
setRightAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for right camera
setRightFlipX
(self, enable)Flip right image in x axis
setRightFlipY
(self, enable)Flip right image in y axis
setTestImagePaths
(self, ...)Set the path for test images, input both left and right image path
startCapture
(self)Start stereo camera capture Must be started before read() is called
startContinousReadThread
(self[, timeout])Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
startReadThread
(self[, timeout])Read camera thread
stopCapture
(self)Stop stereo camera capture Will no longer be able to read() after this is called
stopContinousReadThread
(self)Stop continous read thread
- connect(self: phase.pyphase.stereocamera.DeimosStereoCamera) bool
Connect to camera
- disconnect(self: phase.pyphase.stereocamera.DeimosStereoCamera) None
Disconnect camera
- enableDataCapture(self: phase.pyphase.stereocamera.DeimosStereoCamera, enable: bool) None
Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
- Parameters
- enablebool
Enable/disable saving images to file
- enableHardwareTrigger(self: phase.pyphase.stereocamera.DeimosStereoCamera, enable: bool) None
Enable camera hardware trigger
- Parameters
- enablebool
Set “True” to enable hardware trigger
- getCaptureCount(self: phase.pyphase.stereocamera.DeimosStereoCamera) int
Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
- Returns
- valueint
Number of frames captured
- getDownsampleFactor(self: phase.pyphase.stereocamera.DeimosStereoCamera) float
Get current downsample factor
- Returns
- valuefloat
Downsample factor
- getFrameRate(self: phase.pyphase.stereocamera.DeimosStereoCamera) float
Get the value of frame rate
- getHeight(self: phase.pyphase.stereocamera.DeimosStereoCamera) int
Get camera image height
- Returns
- valueint
Camera image height
- getReadThreadResult(self: phase.pyphase.stereocamera.DeimosStereoCamera) phase.pyphase.stereocamera.CameraReadResult
Get results from threaded read process Should be used with startReadThread()
- Returns
- CameraReadResult
Result from read
- getWidth(self: phase.pyphase.stereocamera.DeimosStereoCamera) int
Get camera image width
- Returns
- valueint
Camera image width
- isCapturing(self: phase.pyphase.stereocamera.DeimosStereoCamera) bool
Check if camera is capturing
- isConnected(self: phase.pyphase.stereocamera.DeimosStereoCamera) bool
Check if camera is connected
- isContinousReadThreadRunning(self: phase.pyphase.stereocamera.DeimosStereoCamera) bool
Check if continous read thread is running Should be used with startContinousReadThread()
- Returns
- bool
Continous read thread running status
- isReadThreadRunning(self: phase.pyphase.stereocamera.DeimosStereoCamera) bool
Check if camera read thread is running
- Returns
- bool
True if read thread is running
- read(self: phase.pyphase.stereocamera.DeimosStereoCamera, timeout: int = 1000) phase.pyphase.stereocamera.CameraReadResult
Read image frame from camera
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- ——-
- CameraReadResult
result from camera read
- resetCaptureCount(self: phase.pyphase.stereocamera.DeimosStereoCamera) None
Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
- setDataCapturePath(self: phase.pyphase.stereocamera.DeimosStereoCamera, path: str) None
Set path of saved directory for capture data
- pathstr
Directory of desired capture data storage
- setDownsampleFactor(self: phase.pyphase.stereocamera.DeimosStereoCamera, value: float) None
Set downsample factor
- Parameters
- valuefloat
Downsample factor value
- setExposure(self: phase.pyphase.stereocamera.DeimosStereoCamera, value: int) None
Set exposure value of camera
- Parameters
- valueint
Value of exposure (us)
- setFrameRate(self: phase.pyphase.stereocamera.DeimosStereoCamera, value: float) None
Set frame rate of camera
- Parameters
- valuefloat
Value of frame rate
- setLeftAOI(self: phase.pyphase.stereocamera.DeimosStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for left camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setLeftFlipX(self: phase.pyphase.stereocamera.DeimosStereoCamera, enable: bool) None
Flip left image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setLeftFlipY(self: phase.pyphase.stereocamera.DeimosStereoCamera, enable: bool) None
Flip left image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setReadThreadCallback(self: phase.pyphase.stereocamera.DeimosStereoCamera, callback: Callable[[phase.pyphase.stereocamera.CameraReadResult], None]) None
Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
- Parameters
- fcallback
- setRightAOI(self: phase.pyphase.stereocamera.DeimosStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for right camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setRightFlipX(self: phase.pyphase.stereocamera.DeimosStereoCamera, enable: bool) None
Flip right image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setRightFlipY(self: phase.pyphase.stereocamera.DeimosStereoCamera, enable: bool) None
Flip right image in y axis
- Parameters
- enablebool
Set “True” to flip image
- DeimosStereoCamera.setTestImagePaths(self: phase.pyphase.stereocamera.DeimosStereoCamera, left_test_image_path: str, left_test_image_path: str) -> None
Set the path for test images, input both left and right image path
- Parameters
- left_test_image_pathstr
- right_test_image_pathstr
- startCapture(self: phase.pyphase.stereocamera.DeimosStereoCamera) bool
Start stereo camera capture Must be started before read() is called
- startContinousReadThread(self: phase.pyphase.stereocamera.DeimosStereoCamera, timeout: int = 1000) bool
Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
Success of starting continous read thread
- startReadThread(self: phase.pyphase.stereocamera.DeimosStereoCamera, timeout: int = 1000) bool
Read camera thread
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
True if thread was started successfully
- stopCapture(self: phase.pyphase.stereocamera.DeimosStereoCamera) None
Stop stereo camera capture Will no longer be able to read() after this is called
- stopContinousReadThread(self: phase.pyphase.stereocamera.DeimosStereoCamera) None
Stop continous read thread
- class phase.pyphase.stereocamera.PhobosStereoCamera
Bases:
pybind11_object
Capture data from I3DR’s Phobos stereo camera.
Methods
availableDevices
(self)Get the list of connected Phobos cameras
connect
(self)Connect to camera
disconnect
(self)Disconnect camera
enableDataCapture
(self, enable)Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
enableHardwareTrigger
(self, enable)Enable camera hardware trigger
getCaptureCount
(self)Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
getDownsampleFactor
(self)Get current downsample factor
getFrameRate
(self)Get the value of frame rate
getHeight
(self)Get camera image height
getReadThreadResult
(self)Get results from threaded read process Should be used with startReadThread()
getWidth
(self)Get camera image width
isCapturing
(self)Check if camera is capturing
isConnected
(self)Check if camera is connected
Check if continous read thread is running Should be used with startContinousReadThread()
isReadThreadRunning
(self)Check if camera read thread is running
read
(self[, timeout])Read image frame from camera
resetCaptureCount
(self)Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
setDataCapturePath
(self, path)Set path of saved directory for capture data
setDownsampleFactor
(self, value)Set downsample factor
setExposure
(self, value)Set exposure value of camera
setFrameRate
(self, value)Set frame rate of camera
setLeftAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for left camera
setLeftFlipX
(self, enable)Flip left image in x axis
setLeftFlipY
(self, enable)Flip left image in y axis
setReadThreadCallback
(self, callback)Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
setRightAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for right camera
setRightFlipX
(self, enable)Flip right image in x axis
setRightFlipY
(self, enable)Flip right image in y axis
setTestImagePaths
(self, ...)Set the path for test images, input both left and right image path
startCapture
(self)Start stereo camera capture Must be started before read() is called
startContinousReadThread
(self[, timeout])Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
startReadThread
(self[, timeout])Read camera thread
stopCapture
(self)Stop stereo camera capture Will no longer be able to read() after this is called
stopContinousReadThread
(self)Stop continous read thread
- availableDevices(self: Pylon::CTlFactory) List[phase.pyphase.stereocamera.CameraDeviceInfo]
Get the list of connected Phobos cameras
- Returns
- numpy.array
List of connected camera in CameraDeviceInfo type
- connect(self: phase.pyphase.stereocamera.PhobosStereoCamera) bool
Connect to camera
- disconnect(self: phase.pyphase.stereocamera.PhobosStereoCamera) None
Disconnect camera
- enableDataCapture(self: phase.pyphase.stereocamera.PhobosStereoCamera, enable: bool) None
Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
- Parameters
- enablebool
Enable/disable saving images to file
- enableHardwareTrigger(self: phase.pyphase.stereocamera.PhobosStereoCamera, enable: bool) None
Enable camera hardware trigger
- Parameters
- enablebool
Set “True” to enable hardware trigger
- getCaptureCount(self: phase.pyphase.stereocamera.PhobosStereoCamera) int
Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
- Returns
- valueint
Number of frames captured
- getDownsampleFactor(self: phase.pyphase.stereocamera.PhobosStereoCamera) float
Get current downsample factor
- Returns
- valuefloat
Downsample factor
- getFrameRate(self: phase.pyphase.stereocamera.PhobosStereoCamera) float
Get the value of frame rate
- getHeight(self: phase.pyphase.stereocamera.PhobosStereoCamera) int
Get camera image height
- Returns
- valueint
Camera image height
- getReadThreadResult(self: phase.pyphase.stereocamera.PhobosStereoCamera) phase.pyphase.stereocamera.CameraReadResult
Get results from threaded read process Should be used with startReadThread()
- Returns
- CameraReadResult
Result from read
- getWidth(self: phase.pyphase.stereocamera.PhobosStereoCamera) int
Get camera image width
- Returns
- valueint
Camera image width
- isCapturing(self: phase.pyphase.stereocamera.PhobosStereoCamera) bool
Check if camera is capturing
- isConnected(self: phase.pyphase.stereocamera.PhobosStereoCamera) bool
Check if camera is connected
- isContinousReadThreadRunning(self: phase.pyphase.stereocamera.PhobosStereoCamera) bool
Check if continous read thread is running Should be used with startContinousReadThread()
- Returns
- bool
Continous read thread running status
- isReadThreadRunning(self: phase.pyphase.stereocamera.PhobosStereoCamera) bool
Check if camera read thread is running
- Returns
- bool
True if read thread is running
- read(self: phase.pyphase.stereocamera.PhobosStereoCamera, timeout: int = 1000) phase.pyphase.stereocamera.CameraReadResult
Read image frame from camera
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- ——-
- CameraReadResult
result from camera read
- resetCaptureCount(self: phase.pyphase.stereocamera.PhobosStereoCamera) None
Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
- setDataCapturePath(self: phase.pyphase.stereocamera.PhobosStereoCamera, path: str) None
Set path of saved directory for capture data
- pathstr
Directory of desired capture data storage
- setDownsampleFactor(self: phase.pyphase.stereocamera.PhobosStereoCamera, value: float) None
Set downsample factor
- Parameters
- valuefloat
Downsample factor value
- setExposure(self: phase.pyphase.stereocamera.PhobosStereoCamera, value: int) None
Set exposure value of camera
- Parameters
- valueint
Value of exposure (us)
- setFrameRate(self: phase.pyphase.stereocamera.PhobosStereoCamera, value: float) None
Set frame rate of camera
- Parameters
- valuefloat
Value of frame rate
- setLeftAOI(self: phase.pyphase.stereocamera.PhobosStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for left camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setLeftFlipX(self: phase.pyphase.stereocamera.PhobosStereoCamera, enable: bool) None
Flip left image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setLeftFlipY(self: phase.pyphase.stereocamera.PhobosStereoCamera, enable: bool) None
Flip left image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setReadThreadCallback(self: phase.pyphase.stereocamera.PhobosStereoCamera, callback: Callable[[phase.pyphase.stereocamera.CameraReadResult], None]) None
Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
- Parameters
- fcallback
- setRightAOI(self: phase.pyphase.stereocamera.PhobosStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for right camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setRightFlipX(self: phase.pyphase.stereocamera.PhobosStereoCamera, enable: bool) None
Flip right image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setRightFlipY(self: phase.pyphase.stereocamera.PhobosStereoCamera, enable: bool) None
Flip right image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setTestImagePaths(self: phase.pyphase.stereocamera.PhobosStereoCamera, left_test_image_path: str, right_test_image_path: str) None
Set the path for test images, input both left and right image path
- Parameters
- left_test_image_pathstr
- right_test_image_pathstr
- startCapture(self: phase.pyphase.stereocamera.PhobosStereoCamera) bool
Start stereo camera capture Must be started before read() is called
- startContinousReadThread(self: phase.pyphase.stereocamera.PhobosStereoCamera, timeout: int = 1000) bool
Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
Success of starting continous read thread
- startReadThread(self: phase.pyphase.stereocamera.PhobosStereoCamera, timeout: int = 1000) bool
Read camera thread
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
True if thread was started successfully
- stopCapture(self: phase.pyphase.stereocamera.PhobosStereoCamera) None
Stop stereo camera capture Will no longer be able to read() after this is called
- stopContinousReadThread(self: phase.pyphase.stereocamera.PhobosStereoCamera) None
Stop continous read thread
- class phase.pyphase.stereocamera.PylonStereoCamera
Bases:
pybind11_object
Capture data from a stereo camera using Basler cameras via the Pylon API
Methods
availableDevices
(self)Get the list of connected Pylon cameras
connect
(self)Connect to camera
disconnect
(self)Disconnect camera
enableDataCapture
(self, enable)Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
enableHardwareTrigger
(self, enable)Enable camera hardware trigger
getCaptureCount
(self)Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
getDownsampleFactor
(self)Get current downsample factor
getFrameRate
(self)Get the value of frame rate
getHeight
(self)Get camera image height
getReadThreadResult
(self)Get results from threaded read process Should be used with startReadThread()
getWidth
(self)Get camera image width
isCapturing
(self)Check if camera is capturing
isConnected
(self)Check if camera is connected
Check if continous read thread is running Should be used with startContinousReadThread()
isReadThreadRunning
(self)Check if camera read thread is running
read
(self[, timeout])Read image frame from camera
resetCaptureCount
(self)Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
setDataCapturePath
(self, path)Set path of saved directory for capture data
setDownsampleFactor
(self, value)Set downsample factor
setExposure
(self, value)Set exposure value of camera
setFrameRate
(self, value)Set frame rate of camera
setLeftAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for left camera
setLeftFlipX
(self, enable)Flip left image in x axis
setLeftFlipY
(self, enable)Flip left image in y axis
setReadThreadCallback
(self, callback)Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
setRightAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for right camera
setRightFlipX
(self, enable)Flip right image in x axis
setRightFlipY
(self, enable)Flip right image in y axis
setTestImagePaths
(self, ...)Set the path for test images, input both left and right image path
startCapture
(self)Start stereo camera capture Must be started before read() is called
startContinousReadThread
(self[, timeout])Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
startReadThread
(self[, timeout])Read camera thread
stopCapture
(self)Stop stereo camera capture Will no longer be able to read() after this is called
stopContinousReadThread
(self)Stop continous read thread
- availableDevices(self: Pylon::CTlFactory) List[phase.pyphase.stereocamera.CameraDeviceInfo]
Get the list of connected Pylon cameras
- Returns
- numpy.array
List of connected camera in CameraDeviceInfo type
- connect(self: phase.pyphase.stereocamera.PylonStereoCamera) bool
Connect to camera
- disconnect(self: phase.pyphase.stereocamera.PylonStereoCamera) None
Disconnect camera
- enableDataCapture(self: phase.pyphase.stereocamera.PylonStereoCamera, enable: bool) None
Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
- Parameters
- enablebool
Enable/disable saving images to file
- enableHardwareTrigger(self: phase.pyphase.stereocamera.PylonStereoCamera, enable: bool) None
Enable camera hardware trigger
- Parameters
- enablebool
Set “True” to enable hardware trigger
- getCaptureCount(self: phase.pyphase.stereocamera.PylonStereoCamera) int
Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
- Returns
- valueint
Number of frames captured
- getDownsampleFactor(self: phase.pyphase.stereocamera.PylonStereoCamera) float
Get current downsample factor
- Returns
- valuefloat
Downsample factor
- getFrameRate(self: phase.pyphase.stereocamera.PylonStereoCamera) float
Get the value of frame rate
- getHeight(self: phase.pyphase.stereocamera.PylonStereoCamera) int
Get camera image height
- Returns
- valueint
Camera image height
- getReadThreadResult(self: phase.pyphase.stereocamera.PylonStereoCamera) phase.pyphase.stereocamera.CameraReadResult
Get results from threaded read process Should be used with startReadThread()
- Returns
- CameraReadResult
Result from read
- getWidth(self: phase.pyphase.stereocamera.PylonStereoCamera) int
Get camera image width
- Returns
- valueint
Camera image width
- isCapturing(self: phase.pyphase.stereocamera.PylonStereoCamera) bool
Check if camera is capturing
- isConnected(self: phase.pyphase.stereocamera.PylonStereoCamera) bool
Check if camera is connected
- isContinousReadThreadRunning(self: phase.pyphase.stereocamera.PylonStereoCamera) bool
Check if continous read thread is running Should be used with startContinousReadThread()
- Returns
- bool
Continous read thread running status
- isReadThreadRunning(self: phase.pyphase.stereocamera.PylonStereoCamera) bool
Check if camera read thread is running
- Returns
- bool
True if read thread is running
- read(self: phase.pyphase.stereocamera.PylonStereoCamera, timeout: int = 1000) phase.pyphase.stereocamera.CameraReadResult
Read image frame from camera
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- ——-
- CameraReadResult
Result from camera read
- resetCaptureCount(self: phase.pyphase.stereocamera.PylonStereoCamera) None
Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
- setDataCapturePath(self: phase.pyphase.stereocamera.PylonStereoCamera, path: str) None
Set path of saved directory for capture data
- pathstr
Directory of desired capture data storage
- setDownsampleFactor(self: phase.pyphase.stereocamera.PylonStereoCamera, value: float) None
Set downsample factor
- Parameters
- valuefloat
Downsample factor value
- setExposure(self: phase.pyphase.stereocamera.PylonStereoCamera, value: int) None
Set exposure value of camera
- Parameters
- valueint
Value of exposure (us)
- setFrameRate(self: phase.pyphase.stereocamera.PylonStereoCamera, value: float) None
Set frame rate of camera
- Parameters
- valuefloat
Value of frame rate
- setLeftAOI(self: phase.pyphase.stereocamera.PylonStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for left camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setLeftFlipX(self: phase.pyphase.stereocamera.PylonStereoCamera, enable: bool) None
Flip left image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setLeftFlipY(self: phase.pyphase.stereocamera.PylonStereoCamera, enable: bool) None
Flip left image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setReadThreadCallback(self: phase.pyphase.stereocamera.PylonStereoCamera, callback: Callable[[phase.pyphase.stereocamera.CameraReadResult], None]) None
Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
- Parameters
- fcallback
- setRightAOI(self: phase.pyphase.stereocamera.PylonStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for right camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setRightFlipX(self: phase.pyphase.stereocamera.PylonStereoCamera, enable: bool) None
Flip right image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setRightFlipY(self: phase.pyphase.stereocamera.PylonStereoCamera, enable: bool) None
Flip right image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setTestImagePaths(self: phase.pyphase.stereocamera.PylonStereoCamera, left_test_image_path: str, right_test_image_path: str) None
Set the path for test images, input both left and right image path
- Parameters
- left_test_image_pathstr
- right_test_image_pathstr
- startCapture(self: phase.pyphase.stereocamera.PylonStereoCamera) bool
Start stereo camera capture Must be started before read() is called
- startContinousReadThread(self: phase.pyphase.stereocamera.PylonStereoCamera, timeout: int = 1000) bool
Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
Success of starting continous read thread
- startReadThread(self: phase.pyphase.stereocamera.PylonStereoCamera, timeout: int = 1000) bool
Read camera thread
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
True if thread was started successfully
- stopCapture(self: phase.pyphase.stereocamera.PylonStereoCamera) None
Stop stereo camera capture Will no longer be able to read() after this is called
- stopContinousReadThread(self: phase.pyphase.stereocamera.PylonStereoCamera) None
Stop continous read thread
- class phase.pyphase.stereocamera.TitaniaStereoCamera
Bases:
pybind11_object
Capture data from I3DR’s Titania stereo camera.
Methods
availableDevices
(self)Get the list of connected Titania cameras
connect
(self)Connect to camera
disconnect
(self)Disconnect camera
enableDataCapture
(self, enable)Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
enableHardwareTrigger
(self, enable)Enable camera hardware trigger
getCaptureCount
(self)Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
getDownsampleFactor
(self)Get current downsample factor
getFrameRate
(self)Get the value of frame rate
getHeight
(self)Get camera image height
getReadThreadResult
(self)Get results from threaded read process Should be used with startReadThread()
getWidth
(self)Get camera image width
isCapturing
(self)Check if camera is capturing
isConnected
(self)Check if camera is connected
Check if continous read thread is running Should be used with startContinousReadThread()
isReadThreadRunning
(self)Check if camera read thread is running
read
(self[, timeout])Read image frame from camera
resetCaptureCount
(self)Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
setDataCapturePath
(self, path)Set data capture path to save images Use with enableDataCapture() to toggle saving images to file
setDownsampleFactor
(self, value)Set downsample factor
setExposure
(self, value)Set exposure value of camera
setFrameRate
(self, value)Set frame rate of camera
setLeftAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for left camera
setLeftFlipX
(self, enable)Flip left image in x axis
setLeftFlipY
(self, enable)Flip left image in y axis
setReadThreadCallback
(self, callback)Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
setRightAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for right camera
setRightFlipX
(self, enable)Flip right image in x axis
setRightFlipY
(self, enable)Flip right image in y axis
setTestImagePaths
(self, ...)Set the path for test images, input both left and right image path
startCapture
(self)Start stereo camera capture Must be started before read() is called
startContinousReadThread
(self[, timeout])Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
startReadThread
(self[, timeout])Read camera thread
stopCapture
(self)Stop stereo camera capture Will no longer be able to read() after this is called
stopContinousReadThread
(self)Stop continous read thread
- availableDevices(self: Pylon::CTlFactory) List[phase.pyphase.stereocamera.CameraDeviceInfo]
Get the list of connected Titania cameras
- Returns
- numpy.array
List of connected camera in CameraDeviceInfo type
- connect(self: phase.pyphase.stereocamera.TitaniaStereoCamera) bool
Connect to camera
- disconnect(self: phase.pyphase.stereocamera.TitaniaStereoCamera) None
Disconnect camera
- enableDataCapture(self: phase.pyphase.stereocamera.TitaniaStereoCamera, enable: bool) None
Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
- Parameters
- enablebool
Enable/disable saving images to file
- enableHardwareTrigger(self: phase.pyphase.stereocamera.TitaniaStereoCamera, enable: bool) None
Enable camera hardware trigger
- Parameters
- enablebool
Set “True” to enable hardware trigger
- getCaptureCount(self: phase.pyphase.stereocamera.TitaniaStereoCamera) int
Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
- Returns
- valueint
Number of frames captured
- getDownsampleFactor(self: phase.pyphase.stereocamera.TitaniaStereoCamera) float
Get current downsample factor
- Returns
- valuefloat
Downsample factor
- getFrameRate(self: phase.pyphase.stereocamera.TitaniaStereoCamera) float
Get the value of frame rate
- getHeight(self: phase.pyphase.stereocamera.TitaniaStereoCamera) int
Get camera image height
- Returns
- valueint
Camera image height
- getReadThreadResult(self: phase.pyphase.stereocamera.TitaniaStereoCamera) phase.pyphase.stereocamera.CameraReadResult
Get results from threaded read process Should be used with startReadThread()
- Returns
- CameraReadResult
Result from read
- getWidth(self: phase.pyphase.stereocamera.TitaniaStereoCamera) int
Get camera image width
- Returns
- valueint
Camera image width
- isCapturing(self: phase.pyphase.stereocamera.TitaniaStereoCamera) bool
Check if camera is capturing
- isConnected(self: phase.pyphase.stereocamera.TitaniaStereoCamera) bool
Check if camera is connected
- isContinousReadThreadRunning(self: phase.pyphase.stereocamera.TitaniaStereoCamera) bool
Check if continous read thread is running Should be used with startContinousReadThread()
- Returns
- bool
Continous read thread running status
- isReadThreadRunning(self: phase.pyphase.stereocamera.TitaniaStereoCamera) bool
Check if camera read thread is running
- Returns
- bool
True if read thread is running
- read(self: phase.pyphase.stereocamera.TitaniaStereoCamera, timeout: int = 1000) phase.pyphase.stereocamera.CameraReadResult
Read image frame from camera
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- ——-
- CameraReadResult
Result from camera read
- resetCaptureCount(self: phase.pyphase.stereocamera.TitaniaStereoCamera) None
Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
- setDataCapturePath(self: phase.pyphase.stereocamera.TitaniaStereoCamera, path: str) None
Set data capture path to save images Use with enableDataCapture() to toggle saving images to file
- pathstr
Directory of desired capture data storage
- setDownsampleFactor(self: phase.pyphase.stereocamera.TitaniaStereoCamera, value: float) None
Set downsample factor
- Parameters
- valuefloat
Downsample factor value
- setExposure(self: phase.pyphase.stereocamera.TitaniaStereoCamera, value: int) None
Set exposure value of camera
- Parameters
- valueint
Value of exposure (us)
- setFrameRate(self: phase.pyphase.stereocamera.TitaniaStereoCamera, value: float) None
Set frame rate of camera
- Parameters
- valuefloat
Value of frame rate
- setLeftAOI(self: phase.pyphase.stereocamera.TitaniaStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for left camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setLeftFlipX(self: phase.pyphase.stereocamera.TitaniaStereoCamera, enable: bool) None
Flip left image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setLeftFlipY(self: phase.pyphase.stereocamera.TitaniaStereoCamera, enable: bool) None
Flip left image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setReadThreadCallback(self: phase.pyphase.stereocamera.TitaniaStereoCamera, callback: Callable[[phase.pyphase.stereocamera.CameraReadResult], None]) None
Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
- Parameters
- fcallback
- setRightAOI(self: phase.pyphase.stereocamera.TitaniaStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for right camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setRightFlipX(self: phase.pyphase.stereocamera.TitaniaStereoCamera, enable: bool) None
Flip right image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setRightFlipY(self: phase.pyphase.stereocamera.TitaniaStereoCamera, enable: bool) None
Flip right image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setTestImagePaths(self: phase.pyphase.stereocamera.TitaniaStereoCamera, left_test_image_path: str, right_test_image_path: str) None
Set the path for test images, input both left and right image path
- Parameters
- left_test_image_pathstr
- right_test_image_pathstr
- startCapture(self: phase.pyphase.stereocamera.TitaniaStereoCamera) bool
Start stereo camera capture Must be started before read() is called
- startContinousReadThread(self: phase.pyphase.stereocamera.TitaniaStereoCamera, timeout: int = 1000) bool
Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
success of starting continous read thread
- startReadThread(self: phase.pyphase.stereocamera.TitaniaStereoCamera, timeout: int = 1000) bool
Read camera thread
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
True if thread was started successfully
- stopCapture(self: phase.pyphase.stereocamera.TitaniaStereoCamera) None
Stop stereo camera capture Will no longer be able to read() after this is called
- stopContinousReadThread(self: phase.pyphase.stereocamera.TitaniaStereoCamera) None
Stop continous read thread
- class phase.pyphase.stereocamera.UVCStereoCamera
Bases:
pybind11_object
UVC Stereo Camera class Capture data from a stereo camera using UVC cameras where left and right is transported via green and red channels.
Methods
connect
(self)Connect to camera
disconnect
(self)Disconnect camera
enableDataCapture
(self, enable)Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
enableHardwareTrigger
(self, enable)Enable camera hardware trigger
getCaptureCount
(self)Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
getDownsampleFactor
(self)Get current downsample factor
getFrameRate
(self)Get the value of frame rate
getHeight
(self)Get camera image height
getReadThreadResult
(self)Get results from threaded read process Should be used with startReadThread()
getWidth
(self)Get camera image width
isCapturing
(self)Check if camera is capturing
isConnected
(self)Check if camera is connected
Check if continous read thread is running Should be used with startContinousReadThread()
isReadThreadRunning
(self)Check if camera read thread is running
read
(self[, timeout])Read image frame from camera
resetCaptureCount
(self)Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
setDataCapturePath
(self, path)Set data capture path to save images Use with enableDataCapture() to toggle saving images to file
setDownsampleFactor
(self, value)Set downsample factor
setExposure
(self, value)Set exposure value of camera
setFrameRate
(self, value)Set frame rate of camera
setLeftAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for left camera
setLeftFlipX
(self, enable)Flip left image in x axis
setLeftFlipY
(self, enable)Flip left image in y axis
setReadThreadCallback
(self, callback)Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
setRightAOI
(self, x_min, y_min, x_max, y_max)To set area of interest for right camera
setRightFlipX
(self, enable)Flip right image in x axis
setRightFlipY
(self, enable)Flip right image in y axis
setTestImagePaths
(self, ...)Set the path for test images, input both left and right image path
startCapture
(self)Start stereo camera capture Must be started before read() is called
startContinousReadThread
(self[, timeout])Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
startReadThread
(self[, timeout])Read camera thread
stopCapture
(self)Stop stereo camera capture Will no longer be able to read() after this is called
stopContinousReadThread
(self)Stop continous read thread
- connect(self: phase.pyphase.stereocamera.UVCStereoCamera) bool
Connect to camera
- disconnect(self: phase.pyphase.stereocamera.UVCStereoCamera) None
Disconnect camera
- enableDataCapture(self: phase.pyphase.stereocamera.UVCStereoCamera, enable: bool) None
Enable/disable saving captured images to file Use with setDataCapturePath() to set path to save images
- Parameters
- enablebool
Enable/disable saving images to file
- enableHardwareTrigger(self: phase.pyphase.stereocamera.UVCStereoCamera, enable: bool) None
Enable camera hardware trigger
- Parameters
- enablebool
Set “True” to enable hardware trigger
- getCaptureCount(self: phase.pyphase.stereocamera.UVCStereoCamera) int
Get number of frames captured since initalisation of the camera or last count reset Use with resetFrameCount() to reset frame count
- Returns
- valueint
Number of frames captured
- getDownsampleFactor(self: phase.pyphase.stereocamera.UVCStereoCamera) float
Get current downsample factor
- Returns
- valuefloat
Downsample factor
- getFrameRate(self: phase.pyphase.stereocamera.UVCStereoCamera) float
Get the value of frame rate
- getHeight(self: phase.pyphase.stereocamera.UVCStereoCamera) int
Get camera image height
- Returns
- valueint
Camera image height
- getReadThreadResult(self: phase.pyphase.stereocamera.UVCStereoCamera) phase.pyphase.stereocamera.CameraReadResult
Get results from threaded read process Should be used with startReadThread()
- Returns
- CameraReadResult
Result from read
- getWidth(self: phase.pyphase.stereocamera.UVCStereoCamera) int
Get camera image width
- Returns
- valueint
Camera image width
- isCapturing(self: phase.pyphase.stereocamera.UVCStereoCamera) bool
Check if camera is capturing
- isConnected(self: phase.pyphase.stereocamera.UVCStereoCamera) bool
Check if camera is connected
- isContinousReadThreadRunning(self: phase.pyphase.stereocamera.UVCStereoCamera) bool
Check if continous read thread is running Should be used with startContinousReadThread()
- Returns
- bool
Continous read thread running status
- isReadThreadRunning(self: phase.pyphase.stereocamera.UVCStereoCamera) bool
Check if camera read thread is running
- Returns
- bool
True if read thread is running
- read(self: phase.pyphase.stereocamera.UVCStereoCamera, timeout: int = 1000) phase.pyphase.stereocamera.CameraReadResult
Read image frame from camera
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- ——-
- CameraReadResult
Result from camera read
- resetCaptureCount(self: phase.pyphase.stereocamera.UVCStereoCamera) None
Reset captured frame count to zero Use with getCaptureCount() to get number of frames captured
- setDataCapturePath(self: phase.pyphase.stereocamera.UVCStereoCamera, path: str) None
Set data capture path to save images Use with enableDataCapture() to toggle saving images to file
- pathstr
Directory of desired capture data storage
- setDownsampleFactor(self: phase.pyphase.stereocamera.UVCStereoCamera, value: float) None
Set downsample factor
- Parameters
- valuefloat
Downsample factor value
- setExposure(self: phase.pyphase.stereocamera.UVCStereoCamera, value: int) None
Set exposure value of camera
- Parameters
- valueint
Value of exposure (us)
- setFrameRate(self: phase.pyphase.stereocamera.UVCStereoCamera, value: float) None
Set frame rate of camera
- Parameters
- valuefloat
Value of frame rate
- setLeftAOI(self: phase.pyphase.stereocamera.UVCStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for left camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setLeftFlipX(self: phase.pyphase.stereocamera.UVCStereoCamera, enable: bool) None
Flip left image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setLeftFlipY(self: phase.pyphase.stereocamera.UVCStereoCamera, enable: bool) None
Flip left image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setReadThreadCallback(self: phase.pyphase.stereocamera.UVCStereoCamera, callback: Callable[[phase.pyphase.stereocamera.CameraReadResult], None]) None
Set callback function to run when read thread completes Should be used with startReadThread() Useful as an external trigger that read is complete and results can be retrieved.
- Parameters
- fcallback
- setRightAOI(self: phase.pyphase.stereocamera.UVCStereoCamera, x_min: int, y_min: int, x_max: int, y_max: int) None
To set area of interest for right camera
- Parameters
- x_minint
x value of top left corner of targeted AOI
- y_minint
y value of top left corner of targeted AOI
- x_maxint
x value of bottom right corner of targeted AOI
- y_maxint
y value of bottom right corner of targeted AOI
- setRightFlipX(self: phase.pyphase.stereocamera.UVCStereoCamera, enable: bool) None
Flip right image in x axis
- Parameters
- enablebool
Set “True” to flip image
- setRightFlipY(self: phase.pyphase.stereocamera.UVCStereoCamera, enable: bool) None
Flip right image in y axis
- Parameters
- enablebool
Set “True” to flip image
- setTestImagePaths(self: phase.pyphase.stereocamera.UVCStereoCamera, left_test_image_path: str, right_test_image_path: str) None
Set the path for test images, input both left and right image path
- Parameters
- left_test_image_pathstr
- right_test_image_pathstr
- startCapture(self: phase.pyphase.stereocamera.UVCStereoCamera) bool
Start stereo camera capture Must be started before read() is called
- startContinousReadThread(self: phase.pyphase.stereocamera.UVCStereoCamera, timeout: int = 1000) bool
Start threaded process to read stereo images from cameras Thread will run continously until stopped This is useful for continuous image acquisition
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
Success of starting continous read thread
- startReadThread(self: phase.pyphase.stereocamera.UVCStereoCamera, timeout: int = 1000) bool
Read camera thread
- Parameters
- timeoutint
Timeout in millisecond, default timeout is 1000(1s)
- Returns
- bool
True if thread was started successfully
- stopCapture(self: phase.pyphase.stereocamera.UVCStereoCamera) None
Stop stereo camera capture Will no longer be able to read() after this is called
- stopContinousReadThread(self: phase.pyphase.stereocamera.UVCStereoCamera) None
Stop continous read thread
- phase.pyphase.stereocamera.availableDevices() List[phase.pyphase.stereocamera.CameraDeviceInfo]
Get the list of connected cameras
- Returns
- numpy.array
List of connected camera in CameraDeviceInfo type
- phase.pyphase.stereocamera.createStereoCamera(arg0: phase.pyphase.stereocamera.CameraDeviceInfo) phase.pyphase.stereocamera.AbstractStereoCamera
Read device type and return in related camera variable
stereo matcher
- class phase.pyphase.stereomatcher.AbstractStereoMatcher
Bases:
pybind11_object
Abstract base class for building stereo matcher classes. Includes functions/structures common across all stereo matchers. A stereo matcher takes a two images (left and right) and calculates to pixel disparity of features. The produces a disparity value for each pixel which can be used to generate depth.
Methods
compute
(self, left_image, right_image)Compute stereo matching Generates disparity from left and right images
getComputeThreadResult
(self)Get results from threaded compute process Should be used with startComputeThread()
isComputeThreadRunning
(self)Check if compute thread is running
setComputeThreadCallback
(self, callback)Set callback function to run when compute thread completes Should be used with startComputeThread() Useful as an external trigger that compute is complete and results can be retrieved.
startComputeThread
(self, left_image, left_image)Start compute thread Generates disparity from left and right images Use getComputeThreadResult() to get results of compute
- compute(self: phase.pyphase.stereomatcher.AbstractStereoMatcher, left_image: numpy.ndarray, right_image: numpy.ndarray) phase.pyphase.stereomatcher.StereoMatcherComputeResult
Compute stereo matching Generates disparity from left and right images
- Parameters
- left_imagenumpy.ndarray
Left image of stereo pair
- right_imagenumpy.ndarray
Right image of stereo pair
- getComputeThreadResult(self: phase.pyphase.stereomatcher.AbstractStereoMatcher) phase.pyphase.stereomatcher.StereoMatcherComputeResult
Get results from threaded compute process Should be used with startComputeThread()
- Returns
- StereoMatcherComputeResult
Result from compute
- isComputeThreadRunning(self: phase.pyphase.stereomatcher.AbstractStereoMatcher) bool
Check if compute thread is running
- Returns
- bool
True is compute thread is running
- setComputeThreadCallback(self: phase.pyphase.stereomatcher.AbstractStereoMatcher, callback: std::function<void ()>) None
Set callback function to run when compute thread completes Should be used with startComputeThread() Useful as an external trigger that compute is complete and results can be retrieved.
- Parameters
- fcallback
- AbstractStereoMatcher.startComputeThread(self: phase.pyphase.stereomatcher.AbstractStereoMatcher, left_image: numpy.ndarray, left_image: numpy.ndarray) -> None
Start compute thread Generates disparity from left and right images Use getComputeThreadResult() to get results of compute
- Parameters
- left_imagenumpy.ndarray
Left image of stereo pair
- right_imagenumpy.ndarray
Right image of stereo pair
- class phase.pyphase.stereomatcher.StereoBM
Bases:
pybind11_object
OpenCV’s block matcher for generting disparity from stereo images.
Methods
compute
(self, left_image, right_image)Compute stereo matching Generates disparity from left and right images
getComputeThreadResult
(self)Get results from threaded compute process Should be used with startComputeThread()
getMinDisparity
(self)Get minimum disparity value
getNumDisparities
(self)Get number of disparities
getWindowSize
(self)Get window size value
isComputeThreadRunning
(self)Check if compute thread is running
setComputeThreadCallback
(self, callback)Set callback function to run when compute thread completes Should be used with startComputeThread() Useful as an external trigger that compute is complete and results can be retrieved.
setMinDisparity
(self, value)Set minimum disparity value
setNumDisparities
(self, value)Set number of disparities
setWindowSize
(self, value)Set window size value
startComputeThread
(self, left_image, right_image)Start compute thread Generates disparity from left and right images Use getComputeThreadResult() to get results of compute
- compute(self: phase.pyphase.stereomatcher.StereoBM, left_image: numpy.ndarray, right_image: numpy.ndarray) phase.pyphase.stereomatcher.StereoMatcherComputeResult
Compute stereo matching Generates disparity from left and right images
- Parameters
- left_imagenumpy.ndarray
Left image of stereo pair
- right_imagenumpy.ndarray
Right image of stereo pair
- getComputeThreadResult(self: phase.pyphase.stereomatcher.StereoBM) phase.pyphase.stereomatcher.StereoMatcherComputeResult
Get results from threaded compute process Should be used with startComputeThread()
- Returns
- StereoMatcherComputeResult
Result from compute
- getMinDisparity(self: phase.pyphase.stereomatcher.StereoBM) int
Get minimum disparity value
- Returns
- valueint
Value of minimum disparity
- getNumDisparities(self: phase.pyphase.stereomatcher.StereoBM) int
Get number of disparities
- Returns
- valueint
Value of number of disparities
- getWindowSize(self: phase.pyphase.stereomatcher.StereoBM) int
Get window size value
- Returns
- valueint
Value of window size
- isComputeThreadRunning(self: phase.pyphase.stereomatcher.StereoBM) bool
Check if compute thread is running
- Returns
- bool
True is compute thread is running
- setComputeThreadCallback(self: phase.pyphase.stereomatcher.StereoBM, callback: std::function<void ()>) None
Set callback function to run when compute thread completes Should be used with startComputeThread() Useful as an external trigger that compute is complete and results can be retrieved.
- Parameters
- fcallback
- setMinDisparity(self: phase.pyphase.stereomatcher.StereoBM, value: int) None
Set minimum disparity value
- Parameters
- valueint
Desired value of minimum disparity value
- setNumDisparities(self: phase.pyphase.stereomatcher.StereoBM, value: int) None
Set number of disparities
- Parameters
- valueint
Desired value of number of disparities
- setWindowSize(self: phase.pyphase.stereomatcher.StereoBM, value: int) None
Set window size value
- Parameters
- valueint
Desired value of window size value
- startComputeThread(self: phase.pyphase.stereomatcher.StereoBM, left_image: numpy.ndarray, right_image: numpy.ndarray) None
Start compute thread Generates disparity from left and right images Use getComputeThreadResult() to get results of compute
- Parameters
- left_imagenumpy.ndarray
Left image of stereo pair
- right_imagenumpy.ndarray
Right image of stereo pair
- class phase.pyphase.stereomatcher.StereoI3DRSGM
Bases:
pybind11_object
I3DRS’s stereo semi-global matcher for generting disparity from stereo images.
Methods
compute
(self, left_image, right_image)Compute stereo matching Generates disparity from left and right images
enableInterpolation
(self, enable)To enable interpolation
enableOcclusionDetection
(self, enable)To enable occlusion detection
enableOcclusionInterpolation
(self, enable)To enable occlusion interpolation
enableSubpixel
(self, enable)To enable subpixel
getComputeThreadResult
(self)Get results from threaded compute process Should be used with startComputeThread()
getMinDisparity
(self)Get minimum disparity value
getNumDisparities
(self)Get number of disparities
getSpeckleMaxDiff
(self)Get speckle maximum difference
getSpeckleMaxSize
(self)Get speckle maximum size
getWindowSize
(self)Get window size value
isComputeThreadRunning
(self)Check if compute thread is running
isInterpolationEnabled
(self)Get enable/disable status of interpolation
Check if the I3DRSGM license is valid
Get enable/disable status of occlusion detection
Get enable/disable status of occlusion interpolation
isSubpixelEnabled
(self)Get enable/disable status of subpixel refinement
setComputeThreadCallback
(self, callback)Set callback function to run when compute thread completes Should be used with startComputeThread() Useful as an external trigger that compute is complete and results can be retrieved.
setMinDisparity
(self, value)Set minimum disparity value
setNumDisparities
(self, value)Set number of disparities
setSpeckleMaxDiff
(self, value)Set speckle maximum difference
setSpeckleMaxSize
(self, value)Set speckle maximum size
setWindowSize
(self, value)Set window size value
startComputeThread
(self, left_image, right_image)Start compute thread Generates disparity from left and right images Use getComputeThreadResult() to get results of compute
- compute(self: phase.pyphase.stereomatcher.StereoI3DRSGM, left_image: numpy.ndarray, right_image: numpy.ndarray) phase.pyphase.stereomatcher.StereoMatcherComputeResult
Compute stereo matching Generates disparity from left and right images
- Parameters
- left_imagenumpy.ndarray
Left image of stereo pair
- right_imagenumpy.ndarray
Right image of stereo pair
- enableInterpolation(self: phase.pyphase.stereomatcher.StereoI3DRSGM, enable: bool) None
To enable interpolation
- Parameters
- enablebool
Set True to enable interpolation
- enableOcclusionDetection(self: phase.pyphase.stereomatcher.StereoI3DRSGM, enable: bool) None
To enable occlusion detection
- Parameters
- enablebool
Set True to enable occlusion detection
- enableOcclusionInterpolation(self: phase.pyphase.stereomatcher.StereoI3DRSGM, enable: bool) None
To enable occlusion interpolation
- Parameters
- enablebool
Set True to enable occlusion interpolation
- enableSubpixel(self: phase.pyphase.stereomatcher.StereoI3DRSGM, enable: bool) None
To enable subpixel
- Parameters
- enablebool
Set True to enable subpixel
- getComputeThreadResult(self: phase.pyphase.stereomatcher.StereoI3DRSGM) phase.pyphase.stereomatcher.StereoMatcherComputeResult
Get results from threaded compute process Should be used with startComputeThread()
- Returns
- StereoMatcherComputeResult
Result from compute
- getMinDisparity(self: phase.pyphase.stereomatcher.StereoI3DRSGM) int
Get minimum disparity value
- Returns
- valueint
Value of minimum disparity
- getNumDisparities(self: phase.pyphase.stereomatcher.StereoI3DRSGM) int
Get number of disparities
- Returns
- valueint
Value of number of disparities
- getSpeckleMaxDiff(self: phase.pyphase.stereomatcher.StereoI3DRSGM) float
Get speckle maximum difference
- Returns
- valueint
Value of speckle maximum difference
- getSpeckleMaxSize(self: phase.pyphase.stereomatcher.StereoI3DRSGM) int
Get speckle maximum size
- Returns
- valueint
Value of speckle maximum size
- getWindowSize(self: phase.pyphase.stereomatcher.StereoI3DRSGM) int
Get window size value
- Returns
- valueint
Value of window size
- isComputeThreadRunning(self: phase.pyphase.stereomatcher.StereoI3DRSGM) bool
Check if compute thread is running
- Returns
- bool
True is compute thread is running
- isInterpolationEnabled(self: phase.pyphase.stereomatcher.StereoI3DRSGM) bool
Get enable/disable status of interpolation
- Returns
- bool
true if enabled
- static isLicenseValid() bool
Check if the I3DRSGM license is valid
- Returns
- bool
True if license is valid
- isOcclusionDetectionEnabled(self: phase.pyphase.stereomatcher.StereoI3DRSGM) bool
Get enable/disable status of occlusion detection
- Returns
- bool
true if enabled
- isOcclusionInterpolationEnabled(self: phase.pyphase.stereomatcher.StereoI3DRSGM) bool
Get enable/disable status of occlusion interpolation
- Returns
- bool
true if enabled
- isSubpixelEnabled(self: phase.pyphase.stereomatcher.StereoI3DRSGM) bool
Get enable/disable status of subpixel refinement
- Returns
- bool
true if enabled
- setComputeThreadCallback(self: phase.pyphase.stereomatcher.StereoI3DRSGM, callback: std::function<void ()>) None
Set callback function to run when compute thread completes Should be used with startComputeThread() Useful as an external trigger that compute is complete and results can be retrieved.
- Parameters
- fcallback
- setMinDisparity(self: phase.pyphase.stereomatcher.StereoI3DRSGM, value: int) None
Set minimum disparity value
- Parameters
- valueint
Desired value of minimum disparity value
- setNumDisparities(self: phase.pyphase.stereomatcher.StereoI3DRSGM, value: int) None
Set number of disparities
- Parameters
- valueint
Desired value of number of disparities
- setSpeckleMaxDiff(self: phase.pyphase.stereomatcher.StereoI3DRSGM, value: float) None
Set speckle maximum difference
- Parameters
- valuefloat
Value of speckle maximum difference
- setSpeckleMaxSize(self: phase.pyphase.stereomatcher.StereoI3DRSGM, value: int) None
Set speckle maximum size
- Parameters
- valueint
Value of speckle maximum size
- setWindowSize(self: phase.pyphase.stereomatcher.StereoI3DRSGM, value: int) None
Set window size value
- Parameters
- valueint
Desired value of window size value
- startComputeThread(self: phase.pyphase.stereomatcher.StereoI3DRSGM, left_image: numpy.ndarray, right_image: numpy.ndarray) None
Start compute thread Generates disparity from left and right images Use getComputeThreadResult() to get results of compute
- Parameters
- left_imagenumpy.ndarray
Left image of stereo pair
- right_imagenumpy.ndarray
Right image of stereo pair
- class phase.pyphase.stereomatcher.StereoMatcherComputeResult
Bases:
pybind11_object
Struture to store the result from a stereo match. Used in the stereo matcher classes.
- Attributes
- disparity
- valid
- property disparity
- property valid
- class phase.pyphase.stereomatcher.StereoMatcherType
Bases:
pybind11_object
Enum to indicate stereo matcher type. Used in stereo matcher class to select which matcher to use.
Members:
STEREO_MATCHER_BM
STEREO_MATCHER_SGBM
STEREO_MATCHER_I3DRSGM
- Attributes
name
name(self: handle) -> str
- value
- STEREO_MATCHER_BM = <StereoMatcherType.STEREO_MATCHER_BM: 0>
- STEREO_MATCHER_I3DRSGM = <StereoMatcherType.STEREO_MATCHER_I3DRSGM: 2>
- STEREO_MATCHER_SGBM = <StereoMatcherType.STEREO_MATCHER_SGBM: 1>
- property name
- property value
- class phase.pyphase.stereomatcher.StereoParams
Bases:
pybind11_object
Struture to store stereo parameters
- Attributes
- interpolation
- matcherType
- minDisparity
- numDisparities
- windowSize
- property interpolation
- property matcherType
- property minDisparity
- property numDisparities
- property windowSize
- class phase.pyphase.stereomatcher.StereoSGBM
Bases:
pybind11_object
OpenCV’s semi-global block matcher for generting disparity from stereo images
Methods
compute
(self, left_image, right_image)Compute stereo matching Generates disparity from left and right images
getComputeThreadResult
(self)Get results from threaded compute process Should be used with startComputeThread()
getMinDisparity
(self)Get minimum disparity value
getNumDisparities
(self)Get number of disparities
getWindowSize
(self)Get window size value
isComputeThreadRunning
(self)Check if compute thread is running
setComputeThreadCallback
(self, callback)Set callback function to run when compute thread completes Should be used with startComputeThread() Useful as an external trigger that compute is complete and results can be retrieved.
setMinDisparity
(self, value)Set minimum disparity value
setNumDisparities
(self, value)Set number of disparities
setWindowSize
(self, value)Set window size value
startComputeThread
(self, left_image, right_image)Start compute thread Generates disparity from left and right images Use getComputeThreadResult() to get results of compute
- compute(self: phase.pyphase.stereomatcher.StereoSGBM, left_image: numpy.ndarray, right_image: numpy.ndarray) phase.pyphase.stereomatcher.StereoMatcherComputeResult
Compute stereo matching Generates disparity from left and right images
- Parameters
- left_imagenumpy.ndarray
Left image of stereo pair
- right_imagenumpy.ndarray
Right image of stereo pair
- getComputeThreadResult(self: phase.pyphase.stereomatcher.StereoSGBM) phase.pyphase.stereomatcher.StereoMatcherComputeResult
Get results from threaded compute process Should be used with startComputeThread()
- Returns
- StereoMatcherComputeResult
Result from compute
- getMinDisparity(self: phase.pyphase.stereomatcher.StereoSGBM) int
Get minimum disparity value
- Returns
- valueint
Value of minimum disparity
- getNumDisparities(self: phase.pyphase.stereomatcher.StereoSGBM) int
Get number of disparities
- Returns
- valueint
Value of number of disparities
- getWindowSize(self: phase.pyphase.stereomatcher.StereoSGBM) int
Get window size value
- Returns
- valueint
Value of window size
- isComputeThreadRunning(self: phase.pyphase.stereomatcher.StereoSGBM) bool
Check if compute thread is running
- Returns
- bool
True is compute thread is running
- setComputeThreadCallback(self: phase.pyphase.stereomatcher.StereoSGBM, callback: std::function<void ()>) None
Set callback function to run when compute thread completes Should be used with startComputeThread() Useful as an external trigger that compute is complete and results can be retrieved.
- Parameters
- fcallback
- setMinDisparity(self: phase.pyphase.stereomatcher.StereoSGBM, value: int) None
Set minimum disparity value
- Parameters
- valueint
Desired value of minimum disparity value
- setNumDisparities(self: phase.pyphase.stereomatcher.StereoSGBM, value: int) None
Set number of disparities
- Parameters
- valueint
Desired value of number of disparities
- setWindowSize(self: phase.pyphase.stereomatcher.StereoSGBM, value: int) None
Set window size value
- Parameters
- valueint
Desired value of window size value
- startComputeThread(self: phase.pyphase.stereomatcher.StereoSGBM, left_image: numpy.ndarray, right_image: numpy.ndarray) None
Start compute thread Generates disparity from left and right images Use getComputeThreadResult() to get results of compute
- Parameters
- left_imagenumpy.ndarray
Left image of stereo pair
- right_imagenumpy.ndarray
Right image of stereo pair
- phase.pyphase.stereomatcher.createStereoMatcher(*args, **kwargs)
Overloaded function.
createStereoMatcher(matcher_type: phase.pyphase.stereomatcher.StereoMatcherType) -> phase.pyphase.stereomatcher.AbstractStereoMatcher
Create stereo matching from stereo matcher type
createStereoMatcher(stereo_params: phase.pyphase.stereomatcher.StereoParams) -> phase.pyphase.stereomatcher.AbstractStereoMatcher
Create stereo matching from stereo matcher parameters