Skip to content

Commit

Permalink
Major subsystem upgrade to 2.0 of everything
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Nuernberger committed Nov 19, 2018
1 parent 60b769a commit 04884ce
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions project.clj
Expand Up @@ -4,8 +4,8 @@
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.9.0"]
[techascent/tech.javacpp-datatype "1.10"]
[techascent/tech.javacpp-datatype "2.2"]
[org.bytedeco.javacpp-presets/opencv-platform "3.4.0-1.4"]]

;;Makes for some great demos
:profiles {:dev {:dependencies [[techascent/tech.compute "1.15-SNAPSHOT"]]}})
:profiles {:dev {:dependencies [[techascent/tech.compute "2.0"]]}})
17 changes: 8 additions & 9 deletions test/tech/opencv_compute_test.clj
Expand Up @@ -13,23 +13,21 @@
[]
(resource/with-resource-context
(let [test-image (opencv/load "test/data/test.jpg")
image-tens (cpu-tm/buffer->tensor test-image)
;;Select is in-place so this did not change the image at all.
bgr-image (ct/select image-tens :all :all [2 1 0])
bgr-image (ct/select test-image :all :all [2 1 0])
dest-tens (ct/clone bgr-image)]
;;The tensor library has the convention that the thing that is mutated
;;is the first thing. Also the thing that is mutated is returned from
;;the function.
(ct/assign! image-tens dest-tens)
(ct/assign! test-image dest-tens)
(opencv/save test-image "bgr.jpg"))))


(deftest lighten-bgr-test
[]
(resource/with-resource-context
(let [test-image (opencv/load "test/data/test.jpg")
image-tens (cpu-tm/buffer->tensor test-image)]
(ct/assign! image-tens (-> image-tens
(let [test-image (opencv/load "test/data/test.jpg")]
(ct/assign! test-image (-> test-image
(ct/select :all :all [2 1 0])
(ct/clone :datatype :uint16)
(op/+ 50)
Expand All @@ -40,6 +38,7 @@


(deftest smooth-image-flow
(-> (opencv/load "test/data/test.jpg")
(op// 2)
(opencv/save "tensor_darken.jpg")))
(resource/with-resource-context
(-> (opencv/load "test/data/test.jpg")
(op// 2)
(opencv/save "tensor_darken.jpg"))))
11 changes: 10 additions & 1 deletion test/tech/opencv_test.clj
Expand Up @@ -6,7 +6,9 @@
[clojure.core.matrix :as m]
[clojure.core.matrix.macros :refer [c-for]]
[tech.datatype :as dtype]
[tech.datatype.base :as dtype-base]))
[tech.datatype.base :as dtype-base]
[tech.datatype.java-unsigned :as unsigned]
[tech.datatype.jna :as dtype-jna]))

(defn delete-test-file!
[test-fname]
Expand Down Expand Up @@ -66,3 +68,10 @@
(dtype/copy-raw->item! (repeat 3 src-image) test-buf 0)
(is (= [172 170 170 172 170 170 171 169 169 171]
(vec (take 10 test-buf)))))))


(deftest correct-interfaces
(resource/with-resource-context
(let [src-image (opencv/load "test/data/test.jpg")]
(is (dtype-jna/typed-pointer? src-image)
(unsigned/typed-buffer? src-image)))))

0 comments on commit 04884ce

Please sign in to comment.