Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You shouldn't need to install a local copy of libv4l. The libv4l-dev package in Ubuntu should be sufficient. Here is the full list of steps I had to perform to compile OpenCV from source under Ubuntu 13.04 with Java support:

# install basic development environment
sudo apt-get install build-essential cmake pkg-config

# install opencv dependencies. ubuntu 13.04 ships with opencv
# 2.4.2, which is close enough to 2.4.6 to pull in most of the
# needed dependencies.
sudo apt-get build-dep libopencv-dev
# additional dependencies for java support
sudo apt-get install default-jdk ant

# compile opencv
tar xzvf opencv-2.4.6.1.tar.gz
cd opencv-2.4.6.1
mkdir build; cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON ..
make
sudo make install

If you're still having trouble, can you post the full cmake command you're using?

OpenGL support (optional)

If you need OpenGL support, you'll want to "sudo apt-get install libgtkglext1-dev" and add "-D WITH_OPENGL=ON" to the list of cmake arguments.

OpenCL support (optional)

To compile with OpenCL support, you'll want to "sudo apt-get install ocl-icd-opencl-dev", apply the following patch (if you're on a 64-bit system), and then prefix the above cmake command with "OCLROOT=/usr" (i.e. "OCLROOT=/usr cmake -D ...".

--- opencv-2.4.6.1/cmake/OpenCVDetectOpenCL.cmake.orig  2013-07-10 11:49:00.000000000 +0000
+++ opencv-2.4.6.1/cmake/OpenCVDetectOpenCL.cmake       2013-08-02 17:37:11.105800999 +0000
@@ -21,7 +21,7 @@
               NO_DEFAULT_PATH)

     if (X86_64)
-      set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win64 lib/x86_64 lib/x64)
+      set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win64 lib/x86_64 lib/x64 lib/x86_64-linux-gnu)
     elseif (X86)
       set(OPENCL_POSSIBLE_LIB_SUFFIXES lib/Win32 lib/x86)
     endif()