1
0
forked from poc/pds

modified logic in camera capture for ocr

This commit is contained in:
dhanabalan
2025-11-14 10:07:02 +05:30
parent f39ac5ee2f
commit 6bd3ca61f7

View File

@@ -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() {