I'm working on a project in which I have to detect the qr code from live video stream and then capture it as an image. I'm scanning the qr code successfully but don't know how to detect it and capture that area as an Image?
Here's what I have tried:
<video id="preview"></video>
<script type="text/javascript">
let scanner = new Instascan.Scanner({video: document.getElementById('preview')});
scanner.addListener('scan', function (content) {
alert(content);
});
Instascan.Camera.getCameras().then(function (cameras) {
if (cameras.length > 0) {
scanner.start(cameras[0]);
} else {
console.error('No cameras found.');
}
}).catch(function (e) {
console.error(e);
});
</script>