From 6bd3ca61f7803bd750748656cc9a89a7cada9296 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Fri, 14 Nov 2025 10:07:02 +0530 Subject: [PATCH] modified logic in camera capture for ocr --- resources/views/fields/camera-capture.blade.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/views/fields/camera-capture.blade.php b/resources/views/fields/camera-capture.blade.php index d63441e..51a9f26 100644 --- a/resources/views/fields/camera-capture.blade.php +++ b/resources/views/fields/camera-capture.blade.php @@ -996,18 +996,23 @@ function cameraCapture() { await new Promise(resolve => { this.$refs.video.onloadedmetadata = resolve; }); - - // ✅ Sync overlay canvas size with video size const video = this.$refs.video; const overlay = this.$refs.overlay; overlay.width = video.videoWidth; overlay.height = video.videoHeight; + + // Clear old green boxes + const ctx = overlay.getContext('2d'); + ctx.clearRect(0, 0, overlay.width, overlay.height); + + // Make overlay visible if hidden + overlay.classList.remove('hidden'); this.startDetection(); }, startDetection() { if (this.textDetectionInterval) clearInterval(this.textDetectionInterval); - this.textDetectionInterval = setInterval(() => this.detectText(), 700); + this.textDetectionInterval = setInterval(() => this.detectText(), 500); }, stopDetection() {