Added stop detection method in ocr

This commit is contained in:
dhanabalan
2025-10-27 09:35:14 +05:30
parent 14a39b30f8
commit f208252657

View File

@@ -774,6 +774,7 @@ function cameraCapture() {
} catch (err) { } catch (err) {
console.error("Camera error:", err); console.error("Camera error:", err);
alert("Camera error:\n" + (err.message || err)); alert("Camera error:\n" + (err.message || err));
this.stopDetection();
} }
}, },
@@ -796,6 +797,7 @@ function cameraCapture() {
this.capturedPhoto = snapshotData; // store for verification this.capturedPhoto = snapshotData; // store for verification
alert("Photo captured!"); alert("Photo captured!");
this.stopDetection();
}, },
async verifyPhoto() { async verifyPhoto() {
@@ -870,6 +872,14 @@ function cameraCapture() {
if (this.textDetectionInterval) clearInterval(this.textDetectionInterval); if (this.textDetectionInterval) clearInterval(this.textDetectionInterval);
this.textDetectionInterval = setInterval(() => this.detectText(), 1000); this.textDetectionInterval = setInterval(() => this.detectText(), 1000);
} }
stopDetection() {
if (this.textDetectionInterval) {
clearInterval(this.textDetectionInterval);
this.textDetectionInterval = null;
console.log("Text detection stopped");
}
}
} }
} }
</script> </script>