Friday, 21 June 2013

OpenCV installation notes

Now I am moving on to the make part of OpenCV installation.   The Mitchtech tutorial say the compilation takes four and a half hours.  So, with a little bit of luck, I can run the Python OpenCV demos this afternoon!

.END


Raspberry Pi + OpenCV POSTED BY MICHAEL ON JUN 14, 2012

http://mitchtech.net/raspberry-pi-opencv/

...

*** Make ***

cd OpenCV-2.3.1/

mkdir build

cd build

Next, you will need to configure the build using cmake. If you aren’t sure about what options you want/need or are unfamiliar with cmake, this line will create a standard configuration:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON ..

Alternatively, you can configure the build using a GUI interface. This can be helpful to build with support for additional OpenCV features. To use the cmake GUI, run:

cmake-gui ..

In the cmake GUI, click ‘configure’ to pre-populate the build options. Select or remove any desired features, then click ‘configure’ again, check the output and ensure that there are not any modules that cmake cannot find. If everything looks good, click ‘generate’ to create the makefiles, then close cmake-gui. Now we are ready to start the build! To compile, run make, then install with make install:

make

sudo make install

As you can see from the image, this will take a LONG time ... over four and a half hours to compile!



*** Configure ***

Finally, we need to make a few configurations for OpenCV. First, open the opencv.conf file with the following code:

sudo nano /etc/ld.so.conf.d/opencv.conf

Add the following line at the end of the file(it may be an empty file, that is ok) and then save it:

/usr/local/lib

Then edit the system-wide bashrc file:

sudo nano /etc/bash.bashrc

Add the following new lines to the end of the file:

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH



*** C Demos ***

Now that everything is installed and configured, on to the demos!  The C demos are here:

cd ~/opencv/OpenCV-2.3.1/build/bin

C demos in build/bin demos worth checking out (that don’t require a webcam):

convexhull

kmeans

drawing


*** Python demos ***

The python demos are located in samples/python:

cd ~/opencv/OpenCV-2.3.1/build/bin

These demos also don’t require a webcam:

python ./minarea.py

python ./delaunay.py

python ./drawing.py

.END

No comments:

Post a Comment