I have the following code and I'm using opencv through the origami library:
(require '[opencv4.core :refer :all])
(import '[org.opencv.core Mat])
(import '[org.opencv.ximgproc Ximgproc])
(let [img (-> "resources/public/test-small.jpg"
(imread))
size (.size img)
blurred (Mat. size 5)
_ (gaussian-blur img blurred (new-size 17 17) 9 9)
blurred-float (Mat. size 5)
_ (.convertTo blurred blurred-float 5) ;; five is just the f32 type id
edgeDetector (Ximgproc/createStructuredEdgeDetection "resources/model.yml")
mat (Mat. size 5)
_ (.detectEdges edgeDetector blurred-float mat)
identity- (. Mat eye size 5)
edges (.mul mat identity- 255.0)
]
(prn "blurred size" size)
(prn "mat is " mat)
(imwrite edges "edge-raw1.jpg" )
)
But I'm getting the following image as output to edge-raw1.jpg.
What am I doing wrong?Suppose I have a vector like so:
[
[[50][60][70][20][0]...]
[[90][56][67][98][78]...]
...]
Which represents a single channel 8-bit image. Is there a simple way to convert this into a jpg or a png?