Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

24 Commits

Repository files navigation

nimbus-python

Python bindings for nimbus. These bindings are ment for a remote connection (raspberry to a desktop machine).

Quick start

The following snippet connects to the raspberry and gets image data.

fromnimbusPythonimportNimbusClientcli=NimbusClient.NimbusClient("192.168.0.69")
header, (ampl, radial, x, y, z, conf) =cli.getImage(invalidAsNan=True)

Installation

nimbus-python uses websockets, which requires python 3.6 or higher!

pip install nimbus-python

Prerequisites

Download the current image from https://cloud.pieye.org/index.php/s/c2QSa6P4wBtSJ4K which contains nimbus-userland and all necessary linux drivers.

Getting image data

The following snippet connects to the raspberry and gets the image data.

fromnimbusPythonimportNimbusClientcli=NimbusClient.NimbusClient("192.168.0.69")
header, (ampl, radial, x, y, z, conf) =cli.getImage(invalidAsNan=True)

The matrices x,y,z represent a point cloud. Those can be visualized by:

The matrices have the following meaning

MatrixExplanation
amplsignal strength of each pixel
radialradial distance of each pixel to the camera center
x,y,z3D Point cloud
confconfidence information of each pixel (valid, underexposured, saturated, asymmetric)

You can change the exposure of the Nimbus 3D. By default, auto exposure with HDR is activated. If there is a lot of movement, it may be necessary to disable HDR and use the normal auto exposure. However, it is also possible to set the exposure time manually with and without HDR.The following snippet contains the possible configurations.

# automatic exposure cli.setExposureMode(NimbusClient.AUTO_HDR)
cli.setExposureMode(NimbusClient.AUTO)
cli.setAmplitude(1000) #<-- to change the desired amplitude (0 - ~5000)# manual exposure cli.setExposureMode(NimbusClient.MANUAL_HDR)
cli.setExposureMode(NimbusClient.MANUAL)
cli.setExposure(5000) #<-- to change the exposure time (0 - 65535)

If you are interested in the amount of valid, under exposured etc. pixels, you can use the following snippet as an example.

header, (ampl, radial, x, y, z, conf) =cli.getImage(invalidAsNan=True)
numUnderExposured=len(conf[conf==NimbusClient.ConfUnderExposured])
numOverExposured=len(conf[conf==NimbusClient.ConfOverExposured])
numAsymmetric=len(conf[conf==NimbusClient.ConfAsymmetric])
numValid=len(conf[conf==NimbusClient.ConfValid])

Based on this information you probably want to change the illumination time (increase the illumination in case of many underexposured pixels):

rv, data=cli.getExposure()
ifrv==0:
# increase illumination time by 10%newExposure=int(data["exposure"] +data["exposure"]*0.1)
rv=cli.setExposure(newExposure)
assertrv==0

The illumination time can have any value between 0 and 65535.

Similarily if you want to decrease the number of frames taken by the camera, you can set a framerate value (0 means no pause at end of frame, 65535 means maximum pause at end of frame)

# fast acquisitionrv=cli.setFramerate(0)
assertrv==0# slow acquisitionrv=cli.setFramerate(65535)
assertrv==0

Enable raw data

To enable raw data streaming, you can use the following code snippet.

fromnimbusPythonimportNimbusClientimporttimecli=NimbusClient.NimbusClient("192.168.0.69")
cli.setExposureMode(NimbusClient.MANUAL)
cli.setExposure(5000) #<-- to change the exposure time (0 - 65535)cli.enaRawMode(True)
time.sleep(1) #<-- there might be still some 3D images in the pipelineheader, img=cli.getImage()
imgType=int(header[NimbusClient.HeaderImgType])
ifimgType==NimbusClient.NimbusImageRaw:
print ("raw images received")
else:
print ("something went wrong...")
#-> repeat image readout (cli.getImage())

Authors

Markus Proeller

See also the list of contributors who participated in this project.

License

This project is licensed under the GPLv3 License - see the LICENSE file for details

3rd party libraries

We use the following 3rd party libraries:

About

nimbus python bindings

Topics

Resources

Stars

4 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages