Skip to content

Commit f07e9e7

Browse files
committed
add clojure sample
1 parent 2784fd7 commit f07e9e7

File tree

5 files changed

+46
-0
lines changed

5 files changed

+46
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/target
2+
/classes
3+
/checkouts
4+
pom.xml
5+
pom.xml.asc
6+
*.jar
7+
*.class
8+
/.lein-*
9+
/.nrepl-port
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(defproject simple-sample "0.1.0-SNAPSHOT"
2+
:pom-addition [:developers [:developer {:id "magomimmo"}
3+
[:name "Mimmo Cosenza"]
4+
[:url "https://github.com/magomimmoo"]]]
5+
6+
:description "A simple project to start REPLing with OpenCV"
7+
:url "http://example.com/FIXME"
8+
:license {:name "BSD 3-Clause License"
9+
:url "http://opensource.org/licenses/BSD-3-Clause"}
10+
:dependencies [[org.clojure/clojure "1.5.1"]
11+
[opencv/opencv "2.4.7"]
12+
[opencv/opencv-native "2.4.7"]]
13+
:main simple-sample.core
14+
:injections [(clojure.lang.RT/loadLibrary org.opencv.core.Core/NATIVE_LIBRARY_NAME)])
Loading
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
;;; to run this code from the terminal: "$ lein run". It will save a
2+
;;; blurred image version of resources/images/lena.png as
3+
;;; resources/images/blurred.png
4+
5+
(ns simple-sample.core
6+
(:import [org.opencv.core Point Rect Mat CvType Size Scalar]
7+
org.opencv.highgui.Highgui
8+
org.opencv.imgproc.Imgproc))
9+
10+
(defn -main [& args]
11+
(let [lena (Highgui/imread "resources/images/lena.png")
12+
blurred (Mat. 512 512 CvType/CV_8UC3)]
13+
(print "Blurring...")
14+
(Imgproc/GaussianBlur lena blurred (Size. 5 5) 3 3)
15+
(Highgui/imwrite "resources/images/blurred.png" blurred)
16+
(println "done!")))
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(ns simple-sample.core-test
2+
(:require [clojure.test :refer :all]
3+
[simple-sample.core :refer :all]))
4+
5+
(deftest a-test
6+
(testing "FIXME, I fail."
7+
(is (= 0 1))))

0 commit comments

Comments
 (0)