       (assoc-in state [:gray-mat]
                 (cv/gray-mat->otsu-gaussian-bw gray-mat bw-mat
                                                (:output-mat state)
-                                               {:threshold-type Imgproc/THRESH_BINARY_INV
-                                                :blur-k-size (Size. 51 51)})))
+                                               {:threshold-type Imgproc/THRESH_BINARY
+                                                :blur-k-size (Size. 41 41)})))
     state))
 
 (defn update-gray-p-image

      (cv/update-frame)
      (update-gray-mat)
      (update-gray-p-image)
      #_(update-blobs)))

(defn draw-centroid [detector n]
  (q/ellipse (.getCentroidX detector n)
             (.getCentroidY detector n)
             40 40))

(defn draw-centroids [{:keys [detector]}]
  (when (and detector
             (< 0 (.getBlobsNumber detector)))
    (q/push-style)
    (q/no-stroke)
    (q/fill 0 255 0 80)
    (dorun
     (map #(draw-centroid detector %)
          (range 0 (.getBlobsNumber detector))))
    (q/pop-style)))

(defn draw [state]
  (let [{:keys [p-image]} state]

    (q/scale -1 1)
    (when p-image
      (q/image p-image 0 0)
      (draw-centroids state))
    (q/pop-matrix)))

(defn on-close
