Example Code for Python-Custom development

This article guides users on using Python SDK for custom development to display frames, compute point cloud data, and estimate object volume, enhancing practical measurement skills.

Hardware

  • RGB-D Sensor Camera (SKU:SEN0583), Quantity: 1, Purchase Link: DFRobot

Software Preparation

  • Python3 (download link: Python.org)
  • Jupyter Notebook (install via pip install jupyter)
  • MaixSense 075 Tutorial Jupyter Notebook (download link: Sipeed)

Custom development

python SDK

This is a SDK based on Python3. MS-A075V opens its http interface, we can get its origin data (Depth map, ir map, rgb map) through http request.

To help user understand the struct of data package and the relevant logic of decoding, we provide decoding related functions that encapsulate http requests and native data, based on which users can do custom development.

Get SDK:Click to download

Method:Install jupyter, connect to the TOF module, then open the toturial.py file.

Decode and stream

After understanding the struct of data package and the relevant logic of decoding from Python SDK, we can do advanced development, continuously get, decode and call the third-party python image library, like matplotlib for live display. The toturial.py gives the implementation of getting onr frame data, and it can achieve live display by plt with loop.

Decoding and steraming:Click me to see content of stream.py

Methods:Run command python stream.py after installing all dependent packages.

Decode and stream

Detect volume

Based on third-party python library,and have understood the logic of getting and decoding data, we can do more development: Continuously display frames, roughly calculate the point cloud through the data from TOF module by SDK, do the accumulation to get the total volume. Limit: The top view should include all details except bottom.

Detect volume:Click to view calVolumes.py

Methods:Run command python calVolumes.py after installing all dependent packages, there will be notice after you run it.

Detect volume

Was this article helpful?

TOP