15.3. OpenMV Python package

The openmv PyPI package is the host-side Python library for driving an OpenMV Cam from a desktop or single-board-computer Python program. It connects to the cam over USB, uploads and executes scripts, streams frames back, reads stdout from the running script, and exchanges arbitrary binary data through named channels. The same protocol the IDE uses runs underneath, so anything the IDE does to a cam is something a Python program can do too.

Two ways in. The included openmv command-line tool opens a viewer and is the fastest way to verify the package is installed and a cam is reachable. The openmv.Camera class is the entry point for Python code that wants to drive a cam itself – headless capture, automated test rigs, custom desktop GUIs, or any other application the IDE does not cover.

15.3.1. Install

The package is on PyPI:

pip install openmv

Python 3.12 or newer is required. The install pulls in its dependencies automatically: pyserial for the USB serial transport, numpy for frame decoding, pygame for the CLI viewer, and pyelftools for the profiler.