MMAL library and raspivid/raspistill source code are found in Userland folder (@GitHub, here). First of all, we need to compile the whole package before doing anything else with OpenCV.

  1. get source code (zip file)  here : https://github.com/raspberrypi/userland
  2. unzip the file and copy the directory under /opt/vc
  3. go to opt/vc and type : sed -i ‘s/if (DEFINED CMAKE_TOOLCHAIN_FILE)/if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)/g’ makefiles/cmake/arm-linux.cmake
  4.  create a build directory and compile (it takes a while) 

sudo mkdir build
cd build
sudo
cmake -DCMAKE_BUILD_TYPE=Release ..
sudo
make
sudo
make install

Binary should be under /opt/vc/bin

Go to /opt/vc/bin and test one file typing : ./raspistill -t 3000

At this stage, you should be able to modify this software to include OpenCV calls.  Congratulation ! Now, all nexts steps are piece of cakes…. 

Advertisements