Doc Scan is a Python-based project for image processing and computer vision tasks. It leverages OpenCV for image manipulation and FastAPI for providing a web-based API to process images.
It's not a production suited project but still... :D
-
Pre-Processing:
- Resizing, denoising, edge detection, HSV filtering, GrabCut segmentation, and morphological operations.
- Thresholding using Otsu's method.
-
Processing:
- Corner detection using Hough Line Transform and Contour-based methods.
- Perspective transformation for bird's-eye view extraction.
-
Post-Processing:
- Image enhancement, filtering, sharpening, and cleaning.
-
FastAPI Integration:
- Provides an API endpoint to process uploaded images and return results.
-
Clone the repository:
git clone https://github.com/AmirKafi/Doc-Scan.git cd OpenCV-Prac
-
Install dependencies:
pip install -r requirements.txt
-
Ensure you have Python 3.10 or higher installed.
-
Start the server:
uvicorn app:app --host 0.0.0.0 --port 8000
-
Access the API at
http://localhost:8000
. -
Use the
/process-image
endpoint to upload an image and process it.
- Endpoint:
/process-image
- Method: POST
- Request: Upload an image file.
- Response: Processed image as a downloadable file.
- Use the modules in the
pre_processors
,processors
, andPostProcessor
directories for specific image processing tasks.
OpenCV-Prac/
├── app.py # FastAPI application
├── requirements.txt # Python dependencies
├── vercel.json # Vercel deployment configuration
├── PostProcessor/ # Post-processing modules
├── pre_processors/ # Pre-processing modules
├── processors/ # Processing modules
├── static/ # Static files (e.g., favicon)
└── README.md # Project documentation
This project can be deployed on Vercel using the provided vercel.json
configuration.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request with a detailed description of your changes.
This project is licensed under the MIT License. See the LICENSE
file for details.
- OpenCV for the computer vision library.
- FastAPI for the web framework.
- scikit-learn for clustering algorithms.
For any questions or feedback, feel free to reach out to the project maintainer.