<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>dDPY4VPϋR+ Demo</title> <style> body { text-align: center; font-family: Arial, sans-serif; } #video { width: 90%; max-width: 400px; border: 1px solid #ccc; } #canvas { width: 90%; max-width: 400px; border: 1px solid #ccc; margin-top: 10px; } #output { margin-top: 15px; font-size: 18px; color: green; } </style> </head> <body> <h2>dDPY4VPϋR+ Demo</h2> <video id="video" autoplay playsinline></video> <br> <button onclick="captureImage()">= cUcIVP</button> <button onclick="startRecognition()">= _YˋR+</button> <br> <canvas id="canvas"></canvas> <div id="output"></div> <script> let video = document.getElementById("video"); let canvas = document.getElementById("canvas"); let ctx = canvas.getContext("2d"); // bS_dDPY4 async function startCamera() { try { const stream = await navigator.mediaDevices.getUserMedia({ video: true }); video.srcObject = stream; } catch (err) { alert("dDPY4Y1%: " + err); } } // cUcI_SRM^' function captureImage() { canvas.width = video.videoWidth; canvas.height = video.videoHeight; ctx.drawImage(video, 0, 0, canvas.width, canvas.height); document.getElementById("output").innerText = "]cUcIN^' '"; } // {SUR+;oy:u( function startRecognition() { if (canvas.width === 0) { alert("QHcUcIVP"); return; } // PGR+R0NNN*S:W let x = Math.floor(Math.random() * canvas.width); let y = Math.floor(Math.random() * canvas.height); document.getElementById("output").innerText = `R+bR ! WPh: (${x}, ${y})`; // W(u;^N u;N*p ctx.fillStyle = "red"; ctx.beginPath(); ctx.arc(x, y, 5, 0, 2 * Math.PI); ctx.fill(); } startCamera(); </script> </body> </html>