add clojure sample

This commit is contained in:
Mimmmo Cosenza 2013-12-11 13:26:47 +01:00
parent 2784fd7b27
commit f07e9e7c5f
5 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,9 @@
/target
/classes
/checkouts
pom.xml
pom.xml.asc
*.jar
*.class
/.lein-*
/.nrepl-port

View File

@ -0,0 +1,14 @@
(defproject simple-sample "0.1.0-SNAPSHOT"
:pom-addition [:developers [:developer {:id "magomimmo"}
[:name "Mimmo Cosenza"]
[:url "https://github.com/magomimmoo"]]]
:description "A simple project to start REPLing with OpenCV"
:url "http://example.com/FIXME"
:license {:name "BSD 3-Clause License"
:url "http://opensource.org/licenses/BSD-3-Clause"}
:dependencies [[org.clojure/clojure "1.5.1"]
[opencv/opencv "2.4.7"]
[opencv/opencv-native "2.4.7"]]
:main simple-sample.core
:injections [(clojure.lang.RT/loadLibrary org.opencv.core.Core/NATIVE_LIBRARY_NAME)])

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 KiB

View File

@ -0,0 +1,16 @@
;;; to run this code from the terminal: "$ lein run". It will save a
;;; blurred image version of resources/images/lena.png as
;;; resources/images/blurred.png
(ns simple-sample.core
(:import [org.opencv.core Point Rect Mat CvType Size Scalar]
org.opencv.highgui.Highgui
org.opencv.imgproc.Imgproc))
(defn -main [& args]
(let [lena (Highgui/imread "resources/images/lena.png")
blurred (Mat. 512 512 CvType/CV_8UC3)]
(print "Blurring...")
(Imgproc/GaussianBlur lena blurred (Size. 5 5) 3 3)
(Highgui/imwrite "resources/images/blurred.png" blurred)
(println "done!")))

View File

@ -0,0 +1,7 @@
(ns simple-sample.core-test
(:require [clojure.test :refer :all]
[simple-sample.core :refer :all]))
(deftest a-test
(testing "FIXME, I fail."
(is (= 0 1))))