TOFcam API

Every TOFcam device has its own class, which inherits from the base class TOFcam and implements the device-specific methods. All TOFcam subclasses implement a TOFcam_Settings and a TOFcam_Device_Info class, which are used to store the device settings and device information, respectively.

_images/TOFcam-class-diagram.png

TOFcam660 API

TOFcam660

class epc.tofCam660.tofCam660.TOFcam660(ip_address='10.10.31.180')

Creates a new TOFcam660 object and connects it to the ip address specified.

If no ip address is specified, the default ip address (10.10.31.180) is used.

The TOFcam660 object holds two attributes:

  • settings: allows to control the settings of the camera.

  • device: allows to get device information’s of the camera.

get_amplitude_image() numpy.ndarray

Get an amplitude image from the camera as a 2d numpy array.

get_distance_and_amplitude() tuple[numpy.ndarray, numpy.ndarray]

Get a distance and amplitude image from the camera as 2d numpy arrays. The distance is in mm.

get_distance_image() numpy.ndarray

Get a distance image from the camera as a 2d numpy array. The distance is in mm.

get_flex_mod_distance_amplitude_dcs(calibData: dict, modFreq_MHz: int, minAmp: int = 0) tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray]

Acquire a DCS image with a flexibly chosen modulation frequency and calculate the distance and amplitude images from it.

get_grayscale_image() numpy.ndarray

“Get a grayscale image from the camera as a 2d numpy array

get_hw_trigger_image() tuple[numpy.ndarray, numpy.ndarray] | numpy.ndarray

Wait until the hardware trigger data frame is received

Returns:

DataType.DISTANCE_AMPLITUDE → (distance, amplitude) as tuple[np.ndarray, np.ndarray] DataType.DISTANCE → distance as np.ndarray DataType.GRAYSCALE → grayscale as np.ndarray DataType.DCS → 4DCS as np.ndarray

Return type:

tuple[np.ndarray, np.ndarray] | np.ndarray

get_point_cloud() numpy.ndarray

Returns a tuple holding point cloud from the camera as a 3xN numpy array and the corresponding amplitude values.

get_raw_dcs_images() numpy.ndarray

Get a DCS image from the camera as a 2d numpy array.

TOFcam660_Settings

class epc.tofCam660.tofCam660.TOFcam660_Settings(cam: TOFcam660)

The TOFcam660_Settings class is used to control the settings of the TOFcam660.

disable_filters()

Disable all filters.

get_integration_time() list[dict]

Get the integration time(grayscale & 3D) from the camera.

get_modulation_channels() list[int]

Returns a list of available modulation channels.

get_modulation_frequencies() list[float]

Returns a list of available modulation frequencies in MHz.

get_roi()

Returns the current region of interest. The ROI is a tuple of the form (x1, y1, x2, y2) where (x1, y1) is the top-left corner and (x2, y2) is the bottom-right corner.

set_compensations(setDrnuCompensation=True, setTemperatureCompensation=True, setAmbientLightCompensation=True, setGrayscaleCompensation=True)

Enable or distable compensations for the camera.

set_eye_safety_mode(mode: int, fps: int)

Set the camera into eye safety mode :param mode: 0: eye-safety mode disabled, 1: eye-safety mode enabled, 2: camera runs on given fps :type mode: int :param fps: fps to run the camera(only used when mode=2) :type fps: int

set_grayscale_illumination(enable=True)

Enable or disable the illumination during grayscale capture.

set_hdr(mode: int) None

Set the HDR mode for the camera. :param mode: The mode to set. 0: off, 1: spatial, 2: temporal :type mode: int

set_hw_trigger_data_type(data_type: DataType)

Set the data type to acquire using the hardware trigger.

set_illuminator_segments(segment_1_on: bool = True, segment_2_on: bool = True, segment_3_on: bool = True, segment_4_on: bool = True, segment_2_to_4: bool = True)

Set the illuminator segments for the camera.

set_integration_hdr(int_times: list[int]) None

Set integration times for the camera. :param int_times is a list of 4 integers: [grayscale, low, mid, high]

set_integration_time(int_time_us: int)

Set the integration time for standard mode in us.

set_integration_time_grayscale(int_time_us: int)

Set the integration time for grayscale images in us.

set_lense_type(lense_type: int)

Set the lense type for the camera.

set_minimal_amplitude(minimum: int)

Set minimal amplitude needed to be considered a valid distance estimation.

set_modulation(frequency_mhz: float, channel=0)

Set the modulation frequency and channel for the TOFcam.

set_modulation_clock_jitter(enable: bool)

Enable/disable modulation jitter fuctionality :param enable: True : enable mod clk jitter, False: disable mod clk jitter :type enable: bool

set_roi(roi: tuple[int, int, int, int])

Set the region of interest. :param roi: (x1, y1, x2, y2) where (x1, y1) is the top-left corner and (x2, y2) is the bottom-right corner. :type roi: tuple[int, int, int, int]

set_rolling_mode(mode: Literal['None', '1DCS', '2DCS'])

Set camera to the rolling acquisition mode :param mode: “None” (disabled), “1DCS” (1DCS Rolling Mode), or “2DCS” (2DCS Rolling Mode)

TOFcam660_Device

class epc.tofCam660.tofCam660.TOFcam660_Device(cam: TOFcam660)

The TOFcam660_Device class is used to get and set device information’s of the TOFcam660.

get_calibration_data() list[dict]

Get the calibration data(calibrated modulation freq., temperature, atan offset) from the camera.

get_chip_infos() tuple[int, int]

Returns the chip id and wafer id of the epc660.

get_chip_temperature() float

Returns the temperature of the epc660 chip in °C.

WARNING: The temperature is only updated when a new frame is captured.

get_fw_version() str

Returns the firmware version of the epc660.

power_reset()

Powercycle the camera.

read_register(reg_addr: int) int

Read a value from a register on the epc660.

system_reset()

Reset the camera.

write_register(reg_addr: int, value: int) None

Write a value to a register on the epc660.

“””

TOFcam635 API

TOFcam635

class epc.tofCam635.tofCam635.TOFcam635(port: str | None = None)

creates a TOFcam635 object and connects the camera to the given port.

If no port is specified, the camera will try to find the correct port automatically.

The TOFcam635 object holds two attributes for settings and device information.

  • settings: can be used to control the settings of the camera

  • device: can be used to get information about the camera

get_amplitude_image()

returns an amplitude image as a 2d numpy array

get_distance_and_amplitude_image()

returns a tuple of 2d arrays (distance, amplitude)

get_distance_image()

returns a distance image as a 2d numpy array

get_grayscale_image()

returns a grayscale image as a 2d numpy array

get_point_cloud()

returns point cloud information as numpy array of shape (n, 3) with x, y, z coordinates

get_raw_dcs_images() numpy.ndarray

Get a DCS image from the camera as a 2d numpy array.

TOFcam635_Settings

class epc.tofCam635.tofCam635.TOFcam635_Settings(cam: TOFcam635)

This class is used to control the settings of the TOFcam635 camera.

get_roi() tuple[int, int, int, int]

Returns the current region of interest (ROI) of the camera.

Returns:

x0, y0, x1, y1

Return type:

tuple[int, int, int, int]

set_capture_mode(mode: int) None

set the capture mode for next image aquisition

Parameters:

mode (int) – 0: single measurement, 1: pipelined measurement, 2: streaming mode

set_hdr(mode=0) None

Set the HDR mode for the camera. :param mode: The mode to set. 0: off, 1: spatial, 2: temporal :type mode: int

set_illuminator_segments(illumination: int) None

Set the active illumination segments in the ToFCAM635-B2

Parameters:

illumination (int) – Illumination mode. 0: Disabled 1: WF enabled 2: NF enabled 3: WF & NF enabled

set_integration_time(int_time_us: int)

set integration time for standard mode (e.g. hdr off)

set_integration_time_grayscale(int_time_us: int)

set integration time for grayscale acquisition

set_integration_time_hdr(index: int, int_time_us: int) None

set integration time for HDR mode

set_minimal_amplitude(amplitude: int)

set the minimal amplitude for valid distance calculation

Parameters:

amplitude (int) – minimal amplitude [ADC]

set_roi(roi: tuple[int, int, int, int]) None

Set the region of interest (ROI) for the camera. The ROI is set to the nearest multiple of 4

returns: the set ROI

TOFcam635_Device

class epc.tofCam635.tofCam635.TOFcam635_Device(cam: TOFcam635)

This class is used to control the device information of the TOFcam635 camera.

get_chip_infos() tuple[int, int]

returns chip information

Returns:

chipId, waferId

Return type:

tuple[int, int]

get_chip_temperature() float

returns chip temperature in degree Celsius

get_device_ids() tuple[int, int, int, int]

return device ids

Returns:

hwVersion, deviceType, chipType, oPmode

Return type:

tuple[int, int, int, int]

get_fw_version() str

returns firmware version as string

read_register(reg_addr: int) int

read a register of the epc635 camera chip.

write_register(reg_addr: int, value: int) None

write a register of the epc635 camera chip.

“””

TOFcam611 API

TOFcam611

class epc.tofCam611.tofCam611.TOFcam611(port: str | None = None)

creates a TOFcam611 object and connects the camera to the given port. This class can also be used for the TOFrange since they share the same communication protocol.

If no port is specified, the TOFcam611 object will try to find the correct port automatically.

The TOFcam611 object holds two attributes for settings and device information.

  • settings: can be used to control the settings of the camera

  • device: can be used to get information about the camera

get_amplitude_image()

returns the amplitude image as 2d numpy array

get_dcs_images() numpy.ndarray

returns 4 DCS images as a numpy array of shape (4, 8, 8)

get_distance_and_amplitude_image()

returns a tuple of (distance, amplitude) images as 2d numpy arrays

get_distance_image()

returns the distance image as 2d numpy array

get_grayscale_image()

!!! ATTENTION !!!

TOFcam611 doesn’t implement capturing of grayscale images. Therefore the grayscale image is estimaged as the sum of 4 DCS images. returns the grayscale image as 2d numpy array

initialize()

initialize the camera with default values and set power to on

TOFcam611_Settings

class epc.tofCam611.tofCam611.TOFcam611_Settings(interface: InterfaceWrapper, device_type: int)

TOFcam611_Device

class epc.tofCam611.tofCam611.TOFcam611_Device(interface: InterfaceWrapper)
get_chip_infos() tuple[int, int]

returns (chipType, version)

get_chip_temperature() float

returns the chip temperature in °C

get_device_ids() tuple[int, int, int]

returns a tuple with (chipType, device, version)

get_fw_version() str

returns the firmware version as string in format ‘major.minor’

get_production_date()

returns the production date as tuple (year, week)

“””