Introduction
    • 26 Jun 2024
    • 1 Minute to read
    • PDF

    Introduction

    • PDF

    Article summary

    Usecase for the API

    The Chromasens Python SDK provides Python wrappers for Chromasens software and a Python interface for Chromasens hardware. The Python SDK is intended for quick prototyping and low performance vision applications. Due to the principle-related speed limitations of interpreter languages such as Python, machine vision applications with high speed requirements cannot be implemented with this API. Therefore a C++ implementation of the vision application is recommended.

    Structure and content

    The API is implemented in an OOP style. All devices and software interfaces are represented as a class that can be instantiated.

    from Chromasens_SDK import GenICamCamera
    
    cam = GenICamCamera()
    retval = cam.open_connection()
    ...

    The structure of a return value of a class method is always structured as as a tuple with 3 elements.

    • retval[0] = error number  

      • error number = 0:      OK, execution successful

      • error number !=0:      NOK, error occured

    • retval[1] = function result (if available)

    • retval[2] = string error description

    It is recommended to handle function retvals like this:

    ...
    retval = cam.get_feature('Height')
    if retval[0] != 0:
         print(f'error: {retval[2]}')
         # do some errorhandling
    else:
         img_height = retval[1]
        

    The API contains curretly:

    • GenICam class - The GenICam class is a Python wrapper of the Chromasens CSI.dll to communicate with GenIcam devices

      • allPIXA evo

      • allPIXA neo

    Compatibility

    The API is tested with Python 3.9.2 under Windows 10. Conflicts for higher Python and Windows versions are not expected.


    Was this article helpful?

    What's Next
    ESC

    Eddy AI, facilitating knowledge discovery through conversational intelligence