Skip to content

Instantly share code, notes, and snippets.

@mattmcd
Created February 10, 2016 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattmcd/5905af957181a149833f to your computer and use it in GitHub Desktop.
Save mattmcd/5905af957181a149833f to your computer and use it in GitHub Desktop.
Instructions for setting up OpenCV development in Clojure on Ubuntu
# Instructions for setting up OpenCV development in Clojure on Ubuntu
# Copied from http://docs.opencv.org/2.4/doc/tutorials/introduction/clojure_dev_intro/clojure_dev_intro.html
# Install opencv
sudo apt-get install libopencv-dev
# Get location of latest .jar and .so
dpkg -L libopencv2.4-java | grep jar
dpkg -L libopencv2.4-jni | grep .so
# Create directory for local repo
cd ~
mkdir opt
cd opt/
mkdir clj-opencv
cd clj-opencv/
# Create directory structure needed for localrepo
cp /usr/share/OpenCV/java/opencv-248.jar .
mkdir native
mkdir native/linux
mkdir native/linux/x86_64
cp /usr/lib/jni/libopencv_java248.so native/linux/x86_64/
jar -cMf opencv-native-248.jar native
# Install localrepo plugin
vim ~/.lein/profiles.clj # Add line below
# {:user {:plugins [[lein-localrepo "0.5.3"]]}}
lein localrepo install opencv-248.jar opencv/opencv 2.4.8
lein localrepo install opencv-native-248.jar opencv/opencv-native 2.4.8
# To use within a clojure project add to project.clj dependencies
# (defproject app "1.0.0-SNAPSHOT"
# :description "FIXME: write description"
# :dependencies [[org.clojure/clojure "1.7.0"]
# [opencv/opencv "2.4.8"]
# [opencv/opencv-native "2.4.8"] ])
# To use in REPL
# (clojure.lang.RT/loadLibrary org.opencv.core.Core/NATIVE_LIBRARY_NAME)
@mattmcd
Copy link
Author

mattmcd commented Feb 10, 2016

Copied from OpenCV Clojure dev intro with some Ubuntu specific steps to install the opencv library and find location of installed files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment