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