codrizsain commited on
Commit
9ecd20e
·
verified ·
1 Parent(s): 65cccd7

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +16 -43
index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>AI Vision - Rizki Ardiansyah</title>
7
 
8
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
9
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/drawing_utils/drawing_utils.js" crossorigin="anonymous"></script>
@@ -109,7 +109,7 @@
109
  <body>
110
 
111
  <h2>🤖 AI Vision: Smooth Tracking</h2>
112
- <p>Algoritma Debounce untuk Audio & Visual v19 - Rizki Ardiansyah</p>
113
 
114
  <button id="startBtn">▶ Mulai Sistem Deteksi</button>
115
 
@@ -194,49 +194,22 @@
194
  return { moodText, moodColor, genderText, genderColor };
195
  }
196
 
197
- function analyzeFaceBiometrics(faceLandmarks) {
198
- // 1. Analisis Mood
199
- const leftMouth = faceLandmarks[61]; const rightMouth = faceLandmarks[291];
200
- const topLip = faceLandmarks[13]; const bottomLip = faceLandmarks[14];
201
- const leftEye = faceLandmarks[33]; const rightEye = faceLandmarks[263];
202
-
203
- const mouthWidth = getDistance(leftMouth, rightMouth);
204
- const mouthHeight = getDistance(topLip, bottomLip);
205
- const faceScale = getDistance(leftEye, rightEye);
206
-
207
- const smileRatio = mouthWidth / faceScale;
208
- const openRatio = mouthHeight / faceScale;
209
-
210
- let moodText = "Netral 😐"; let moodColor = "#3b82f6";
211
- if (openRatio > 0.15) { moodText = "Terkejut 😲"; moodColor = "#a855f7"; }
212
- else if (smileRatio > 0.52) { moodText = "Senang 😊"; moodColor = "#10b981"; }
213
-
214
- // 2. Analisis Estimasi Gender
215
- const leftCheek = faceLandmarks[234]; const rightCheek = faceLandmarks[454];
216
- const leftJaw = faceLandmarks[132]; const rightJaw = faceLandmarks[361];
217
-
218
- const cheekWidth = getDistance(leftCheek, rightCheek);
219
- const jawWidth = getDistance(leftJaw, rightJaw);
220
- const jawToCheekRatio = jawWidth / cheekWidth;
221
-
222
- // FITUR DEBUGGING: Menampilkan angka rasio di teks agar kamu bisa melihatnya
223
- // Fungsi .toFixed(3) digunakan untuk mengambil 3 angka di belakang koma
224
- let angkaRasio = jawToCheekRatio.toFixed(3);
225
 
226
- let genderText = ""; let genderColor = "";
 
227
 
228
- // ========================================================
229
- // UBAH ANGKA 0.820 DI BAWAH INI UNTUK MENYESUAIKAN AKURASI
230
- // ========================================================
231
- if (jawToCheekRatio > 0.820) {
232
- genderText = `Pria 👨 (${angkaRasio})`;
233
- genderColor = "#60a5fa";
234
- } else {
235
- genderText = `Wanita 👩 (${angkaRasio})`;
236
- genderColor = "#f472b6";
237
- }
238
-
239
- return { moodText, moodColor, genderText, genderColor };
240
  }
241
 
242
  const faceMesh = new FaceMesh({locateFile: (file) => { return `https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh/${file}`; }});
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>AI Vision - v19 Smooth Performance</title>
7
 
8
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
9
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/drawing_utils/drawing_utils.js" crossorigin="anonymous"></script>
 
109
  <body>
110
 
111
  <h2>🤖 AI Vision: Smooth Tracking</h2>
112
+ <p>Algoritma Debounce untuk Audio & Visual v19</p>
113
 
114
  <button id="startBtn">▶ Mulai Sistem Deteksi</button>
115
 
 
194
  return { moodText, moodColor, genderText, genderColor };
195
  }
196
 
197
+ function classifyPose(landmarks) {
198
+ const indexOpen = landmarks[8].y < landmarks[6].y;
199
+ const middleOpen = landmarks[12].y < landmarks[10].y;
200
+ const ringOpen = landmarks[16].y < landmarks[14].y;
201
+ const pinkyOpen = landmarks[20].y < landmarks[18].y;
202
+ const thumbOpen = getDistance(landmarks[4], landmarks[5]) > 0.08;
203
+
204
+ if (!indexOpen && !middleOpen && !ringOpen && !pinkyOpen) return { id: 5, name: "✊ Kepalan", color: "#ef4444" };
205
+ if (indexOpen && middleOpen && ringOpen && pinkyOpen && thumbOpen) return { id: 4, name: "🖐️ Telapak", color: "#3b82f6" };
206
+ if (indexOpen && middleOpen && !ringOpen && !pinkyOpen) return { id: 2, name: "✌️ Victory", color: "#a855f7" };
207
+ if (thumbOpen && indexOpen && !middleOpen && !ringOpen && !pinkyOpen) return { id: 1, name: "👉 Tunjuk & Jempol", color: "#eab308" };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
+ const thumbIndexTipDist = getDistance(landmarks[4], landmarks[8]);
210
+ if (thumbIndexTipDist < 0.05 && middleOpen && ringOpen && pinkyOpen) return { id: 3, name: "👌 Okay", color: "#10b981" };
211
 
212
+ return null;
 
 
 
 
 
 
 
 
 
 
 
213
  }
214
 
215
  const faceMesh = new FaceMesh({locateFile: (file) => { return `https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh/${file}`; }});