         tri-glyphs (triangle-glyphs tri-pts tri-orients)]
    {:b-array (byte-array PIX-CNT1)
     :i-array (int-array PIX-CNT2)
-    :frame-mat (Mat. HEIGHT WIDTH CvType/CV_8UC3)
-    :output-mat (Mat. HEIGHT WIDTH CvType/CV_8UC4)
-    :gray-mat (Mat.)
-    :rgba-mat (Mat.)
-    :drawn-mat (Mat. HEIGHT WIDTH CvType/CV_8UC4)
+    :frame-mat (mat CAM-HEIGHT CAM-WIDTH CvType/CV_8UC3)
+    :output-mat (mat DISPLAY-HEIGHT DISPLAY-WIDTH CvType/CV_8UC4)
+    :gray-mat (mat)
+    :rgba-mat (mat CAM-HEIGHT CAM-WIDTH CvType/CV_8UC4)
+    :drawn-mat (mat DISPLAY-HEIGHT DISPLAY-WIDTH CvType/CV_8UC4)
     :camera (cv/camera CAM-DEV-NUM)
-    :p-image (q/create-image WIDTH HEIGHT :rgb)
+    :p-image (q/create-image DISPLAY-WIDTH DISPLAY-HEIGHT :rgb)
     :triangle-points tri-pts
     :triangle-orientations tri-orients
     :triangle-glyphs tri-glyphs}))

        (partition 2 triangle-points)))
  state)

(defn rgba-mat->p-img
  "Input mat is really BGR, but we'll flip these bits in
   any-mat->p-img. If you don't use that, swap blue and red."
  [in-mat out-mat b-array i-array p-img]
  (cv/any-mat->p-img in-mat out-mat Imgproc/COLOR_RGBA2BGRA b-array i-array p-img))

(defn update-drawn-p-image [state]
  (let [{:keys [drawn-mat output-mat b-array i-array]} state]
    (update-in state [:p-image] #(cv/mat->p-img drawn-mat output-mat b-array i-array %))))

  []
  (for [col-bin (range 0 NUM-COL-BINS)
        row-bin (range 0 NUM-ROW-BINS)
        :let [mat-col (* col-bin DISPLAY-BIN-SIZE)
              mat-row (* row-bin DISPLAY-BIN-SIZE)]
        :when (= 0 (mod col-bin 2))]
    [mat-col mat-row]))

