Added logic in ocr for capture
This commit is contained in:
@@ -822,11 +822,11 @@ function cameraCapture() {
|
||||
// this.stopDetection();
|
||||
// },
|
||||
|
||||
async capturePhoto() {
|
||||
async capturePhoto() {
|
||||
const video = this.$refs.video;
|
||||
const canvas = this.$refs.canvas;
|
||||
const overlay = this.$refs.overlay;
|
||||
const snapshot = this.$refs.snapshot;
|
||||
const overlay = this.$refs.overlay;
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
canvas.width = video.videoWidth;
|
||||
@@ -837,17 +837,22 @@ function cameraCapture() {
|
||||
this.$refs.hiddenInput.value = snapshotData;
|
||||
this.capturedPhoto = snapshotData;
|
||||
|
||||
// ✅ Hide live video immediately → prevents black frame
|
||||
video.classList.add('hidden');
|
||||
overlay.classList.add('hidden');
|
||||
// ✅ Hide video and overlays immediately
|
||||
video.classList.add('hidden');
|
||||
overlay.classList.add('hidden');
|
||||
|
||||
// Stop camera stream after hide
|
||||
if (this.stream) this.stream.getTracks().forEach(track => track.stop());
|
||||
// ✅ Set snapshot image and display in same place
|
||||
snapshot.src = snapshotData;
|
||||
snapshot.classList.remove('hidden');
|
||||
|
||||
// ✅ Stop video stream (after hiding)
|
||||
if (this.stream) {
|
||||
this.stream.getTracks().forEach(track => track.stop());
|
||||
}
|
||||
|
||||
this.stopDetection();
|
||||
}
|
||||
|
||||
snapshot.src = snapshotData;
|
||||
snapshot.classList.remove('hidden');
|
||||
this.stopDetection();
|
||||
},
|
||||
|
||||
|
||||
async verifyPhoto() {
|
||||
|
||||
Reference in New Issue
Block a user