modified logic in camera capture for ocr
This commit is contained in:
@@ -996,18 +996,23 @@ function cameraCapture() {
|
|||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
this.$refs.video.onloadedmetadata = resolve;
|
this.$refs.video.onloadedmetadata = resolve;
|
||||||
});
|
});
|
||||||
|
|
||||||
// ✅ Sync overlay canvas size with video size
|
|
||||||
const video = this.$refs.video;
|
const video = this.$refs.video;
|
||||||
const overlay = this.$refs.overlay;
|
const overlay = this.$refs.overlay;
|
||||||
overlay.width = video.videoWidth;
|
overlay.width = video.videoWidth;
|
||||||
overlay.height = video.videoHeight;
|
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();
|
this.startDetection();
|
||||||
},
|
},
|
||||||
|
|
||||||
startDetection() {
|
startDetection() {
|
||||||
if (this.textDetectionInterval) clearInterval(this.textDetectionInterval);
|
if (this.textDetectionInterval) clearInterval(this.textDetectionInterval);
|
||||||
this.textDetectionInterval = setInterval(() => this.detectText(), 700);
|
this.textDetectionInterval = setInterval(() => this.detectText(), 500);
|
||||||
},
|
},
|
||||||
|
|
||||||
stopDetection() {
|
stopDetection() {
|
||||||
|
|||||||
Reference in New Issue
Block a user