Skip to content

Latest commit

 

History

History
52 lines (41 loc) · 1.45 KB

README.md

File metadata and controls

52 lines (41 loc) · 1.45 KB

Document Scanner 📑

U-Net Like Pretrained Model For Scene Document Detection (pytorch, Semantic Segmentation)

Quick Links

Dependencies

  • Install Dependencies $ pip install -r requirements.txt
  • Download model weights Here, place it in Structure/

Usage:

  scanner = Scanner("Structure/Scanner-Detector.pth", config_)

Load model.

  org = cv2.imread(fname)
  org_gray = cv2.cvtColor(org, cv2.COLOR_RGB2GRAY)
  org_resize = cv2.resize(org_gray, (256, 256), interpolation = cv2.INTER_AREA)

Read image in gray scale and resize it to 256*256.

  mask = scanner.ScanView(org_resize)

Detect document area.

  paper, approx = ExtractPaper(org_gray, mask)
  org = DrawBox(org, approx)

Extract document and draw bounding box on original image.

  paper = EnhacePaper(paper)

Enhance extracted document.

Examples

🛡️ License

Project is distributed under MIT License