Ask Your Question

onedude's profile - activity

2016-05-29 06:51:59 -0600 received badge  Popular Question (source)
2013-02-06 16:19:18 -0600 commented question Cross-compiling OpenCV for Raspberry Pi with Python Support.

Anyone.... Anyone... Buuueller... I see traffic to this post but no takes on what to do?

2013-01-26 11:30:10 -0600 received badge  Editor (source)
2013-01-26 11:23:44 -0600 asked a question Cross-compiling OpenCV for Raspberry Pi with Python Support.

Hi Guys,

I am kind of a noob that knows how to follow instructions and add my own, but I am a bit stuck. I dont know if this forum or the CMAKE forum would be the place to go but I guess I will start here.

I am trying to cross-compile OpenCV for a raspberry Pi with Python support. There are instructions on how to compile directly on the raspberry pi, but it takes 4+ hours to complete. (these instructions are here at MitchTech.net (INSTRUCTION_SET_1) ) It seems to work for the version they call out for but I was trying to get the latest version of opencv and it failed and I got sick of waiting 4 hours every time I need to re-build the binaries. Hence I decided to look into cross compiling. I was successful at cross compiling a simple "Hello World" program using these other instructions (INSTRUCTION_SET_2). So I decided to jump in and try to compile OpenCV by following the first set of instruction but changing the CMAKE command to this:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON -D CMAKE_TOOLCHAIN_FILE=/home/shocker/workspace/rasp-pi/toolchain/bin/Toolchain-RaspberryPi.cmake ..

Before running this I installed the libraries and other required programs on the raspberry pi and tried to "rsync" it to my PC for the cross compiling. Now I hit a brick wall because I cant seem to figure out how to tell CMAKE to use those libraries (I am doing it by setting the CMAKE_FIND_ROOT_PATH variable in the toolchain point to the root of where the "rsync" was placed). If I am doing this correctly, it is still not working because when I run "make" it fails either when attempting to compile a dc1394 library or somewhere else. I figured I could turn off 1934 compiling since rasp-pi doesnt have one, but then something else failed. Exact failure was:

/workspace/rasp-pi/OpenCV-2.4.3/modules/highgui/src/cap_libv4l.cpp:250:21: fatal error: libv4l1.h: No such file or directory compilation terminated. make[2]: * [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_libv4l.cpp.o] Error 1 make[1]: [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2 make: ** [all] Error 2

As a summary of what I did:

  1. Follow INSTRUCTION_SET_1 on the raspberry pi to install any additional/required libraries on the pi. Don't compile OpenCV.
  2. Follow INSTRUCTION_SET_2 on PC to get cross compiler running.
  3. Follow rest of instructions on getting OpenCV on PC working but change CMAKE command to the one mentioned above.

If that would have worked. I would have copied the whole recently built folder to the pi and then execute "make install"

Sorry for the looooong explanation, but I figured if what I am doing is correct, then someone else can complete what I am missing or failing at.

Thank you in advance you great guru community.