How to propely import cv2 into a python service

I’ve been trying to use cv2 in a python service to have the drone preform image processing, however doing so stops the mission entirely. I’m trying to understand if there’s something else I need to include like in the yaml file or somewhere else to get this working properly. I read that like “math”, cv was included with Parrot, so I’m a little unsure on why this error is occurring. Here below is my current yaml file with opencv4 included. Any details would be appreciated.
api_version: 1
kind: Mission
metadata:
uid: com.parrot.missions.samples.move
name: move
description: Move the drone along a certain trajectory without using a guidance mode.
version: “1.0.0”
target_model_id: 091A
target_min_version: “7.7.0”
target_max_version: “7.7.99”
pip:
requirements:
- paramiko
- scp
- pyserial
- XBee
- digi-xbee
# - matplotlib
services:
go_to:
lang: c++
depends:
- libairsdk
- libarsdk
- libarsdkctrl
- libarsdkgen
- libconfigreader
zig_com:
lang: python
depends:
- opencv4

Hi @aleuser,

Yes, opencv4 is included in the drone, but only for C/C++. It is not built for python (in the drone).

We advise against trying to use python for image processing in the mission Air SDK (with opencv4 for example). Instead, we recommend using C/C++, which offers better performance in the drone.

Regards,
Axel

This topic was automatically closed after 30 days. New replies are no longer allowed.