An experimental WebAssembly based document scanner. Just upload your document, app will handle the rest
The logic you are seeing here is built entirely using C; here is the source code this logic is compiled into WebAssembly and glued together via some vanilla JavaScript.
We begin by applying the Sobel edge detection algorithm to identify contours, which represent continuous edges in the image. These contours guide our image cropping process. Subsequently, we apply a threshold of 128 to achieve a digitized scanned appearance.