An open API service indexing awesome lists of open source software.

https://github.com/opusaha/scraper-v2


https://github.com/opusaha/scraper-v2

Last synced: 6 months ago
JSON representation

Awesome Lists containing this project

README

          

# Frame Detection Script

This script detects the frame/border from scanned document images using OpenCV.

## Setup

1. Install the required dependencies:
```bash
pip install -r requirements.txt
```

## Usage

1. Make sure your image file `CamScanner 27-9-25 12.32_1.jpg` is in the same directory as the script.

2. Run the script:
```bash
python frame_detector.py
```

## Output

The script will generate two images:

1. **detected_frame.jpg** - The main result showing the detected frame boundaries highlighted in green
2. **frame_detection_comparison.jpg** - A 2x2 comparison showing:
- Original image
- Result with detected frame
- Edge detection output
- Binary threshold output

## How it works

1. **Image Preprocessing**: Converts to grayscale and applies Gaussian blur
2. **Edge Detection**: Uses Canny edge detection to find boundaries
3. **Contour Detection**: Finds contours and filters by area
4. **Frame Identification**: Looks for large rectangular contours that could be the frame
5. **Visualization**: Draws the detected frame boundaries and saves results

The script is designed to work with scanned documents and will highlight the detected frame boundaries so you can easily see what was detected.