   (:import
    [org.opencv.highgui Highgui VideoCapture]
    [org.opencv.core CvType Mat]
-   [java.nio ByteBuffer]))
+   [org.opencv.imgproc Imgproc]
+   [java.nio ByteBuffer ByteOrder]))
 
 (def WIDTH 640)
 (def HEIGHT 480)

            (update-in [:frame-mat] (partial grab-frame! camera) ))))

(defn mat->p-img [mat b-array i-array p-img]
  (.get mat 0 0 b-array)
  (-> (ByteBuffer/wrap b-array)
      (.asIntBuffer)
      (.get i-array))
  (set! (.pixels p-img) (aclone i-array))
  p-img)

(defn update-p-image [state]


(defn draw [state]
  (let [{:keys [p-image]} state]
    (q/background 0)
    (q/image p-image 0 0)))

(defn on-close
