add clojure sample

pull/1975/head
Mimmmo Cosenza 11 years ago
parent 2784fd7b27
commit f07e9e7c5f
  1. 9
      samples/java/clojure/simple-sample/.gitignore
  2. 14
      samples/java/clojure/simple-sample/project.clj
  3. BIN
      samples/java/clojure/simple-sample/resources/images/lena.png
  4. 16
      samples/java/clojure/simple-sample/src/simple_sample/core.clj
  5. 7
      samples/java/clojure/simple-sample/test/simple_sample/core_test.clj

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

@ -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

@ -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!")))

@ -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))))
Loading…
Cancel
Save