Clojure Quil + OpenCV demo projects
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Some Clojure Quil + OpenCV demo projects


  • Working Clojure install
  • Some familiarity with Quil (Clojure's Processing port)
  • Some familiarity / interest in OpenCV
  • OpenCV JARs installed in Maven (see below)

The Demos

The demos highlighted here are Quil sketches. Run them as you would any Quil sketch. I prefer to eval the ns in an Emacs Cider REPL.

Lucas-Kanade Optical Flow

Flow Vectors Optical Flow: Vectors, while moving camera (above)

Flow Corners Optical Flow: Corners (above)

OpenCV Required

You'll have to build and install the OpenCV JAR files for your setup. Installation tested on Archlinux and OS X. The following is a rough summary of "Introduction to OpenCV Development with Clojure."

Note, at time of writing, the latest version was 2.4.10. So, you may need to replace 2410 in the instructions below with the current version.


Confirm Java is already installed:

$ java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

Otherwise, install it.

On OS X, I used Homebrew, requiring the following

brew update
brew install cmake
brew install python2
brew install ant

If python2 not available, make sure you have Python pointing to Python v2.

Build the OpenCV JAR files

git clone
cd opencv
git checkout 2.4
mkdir build
cd build
... output omitted ...
... make sure that java is on the list of OpenCV modules "to be built"
... if it isn't on the list, the check for missing Java deps in the
... same output
make -j8

NO NEED TO INSTALL IT, WE JUST NEED THE JAR. So, there's no reason to install it.

Built files are:


Use lein-localrepo to install JAR files

Create a file named profiles.clj in the ~/.lein directory and copy into it the following content:

{:user {:plugins [[lein-localrepo "0.5.3"]]}}

You may need to change 0.5.3 to the latest version of lein-localrepo.

mkdir clj-opencv
cd clj-opencv
cp <path>/<to>/opencv/build/bin/opencv-2410.jar .
mkdir -p native/macosx/x86_64
cp ../opencv/build/lib/libopencv_java2410.dylib native/macosx/x86_64
jar -cMf opencv-native-2410.jar native
lein localrepo install opencv-2410.jar opencv/opencv 2.4.10
lein localrepo install opencv-native-2410.jar opencv/opencv-native 2.4.10