Ajout cercle progress

This commit is contained in:
telereview
2023-03-28 12:18:36 +02:00
parent ef2c3cdce4
commit 269402775d
6 changed files with 29 additions and 15 deletions

View File

@@ -103,8 +103,14 @@ class HandDetector():
else:
result = False
progress = 0
if thumbState == "thumbs_up":
progress = thumbsUpCount / (self.BUFFER_LENGTH * self.DETECTION_THRESHOLD)
elif thumbState == "thumbs_down":
progress = thumbsDownCount / (self.BUFFER_LENGTH * self.DETECTION_THRESHOLD)
if(thumbState != "neutre"):
return thumbState, handLandmarks[9], np.linalg.norm(np.array(handLandmarks[9]) - np.array(handLandmarks[0])), result
return thumbState, handLandmarks[9], np.linalg.norm(np.array(handLandmarks[9]) - np.array(handLandmarks[0])), result, progress
return False

View File

@@ -54,8 +54,8 @@ class Manager():
res = self.handDetector.detect()
if(res != False):
state, coords, size, finalDecision = res
self.server.sendMessage({"type": "effects", "effects": [{"type": state, "x":coords[0], "y": coords[1], "width": size, "height": size}]})
state, coords, size, finalDecision, progress = res
self.server.sendMessage({"type": "effects", "effects": [{"type": "loading", "x":coords[0], "y": coords[1], "width": size, "height": size, "progress": progress},{"type": state, "x":coords[0], "y": coords[1], "width": size, "height": size}]})
self.isLastHandPacketEmpty = False
self.timeLastChange = time.time()
if(finalDecision != False):

View File

@@ -5,4 +5,5 @@ mediapipe
numpy
pyaudio
librosa
scipy
scipy
python-dotenv

View File

@@ -1,9 +0,0 @@
[Unit]
Description=Téléreview scripts
[Service]
Type=oneshot
ExecStart=/home/telereview/pact71/code/setup.sh
[Install]
WantedBy=multi-user.target

View File

@@ -127,7 +127,7 @@ class CameraPage {
this.ctx.strokeStyle = this.spinnerColor;
this.ctx.beginPath();
this.ctx.arc(x, y, radius, 0, progress * 2 * Math.PI);
this.ctx.arc(x + radius / 2, y + radius / 2, radius, 0, progress * 2 * Math.PI);
this.ctx.stroke();
}
@@ -150,4 +150,4 @@ class CameraPage {
reset() {
this.activeEffects = [];
}
}
}

View File

@@ -1,2 +1,18 @@
#!/bin/sh
sudo modprobe v4l2loopback devices=2
docker compose up -d
cd backend_reconnaissance
nohup python3 main.py &
sleep 10
export DISPLAY=:0
firefox http://localhost:8888 -kiosk
sleep 10
xdotool mousemove 389 169
sleep 0.1
xdotool click 1
xdotool mousemove 411 256
sleep 0.1
xdotool click 1
xdotool mousemove 614 256
sleep 0.1
xdotool click 1