(canvasId)
| 1 | // 科技感视觉识别系统 |
| 2 | class VisionSystem { |
| 3 | constructor(canvasId) { |
| 4 | this.canvas = document.getElementById(canvasId); |
| 5 | this.ctx = this.canvas.getContext('2d'); |
| 6 | this.overlay = document.createElement('div'); |
| 7 | this.overlay.className = 'vision-overlay'; |
| 8 | this.canvas.parentElement.appendChild(this.overlay); |
| 9 | |
| 10 | // 状态 |
| 11 | this.mode = 'SEGMENT'; |
| 12 | this.fps = 0; |
| 13 | this.detectedObjects = []; |
| 14 | this.handData = null; |
| 15 | this.trackingData = null; |
| 16 | |
| 17 | // 初始化UI元素 |
| 18 | this.initUI(); |
| 19 | |
| 20 | // 连接WebSocket |
| 21 | this.connectVisionWS(); |
| 22 | } |
| 23 | |
| 24 | initUI() { |
| 25 | // 状态指示器 |
nothing calls this directly
no test coverage detected