This module is a simple OpenCV module to scan documents.
npm install --save opencv-scanner
Import the OpenCV Script from : `https://docs.opencv.org/4.6.0/opencv.js`
detect({
detectElement // Element to be detected (Image or Canvas)
showContours = false, // Show contours on detected object
drawRectangle = false, // Draw rectangle on detected object
scanElement,// Canvas element to draw on0
resultElement, // Canvas element to draw the result
img: { height = 640, width = 480 },// resolution of the image
contourColor: { r = 255, g = 255, b = 255 }, // color of the contours
})
const {stop} = await detectVideo({
videoDisplayElement, // Element to display the video
showContours = false, // Show contours on detected object
drawRectangle = false, // Draw rectangle on detected object
scanElement, // Canvas element to draw on
resultElement, // Canvas element to draw the result
onDetect, // Callback function to be called when a document is detected
fps = 30, // Frames per second
img: { height = 640, width = 480 }, // resolution of the image
contourColor: { r = 255, g = 255, b = 255 }, // color of the contours
})