0

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.

cmake -D CMAKE_BUILD_TYPE=RELEASE \
 -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 OPENCV_ENABLE_NONFREE=ON \ 
 -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 \
 -D BUILD_OPENCV_PYTHON2=ON \
 -D BUILD_OPENCV_PYTHON3=ON \
 -D ENABLE_NEON=ON \
 -D ENABLE_VFPV3=ON \
 -D WIDTH_GTK=ON \
 -D BUILD_TESTS=OFF \
 -D BUILD_DOCS=OFF \
 -D BUILD_EXAMPLES=OFF ..

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

asked Apr 8, 2019 at 13:01
1

1 Answer 1

1

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/

answered Apr 9, 2019 at 9:12
1
  • No matching distribution found for opencv-python Commented Aug 4, 2019 at 7:26

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.