Hi so I've got a camera module for my Pi Zero and wanted to play around with OpenCV and Python.

Looking around google, if found a few guides to get OpenCV to a Raspberry but most included to either download some compiled code form some random guys github or to compile on the raspberry pi (48h+ no thank you).

Since I did not wanted to do either of these options I looked further and found this guide on cross-compiling OpenCV for Raspberry PI.

I followed it, but later realized that it targets a PI 2/3 and not a Zero, and results in an invalid instruction error on the Zero. So here is my question: What options do I need to change to cross-compile to the raspberry pi zero? Or is it impossible to do that way?

Original command form the Guide.

    -D CMAKE_INSTALL_PREFIX=/opt/opencv-4.0.0 \
    -D CMAKE_TOOLCHAIN_FILE=../platforms/linux/arm-gnueabi.toolchain.cmake \
   -D OPENCV_EXTRA_MODULES_PATH=~/opencv_all/opencv_contrib-4.0.0/modules \
   -D PYTHON2_INCLUDE_PATH=/usr/include/python2.7 \
   -D PYTHON2_LIBRARIES=/usr/lib/arm-linux-gnueabihf/libpython2.7.so \
   -D PYTHON2_NUMPY_INCLUDE_DIRS=/usr/lib/python2/dist-packages/numpy/core/include \
   -D PYTHON3_INCLUDE_PATH=/usr/include/python3.5m \
   -D PYTHON3_LIBRARIES=/usr/lib/arm-linux-gnueabihf/libpython3.5m.so \
   -D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib/python3/dist-packages/numpy/core/include \

I already figured out that ENABLE_VFPV3=ON and ENABLE_NEON=ON are wrong, but only removing them dose not work either.


If im not mistaken you have a compressed opencv package available.

  • run pip install opencv-python if you need only main modules
  • run pip install opencv-contrib-python if you need both main and contrib modules (check extra modules listing from OpenCV documentation)

I have used this package for basic openCV functionality such as accessing a webcam.

Further Documentation: https://pypi.org/project/opencv-python/

  • No matching distribution found for opencv-python – Heetola Aug 4 '19 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.