Remove unused code
This commit is contained in:
parent
81896ba400
commit
3d2075764a
1 changed files with 5 additions and 36 deletions
|
|
@ -12,38 +12,15 @@
|
||||||
(.clearRect ctx 0 0 (.. ctx -canvas -width) (.. ctx -canvas -height))
|
(.clearRect ctx 0 0 (.. ctx -canvas -width) (.. ctx -canvas -height))
|
||||||
|
|
||||||
;; draw and append new results
|
;; draw and append new results
|
||||||
|
(set! (.-strokeStyle ctx) "pink")
|
||||||
(doseq [prediction predictions
|
(doseq [prediction predictions
|
||||||
:let [[[t-x t-y]] (j/get-in prediction [:boundingBox :topLeft])
|
:let [[[t-x t-y]] (j/get-in prediction [:boundingBox :topLeft])
|
||||||
[[b-x b-y]] (j/get-in prediction [:boundingBox :bottomRight])]]
|
[[b-x b-y]] (j/get-in prediction [:boundingBox :bottomRight])]]
|
||||||
(set! (.-strokeStyle ctx) "pink")
|
|
||||||
|
|
||||||
(comment
|
|
||||||
(.setLineDash ctx #js [2 2])
|
|
||||||
|
|
||||||
(.beginPath ctx)
|
|
||||||
(.moveTo ctx t-x t-y)
|
|
||||||
(.lineTo ctx t-x b-y)
|
|
||||||
(.lineTo ctx b-x b-y)
|
|
||||||
(.lineTo ctx b-x t-y)
|
|
||||||
(.lineTo ctx t-x t-y)
|
|
||||||
(.stroke ctx)
|
|
||||||
|
|
||||||
(.setLineDash ctx #js [])
|
|
||||||
(.beginPath ctx)
|
|
||||||
(.arc ctx b-x b-y 2 0 (* 2 Math/PI))
|
|
||||||
(.stroke ctx))
|
|
||||||
|
|
||||||
(doseq [[x y _] (j/get prediction :scaledMesh)]
|
(doseq [[x y _] (j/get prediction :scaledMesh)]
|
||||||
(.beginPath ctx)
|
(.beginPath ctx)
|
||||||
(.arc ctx x y 1 0 (* 2 Math/PI))
|
(.arc ctx x y 1 0 (* 2 Math/PI))
|
||||||
(.stroke ctx))
|
(.stroke ctx)))))
|
||||||
|
|
||||||
(comment
|
|
||||||
(doseq [[x y _] (j/get prediction :mesh)]
|
|
||||||
(.beginPath ctx)
|
|
||||||
(.arc ctx x y 2 0 (* 2 Math/PI))
|
|
||||||
(.stroke ctx))))))
|
|
||||||
|
|
||||||
(defn detect-faces [model elem]
|
(defn detect-faces [model elem]
|
||||||
(.. model
|
(.. model
|
||||||
|
|
@ -73,10 +50,10 @@
|
||||||
;; TODO: Initialize model in the background
|
;; TODO: Initialize model in the background
|
||||||
|
|
||||||
(defn init []
|
(defn init []
|
||||||
|
(println "Initializing…")
|
||||||
(swap! state ::status :webcam-init)
|
(swap! state ::status :webcam-init)
|
||||||
(let [video (.querySelector js/document "video#capture")
|
(let [video (.querySelector js/document "video#capture")
|
||||||
canvas (.querySelector js/document "canvas#result")
|
canvas (.querySelector js/document "canvas#result")]
|
||||||
ctx (.getContext canvas "2d")]
|
|
||||||
(-> (start-capture video)
|
(-> (start-capture video)
|
||||||
(.then (fn [video]
|
(.then (fn [video]
|
||||||
(.play video)
|
(.play video)
|
||||||
|
|
@ -95,12 +72,4 @@
|
||||||
(then #(.load facemesh #js {:maxFaces 1}))
|
(then #(.load facemesh #js {:maxFaces 1}))
|
||||||
(then #(detect-faces % video))))))))
|
(then #(detect-faces % video))))))))
|
||||||
|
|
||||||
(.-clientWidth (.querySelector js/document "video#capture"))
|
(defonce initialize (init))
|
||||||
|
|
||||||
(defonce initialize (init)
|
|
||||||
#_(do
|
|
||||||
(println "Initializing…")
|
|
||||||
(.. tf
|
|
||||||
(setBackend "webgl")
|
|
||||||
(then #(.load facemesh #js {:maxFaces 1}))
|
|
||||||
(then detect-faces))))
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue