 ;; bArray is the temporary byte array buffer for OpenCV cv::Mat.
 ;; iArray is the temporary integer array buffer for PImage pixels.
 (defn setup []
-  (q/frame-rate 2)
+  (q/frame-rate 60)
   {:b-array (byte-array PIX-CNT1)
    :i-array (int-array PIX-CNT2)
    :frame-mat (Mat. WIDTH HEIGHT CvType/CV_8UC4)

            (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]

     (when-not (nil? camera)
       (.release camera))))

(q/defsketch videotest
  :title "Video Test"
  :size [WIDTH HEIGHT]
  :setup setup
