https://github.com/sangamprashant/document-scanner
The Document Scanner is a Python project that automates the process of enhancing poorly scanned documents. It detects document corners, applies perspective transformation, sharpens the image, and enhances readability using OpenCV.
https://github.com/sangamprashant/document-scanner
document-scanner documet opencv python scan scanner
Last synced: 8 months ago
JSON representation
The Document Scanner is a Python project that automates the process of enhancing poorly scanned documents. It detects document corners, applies perspective transformation, sharpens the image, and enhances readability using OpenCV.
- Host: GitHub
- URL: https://github.com/sangamprashant/document-scanner
- Owner: sangamprashant
- Created: 2024-03-09T19:36:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-10T12:36:51.000Z (over 1 year ago)
- Last Synced: 2025-01-16T04:43:23.215Z (10 months ago)
- Topics: document-scanner, documet, opencv, python, scan, scanner
- Language: Python
- Homepage:
- Size: 5.19 MB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Document Scanner
### An interactive document scanner built in Python using OpenCV
The scanner takes a poorly scanned image, finds the corners of the document, applies the perspective transformation to get a top-down view of the document, sharpens the image, and applies an adaptive color threshold to clean up the image.
#### Here are some examples of images before and after scan:

## Usage
### clone the project
```
git clone https://github.com/sangamprashant/Document-Scanner.git
```
### Without input
```
python scan.py (--images | --image ) [-i]
```
- The `-i` flag enables interactive mode, where you will be prompted to click and drag the corners of the document. For example, to scan a single image with interactive mode enabled:`python scan.py --image uploads/sam.jpg -i`

- Alternatively, to scan all images in a directory without any input:
`python scan.py --image uploads/sam.jpg`
check the output folder.
### With Inputs
Create a virtual environment:
`python -m venv `
Activate the virtual environment:
```
cd /Scripts
.\activate
cd ../..
```
Install the requirements:
```
pip install -r requirements.txt
```
Run the server :
```
python main.py
```
- Open index.html in a browser and ensure that the path to the server is correct.
- Select the image to upload and see the magic happen.

# Links
* [live link](https://sangamprashant.github.io/Document-Scanner/)
- output [server link](https://document-scanner-5nnp.onrender.com/) + response.data.result_path
- imput [server link](https://document-scanner-5nnp.onrender.com/scan)
