Python Wrapper
Xvisio SDK Documentation Home Page

xvsdk.py


Overview

xvsdk.py contains xvsdk related interfaces and data definition in python encapsulation.

1.0 File Catalogue

Platform Catalogue
Windows Installation path: \bin\python-wrapper, default path:C:\Program Files\xvsdk\bin\python-wrapper
Linux/Ubuntu /usr/share/python-wrapper

2.0 Interfaces Introduction

xvsdk.py contains xvsdk related interfaces and data definition in python encapsulation. Refer to the details as below:

Vector3F structure is used to receive 3D data of float type:

class Vector3F(Structure):
fields = [('x', c_float),
('y', c_float),
('z', c_float)]

Quaternion structure is used to receive converted quaternion data:

class Quaternion(Structure):
fields = [('q0', c_float),
('q1', c_float),
('q2', c_float),
('q3', c_float)]

Vector3D structure is used to receive 3D type of double type:

class Vector3D(Structure):
fields = [('x', c_double),
('y', c_double),
('z', c_double)]

Transform_Matrix structure is used to receive the data of matrix, rotation and translation.

class Transform_Matrix(Structure):
fields = [('rotation', c_double * 9),
('translation', c_double * 3)]

UnifiedCameraModel structure is used to receive calibration data of UnifiedCameraModel:

class UnifiedCameraModel(Structure):
fields = [('w', c_int),
('h', c_int),
('fx', c_double),
('fy', c_double),
('u0', c_double),
('v0', c_double),
('xi', c_double)]

PolynomialDistortionCameraModel structure is used to receive calibration data of PolynomialDistortionCameraModel:

class PolynomialDistortionCameraModel(Structure):
fields = [('w', c_int),
('h', c_int),
('fx', c_double),
('fy', c_double),
('u0', c_double),
('v0', c_double),
('distor', c_double * 5)]

TagData structure is used to receive calibration data of Apriltag which including the data of ID,location,orientation, quaternion, edge & host timestamp and confidence.

class TagData(Structure):
fields = [('tagID', c_int),
('position', c_float * 3),
('orientation', c_float * 3),
('quaternion', c_float * 4),
('edgeTimestamp', c_longlong),
('hostTimestamp', c_double),
('confidence', c_double)]

"init" interface is used to init device:

def init():
return dll.xvisio_device_init()

"stop" interface is used to shut down device:

def stop():
dll.xslam_uninit()

"slam_start" interface is used to start slam:

def slam_start():
return dll.xvisio_start_slam()

"slam_stop" interface is used to stop slam:

def slam_stop():
return dll.xvisio_stop_slam()

"stereo_start" interface is used to start FE camera:

def stereo_start():
return dll.xvisio_start_stereo()

"imu_start" interface is used to start IMU camera:

def imu_start():
return dll.xvisio_start_imu()

"rgb_start" interface is used to start RGB camera:

def rgb_start():
return dll.xvisio_start_rgb()

"tof_start" interface is used to start TOF camera:

def tof_start():
return dll.xvisio_start_tof()

"sgbm_start" interface is used to start SGBM camera:

def sgbm_start():
return dll.xvisio_start_sgbm()

"xvisio_get_6dof" interface is used to get the callback returned data of slam,6dof,orientation,quaternion,edge&host timestamp and confidence:

def xvisio_get_6dof():
dll.xvisio_get_6dof(byref(position), byref(orientation), byref(quaternion), byref(slam_edgeTimestamp), byref(slam_hostTimestamp), byref(slam_confidence))
return position, orientation, quaternion, slam_edgeTimestamp, slam_hostTimestamp, slam_confidence

"xvisio_get_6dof_prediction" interface is used to get the getpose returned data of slam (predictive value with a unit of s), 6dof,orientation,quaternion,edge&host timestamp and confidence:

def xvisio_get_6dof_prediction(prediction):
dll.xvisio_get_6dof_prediction(byref(position), byref(orientation), byref(quaternion), byref(slam_edgeTimestamp), byref(slam_hostTimestamp), byref(slam_confidence), prediction)
return position, orientation, quaternion, slam_edgeTimestamp, slam_hostTimestamp, slam_confidence

"xslam_get_imu" interface is used to get IMU data, return acceleration, angular velocity, edge timestamp and host timestamp:

def xslam_get_imu():
dll.xvisio_get_imu(byref(accel), byref(gyro), byref(imu_edgeTimestamp), byref(imu_hostTimestamp))
return accel, gyro, imu_edgeTimestamp, imu_hostTimestamp

"xvisio_get_stereo" interface is used to get Fisheye camera data which return the width/height data of the image,left/right fisheye image data, image data size,edge timestamp and host timestamp:

def xvisio_get_stereo():
dll.xvisio_get_stereo_info(byref(fe_width), byref(fe_height), byref(stereo_edgeTimestamp), byref(stereo_hostTimestamp), byref(fe_dataSize))
fe_left_data = (c_ubyte * fe_dataSize.value)()
fe_right_data = (c_ubyte * fe_dataSize.value)()
dll.xvisio_get_stereo_image(byref(fe_left_data), byref(fe_right_data))
return fe_width, fe_height, stereo_edgeTimestamp, stereo_hostTimestamp, fe_left_data, fe_right_data, fe_dataSize

"xvisio_get_rgb" interface is used to get RGB camera data which return the width/height data of the image, raw image data, image data size,edge timestamp and host timestamp:

def xvisio_get_rgb():
dll.xvisio_get_rgb_info(byref(rgb_width), byref(rgb_height),byref(rgb_edgeTimestamp), byref(rgb_hostTimestamp), byref(rgb_dataSize))
rgb_data = (c_ubyte * rgb_dataSize.value)()
dll.xvisio_get_rgb_image(byref(rgb_data))
return rgb_width, rgb_height, rgb_edgeTimestamp, rgb_hostTimestamp, rgb_data, rgb_dataSize

"xvisio_get_tof" interface is used to get TOF camera data which return the width/height data of the image, raw image data,image data size,edge timestamp and host timestamp:

def xvisio_get_tof():
dll.xvisio_get_tof_info(byref(tof_width), byref(tof_height),byref(tof_edgeTimestamp), byref(tof_hostTimestamp), byref(tof_dataSize))
tof_data = (c_ubyte * tof_dataSize.value)()
dll.xvisio_get_tof_image(byref(tof_data))
return tof_width, tof_height, tof_edgeTimestamp, tof_hostTimestamp, tof_data, tof_dataSize

"xvisio_get_sgbm" interface is used to get SGBM camera data which return the width/height data of the image, raw image data,image data size,edge timestamp and host timestamp:

def xvisio_get_sgbm():
dll.xvisio_get_sgbm_info(byref(sgbm_width), byref(sgbm_height),byref(sgbm_edgeTimestamp), byref(sgbm_hostTimestamp), byref(sgbm_dataSize))
sgbm_data = (c_ubyte * sgbm_dataSize.value)()
dll.xvisio_get_sgbm_image(byref(sgbm_data))
return sgbm_width, sgbm_height, sgbm_edgeTimestamp, sgbm_hostTimestamp, sgbm_data, sgbm_dataSize

"xvisio_get_sn" interface is used to get device SN and return SN string information:

def xvisio_get_sn():
sn = c_char_p()
dll.xvisio_get_sn(byref(sn))
return sn

"xvisio_get_fisheye_intrinsics" interface is used to get fisheye camera calibration data and return transform/ucm calibration information and calibration data arry size:

def xvisio_get_fisheye_intrinsics():
fe_trans_size = c_int()
fe_ucm_size = c_int()
dll.xvisio_get_fe_camera_intrinsics_param(byref(fe_trans_size), byref(fe_ucm_size))
fe_transform = (Transform_Matrix * fe_trans_size.value)()
fe_ucm = (UnifiedCameraModel * fe_ucm_size.value)()
dll.xvisio_get_fe_camera_intrinsics(fe_transform, fe_ucm)
return fe_trans_size, fe_ucm_size, fe_transform, fe_ucm

"xvisio_get_rgb_intrinsics" interface is used to receive RGB camera calibration data and return transform/ucm calibration information and calibration data arry size:

def xvisio_get_rgb_intrinsics():
rgb_trans_size = c_int()
rgb_pdcm_size = c_int()
dll.xvisio_get_rgb_camera_intrinsics_param(byref(rgb_trans_size), byref(rgb_pdcm_size))
rgb_transform = (Transform_Matrix * rgb_trans_size.value)()
rgb_pdcm = (PolynomialDistortionCameraModel * rgb_pdcm_size.value)()
dll.xvisio_get_rgb_camera_intrinsics(rgb_transform, rgb_pdcm)
return rgb_trans_size, rgb_pdcm_size, rgb_transform, rgb_pdcm

"xvisio_get_tof_intrinsics" interface is used to get TOF camera calibration parameter and return transform/ucm calibration information and calibration data arry size:

def xvisio_get_tof_intrinsics():
tof_trans_size = c_int()
tof_pdcm_size = c_int()
dll.xvisio_get_tof_camera_intrinsics_param(byref(tof_trans_size), byref(tof_pdcm_size))
tof_transform = (Transform_Matrix * tof_trans_size.value)()
tof_pdcm = (PolynomialDistortionCameraModel * tof_pdcm_size.value)()
dll.xvisio_get_tof_camera_intrinsics(tof_transform, tof_pdcm)
return tof_trans_size, tof_pdcm_size, tof_transform, tof_pdcm

"xvisio_set_rgb_camera_resolution" interface is used to set RGB camera resolution. 0-1920x1080, 1-1280x720, 2-640x480, 3-320x240, 4-2560x1920, 5-3840x2160:

def xvisio_set_rgb_camera_resolution(resolution):
dll.xvisio_set_rgb_camera_resolution(resolution)

"xvisio_get_fe_april_tags" interface is used to get data information of "April-tag" and return tag instructure which including the data of ID,location information,orientation,quaternion,edge/host timestemp and confidence:

def xvisio_get_fe_april_tags():
tagDetectorID = c_char_p()
tagSize = c_int()
dll.xvisio_get_fe_tag_size(byref(tagDetectorID), byref(tagSize))
tags = (TagData * tagSize.value)()
dll.xvisio_get_fe_tag_detection(tags)
return tags

Python Wrapper
Xvisio SDK Documentation Home Page

xvsdk.py

Overview