From 3d2075764a5edc43e6abdb4aa2dbe2c40f87488a Mon Sep 17 00:00:00 2001 From: heyarne Date: Sat, 2 May 2020 22:25:51 +0200 Subject: [PATCH] Remove unused code --- src/heyarne/all_my_friends/core.cljs | 41 ++++------------------------ 1 file changed, 5 insertions(+), 36 deletions(-) diff --git a/src/heyarne/all_my_friends/core.cljs b/src/heyarne/all_my_friends/core.cljs index e229029..3fd347f 100644 --- a/src/heyarne/all_my_friends/core.cljs +++ b/src/heyarne/all_my_friends/core.cljs @@ -12,38 +12,15 @@ (.clearRect ctx 0 0 (.. ctx -canvas -width) (.. ctx -canvas -height)) ;; draw and append new results - + (set! (.-strokeStyle ctx) "pink") (doseq [prediction predictions :let [[[t-x t-y]] (j/get-in prediction [:boundingBox :topLeft]) [[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)] (.beginPath ctx) (.arc ctx x y 1 0 (* 2 Math/PI)) - (.stroke ctx)) - - (comment - (doseq [[x y _] (j/get prediction :mesh)] - (.beginPath ctx) - (.arc ctx x y 2 0 (* 2 Math/PI)) - (.stroke ctx)))))) + (.stroke ctx))))) (defn detect-faces [model elem] (.. model @@ -73,10 +50,10 @@ ;; TODO: Initialize model in the background (defn init [] + (println "Initializing…") (swap! state ::status :webcam-init) (let [video (.querySelector js/document "video#capture") - canvas (.querySelector js/document "canvas#result") - ctx (.getContext canvas "2d")] + canvas (.querySelector js/document "canvas#result")] (-> (start-capture video) (.then (fn [video] (.play video) @@ -95,12 +72,4 @@ (then #(.load facemesh #js {:maxFaces 1})) (then #(detect-faces % video)))))))) -(.-clientWidth (.querySelector js/document "video#capture")) - -(defonce initialize (init) - #_(do - (println "Initializing…") - (.. tf - (setBackend "webgl") - (then #(.load facemesh #js {:maxFaces 1})) - (then detect-faces)))) +(defonce initialize (init))