# Python MPA image

Source: https://forum.modalai.com/topic/4838/python-mpa-image
Category: VOXL SDK and Software (https://forum.modalai.com/category/47/voxl-sdk-and-software)
Tags: mpa
Posted: 2025-10-27 15:57:32 UTC by l05
Replies: 8 · Views: 4482

## l05 · 2025-10-27 15:57:32 UTC

Re: [Python MPA image example](/topic/3631/python-mpa-image-example)

Hi, I am working on getting frames from the camera on the VOXL2 in python. I have looked at the python example at https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/blob/pympa-experimental/tools/python/rtsp_rx.py since I do not need to publish the frames. I cannot seem to install opencv properly, so it has GStreamer support. I have python 3.6 and GStreamer on the drone, has anyone been able to install opencv with GStreamer support for the VOXL2?

## Reply by Alex Kushleyev (ModalAI staff) · 2025-10-28 03:02:10 UTC

@l05 , please see the following post, you can download the `voxl-opencv` library with python3 bindings from [here](https://storage.googleapis.com/modalai_public/temp/voxl2-misc-packages/voxl-opencv_4.5.5-3_arm64.deb) .

https://forum.modalai.com/topic/3519/help-with-pip-installing-opencv

This version of opencv was used for testing the `pympa-experimental` tools.

The script you were looking at is setup to receive image frames from an rtsp stream - is that what your goal is? (as opposed to receiving images from a mipi camera connected to VOXL2 (via `voxl-camera-server`)).

Alex

## Reply by l05 · 2025-10-28 12:39:01 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev My end goal is to receive images via voxl-camera-server, any tips or other examples on how to start to do so? 
I've taken a look at voxl-tflite-server but still having some trouble understanding how/where the service connects to one of voxl-camera-server's pipe to receive images.

## Reply by Alex Kushleyev (ModalAI staff) · 2025-10-30 05:13:32 UTC (in reply to l05)

@l05 , can you please clarify the following: do you need to receive images from camera server in a python script or a C/C++ application?

The recommended way is to use a C/C++ application, for which we can provide some examples. Python extension via Pympa makes it easier to quickly test / prototype something, but may have additional overhead to receive / convert images.

For example, there is a tool `voxl-inspect-cam-ascii`, which is installed by default with the VOXL2 SDK, which subscribes to an image and renders the image to your terminal using ASCII. It uses opencv to downscale the image. You can find the source code here : https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/blob/master/tools/voxl-inspect-cam-ascii.cpp . this app also shows how to publish an image (it optionally publishes the down-scaled image as well).

You can test this app by running `voxl-inspect-cam-ascii <camera_stream>` in a terminal, and you should see an ASCII version of your image. The name of the camera stream you can get from `voxl-portal` (camera tab), for example it would be something like `tracking` or `hires_front_color`, depending on the cameras / streams that you have enabled.

If you wanted to develop your own application, you can start by first building the `voxl-mpa-tools` package from source and then add your own application into the existing build structure.

Alex

## Reply by l05 · 2025-10-30 19:14:22 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev Sorry for the confusion. I initially wanted to receive images using a Python script for prototyping, but now I plan to develop a C/C++ background service to receive images from camera server. Thank you for your advice, I will start by adding my own application into the existing build structure of voxl-mpa-tools.

## Reply by l05 · 2025-10-30 21:59:55 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev I've downloaded the source code as a zip file and added my application. Trying to build the package and get an error when running make_package.sh. The error is:
"dpkg-deb: error: maintainer script 'postinst' has bad permissions 644 (must be >=0555 and <=0755)" 
Tried to build both the source and the edited source with my application and get the same error. Do you know what could be causing this?

## Reply by Alex Kushleyev (ModalAI staff) · 2025-10-31 16:39:32 UTC (in reply to l05)

@l05 can you try running the `./make_package.sh` script inside docker? also if you are just trying to deploy your app, you can copy it directly from `voxl-mpa-tools/build64/tools`, to voxl2 using adb or ssh (assuming the build itself succeeded). 

Alex

## Reply by l05 · 2025-12-17 22:59:15 UTC (in reply to Alex Kushleyev)

@Alex-Kushleyev Sorry I am a little confused now, I thought to deploy an updated version of voxl-mpa-tools with my custom app I had to cross-compile before using adb to push to the voxl2. In general, if I were to add custom code to any voxl source code project, how do I make sure my new code is being ran and not the old code? What are you referring to above?

## Reply by Alex Kushleyev (ModalAI staff) · 2025-12-20 05:30:08 UTC (in reply to l05)

@l05 , when in doubt, you can add a print statement in your app as a sanity check to make sure you are running the correct version of the application. Then check your print statement at run time.

If you are modifying an existing app in `voxl-mpa-tools`, you just need to use the voxl-cross docker image to 
- build the source code
- build the package (deb)
- deploy the package (either manually pushing and `dpkg -i <package.deb>` on target) or using a convenience script `deploy_to_voxl.sh` which is typically present in most voxl projects -- this script will push the deb to voxl2 and install the deb. 
- run your new application on voxl and confirm functionality

If you are adding a new app to `voxl-mpa-tools` project, you will need to modify the CMakeLists.txt file in the `tools` folder, it should be self explanatory how to add a simple app. Once you build and deploy, your new app will be installed into `/usr/bin` on voxl2.

If you have any other questions, let me know.

Alex
