Actors that use the Open Computer Vision (OpenCV) API.

Installing OpenCV

See http://ubaa.net/shared/processing/opencv/ for details.

Installing OpenCV under Linux

  1. Find an OpenCV 1.1 RPM by searching the net for opencv rpm. You must install OpenCV-1.1. OpenCV-1.0 and OpenCV-2.0 will not have the proper shared libraries. If OpenCV-1.1 is not installed, then the ptII configure will print:
    checking for the OpenCV jar files...
    !!! required library not found : no OpenCV in java.library.path
    Verify that the java.library.path property is correctly set and 'libcxcore.so',
    'libcv.so', 'libcvaux.so', 'libml.so', and 'libhighgui.so' are placed (or linked)
    in one of your system shared libraries folder
    
  2. Do the install: I could not find a 64 bit linux rpm that did not require lots of other packages, so I built from source:
    wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/1.1pre1/opencv-1.1pre1.tar.gz?use_mirror=iweb
    tar -zxf opencv-1.1pre1.tar.gz
    cd opencv-1.1.0
    ./configure
    make
    sudo make install
    
  3. Download http://ubaa.net/shared/processing/opencv/download/opencv_01.zip
    sudo -i
    cd /tmp
    wget http://ubaa.net/shared/processing/opencv/download/opencv_01.zip
    cd /usr/java
    unzip /tmp/opencv_01.zip
    cp /usr/java/OpenCV/library/OpenCV.jar /usr/java/default/jre/lib/ext/
    cp /usr/java/OpenCV/library/libOpenCV.so /usr/java/default/jre/bin/
    
    Note that libOpenCV.so is a 32 bit shared library, so to recompile for 64 bit:
    cd /usr/java/OpenCV/source/cpp
    javah -classpath ../java -jni hypermedia.video.OpenCV 
    g++ -fPIC -shared OpenCV.cpp -I/usr/local/include/opencv -lc\
    v -o libOpenCV.so
    cp libOpenCV.so /usr/java/default/jre/lib/amd64/
    
  4. Download http://processing.googlecode.com/files/processing-1.1.tgz
    tar -zxf processing-1.1.tgz
    cp processing-1.1/lib/core.jar /usr/java/default/jre/lib/ext/
    

Installing OpenCV under Mac OS X

>Note that Under Mac OS 1.5, you must be running Java 1.5 because Java 1.6 is 64 bit and OpenCV appears to come with only 32 bit libraries. You will get something about

!!!required library not found:  Can't find dependent Libraries
Verify that the java.library.path is correctly set and the path exists
in your system Path
  1. Download http://ubaa.net/shared/processing/opencv/download/opencv-framework.1.1.dmg
  2. Install opencv-framework.1.1.dmg, which will create /Library/Frameworks/OpenCV.framework/
  3. Download Processing from http://processing.org/download/index.html
  4. Copy core.jar from Processing to the extensions directory
    sudo cp /Applications/Processing.app/Contents/Resources/Java/core.jar /System/Library/Java/Extensions/
      
    If you don't do the copy, then you will get errors about processing.core.PImage missing because OpenCV.jar is in the extensions folder and needs PImage, so even if core.jar is on your classpath, it will only be found if it is in the extensions folder.
  5. Download and unziphttp://ubaa.net/shared/processing/opencv/download/opencv_01.zip
  6. Copy the .jar and .jnilib to /System/Library/Java/Extensions:
        sudo cp ~/Downloads/OpenCV/library/OpenCV.jar /System/Library/Java/Extensions/
        sudo cp ~/Downloads/OpenCV/library/libOpenCV.jnilib /System/Library/Java/Extensions/
     

Installing OpenCV under Windows

Make sure that you install "OpenCV release version 1.0", not 2.0
!!!required library not found:C:\Program Files
(x86)\Java\jdk1.6.0_18\jre\bin\OpenCV.dll: Can't find dependent
libraries
Verify that the java.library.path property is correctly set and the
'\path\to\OpenCV\bin' exists in your system path

Running dependency Walker on OpenCV.dll showed that it was dependent on CV100.DLL, CXCORE100.DLL and HIGHGUI100.DLL. However, The OpenCV2.0 directory (which is wrong) does not have these dlls.

@since Ptolemy II 8.1