Introducing Origami

December 6 2017

Origami is an opencv generated wrapper for Clojure which allows some of the opencv code to be written in a concise way.

Motivation

After staring at origami directions long enough, you sort of become one with them and start understanding them from the inside. Zooey Deschanel

You would want to use Origami if you want to avoid the pain of installing OpenCV by hand, and enjoy a lightning fast and expressive language to do image manipulation.

Origami shines in the shortness of the samples, and the fast image processing results of native computation made possible with OpenCV.

Shape finding, Contours, Real time Video content analysis, all of this now possible with a small wrapper.

how it works

(require
  '[opencv3.utils :as u]
  '[opencv3.core :refer :all])

(->
 (imread "doc/cat_in_bowl.jpeg")
 (cvt-color! COLOR_RGB2GRAY)
 (canny! 300.0 100.0 3 true)
 (bitwise-not!)
 (u/resize-by 0.5)
 (imwrite "doc/canny-cat.jpg"))

Getting Started

Required Software to install

  • install jdk 1.8
  • install leiningen (it is a simple script …)
  • that’s it ! (as in, no need to install anyother OpenCV thing …)

to use

Create a brand new origami based project using a Leiningen project template

# install the sample
lein new clj-opencv fun-with-opencv

# run the template simple example
cd fun-with-opencv
lein run

or you can also clone the origami examples:

git clone https://github.com/hellonico/opencv-fun.git

some samples

Examples are included in the project template.

Origami Setup Check (including OpenCV native dependencies check)

lein run -m opencv3.ok

Some Simple OpenCV transformation using origami

lein run -m opencv3.simple

A more advanced set of imaging transformation.

lein run -m opencv3.tutorial

Webcam Sample

lein run -m opencv3.videosample

Gorilla Based Notebook

Gorilla note books are similar to Python Jupyter environment, makes it possible to do image processing straight in the browser.

lein notebook

Once the notebook server is running, you can have a look at two notebooks included in the generated project:

Built with Hugo

© Nicolas Modrzyk 2019 - hellonico @ gmail dot com