Added stop detection method in ocr
This commit is contained in:
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user