Text page dewarping using a "cubic sheet" model

Overview
Comments
  • How to generate the

    How to generate the "page_warping.gif" ?

    Hi Matt, I'm wondering if you could share the code snippet for generating the animation? Thanks for your attention. I’m looking forward to your reply.

    opened by huntzhan 2
  • ValueError: need more than 2 values to unpack

    ValueError: need more than 2 values to unpack

    Hello, I have ran the code as mention in comments using python page_dewarp.py Img. Following error occurred after running the code.

    python page_dewarp.py IMG_20190717_114448.jpg loaded IMG_20190717_114448.jpg with size 2250x4000 and resized to 375x667 Traceback (most recent call last): File "page_dewarp.py", line 915, in main() File "page_dewarp.py", line 867, in main cinfo_list = get_contours(name, small, pagemask, 'text') File "page_dewarp.py", line 450, in get_contours cv2.CHAIN_APPROX_NONE) ValueError: need more than 2 values to unpack

    opened by rupeshchandgude 2
  • syntax error line 739

    syntax error line 739

    I'm trying to run the script but it gives me an "invalid syntax" error at line 739 print ' initial objective is', objective(params).

    I'm using Python 3.5 (I installed WinPython with scipy, numpy and pillow) and OpenCV 3.2, which I installed following the instructions found here: https://pythonarena.wordpress.com/2016/03/07/scientific-python-on-windows/

    opened by Alessio-R 1
  • Improved README - Add Arch Linux AUR package

    Improved README - Add Arch Linux AUR package

    Hello,

    README and AUR package for this one.

    Awesome software! I hope my application to CMU RI gets accepted. I am impressed by these programs.

    Thanks for sharing!

    opened by fcladera 1
  • Omission of `from PIL` for `import Image` means page_dewarp doesn't work under Pillow

    Omission of `from PIL` for `import Image` means page_dewarp doesn't work under Pillow

    At https://github.com/mzucker/page_dewarp/blob/master/page_dewarp.py#L16 you see import Image.

    Pillow doesn't expose a top level Image class in sys.modules -- it is only available under the PIL module.

    Changing the line to from PIL import Image from import Image should be backwards compatible with both PIL and Pillow.

    opened by autumnjolitz 1
  • No module named cv2 / add requirements.txt file?

    No module named cv2 / add requirements.txt file?

    Very nice project. However, I just can't make it work because of missing cv2 requirement (and possibly others):

    Traceback (most recent call last):
      File "../page_dewarp.py", line 15, in <module>
        import cv2
    ImportError: No module named cv2
    

    Perhaps you could add a requirements.txt file to your repo?

    opened by aurelg 1
  • dewarp deviate from orbit location

    dewarp deviate from orbit location

    Thanks for great work @mzucker , I try to dewarp line in page, I think algorithm work well, but output of dewarp not in the same location. I wish to dewarp the same position output. How to config it. Thanks in advance image left is keypoint detection and optimization, right is output dewarp(but location change)

    opened by phamkhactu 0
  • Script not compatible with python 3

    Script not compatible with python 3

    I have attached the script makes page_dewarp.py compatible with python 3 for anyone looking for this, like I was.

    page_dewarp.txt

    Just save as .py and it should work!

    opened by danepeterpadley 0
  • cannot install

    cannot install

    Thank you for building this software but I cannot figure out how to install it. 99% of the time software comes with pip install instructions, for that 1% of the time when the software does not I have a very difficult time getting it to work.

    opened by kylefoley76 1
  • Updates and fixes, working in Python 3.10

    Updates and fixes, working in Python 3.10

    This PR includes changes from other forks.

    Changes introduced by tachylatus fork:

    • Rework requirements.txt
    • Fix indentation error
    • Support both 2-tuple and 3-tuple output from cv2.findContours

    Tested and working in Python 3.10.0.

    Setup:

    python -m venv venv310
    pip install -r requirements.txt
    python page_dewarp.py ./example_input/boston_cooking_a.jpg
    
    opened by tachylatus 1
  • Python3 issues

    Python3 issues

    First all print statements need to be converted from print "" to print()

    floating point errors here: 561 wrap values in int() due to floating point error 795 int(width...) 796 int(height....)


    general errors which need handling

    some text is white washed away

    DSC05331 z

    Traceback (most recent call last): File "page_dewarp.py", line 915, in main() File "page_dewarp.py", line 868, in main cinfo_list = get_contours(name, small, pagemask, 'text') File "page_dewarp.py", line 470, in get_contours contours_out.append(ContourInfo(contour, rect, tight_mask)) File "page_dewarp.py", line 376, in init self.center, self.tangent = blob_mean_and_tangent(contour) File "page_dewarp.py", line 352, in blob_mean_and_tangent mean_x = moments['m10'] / area ZeroDivisionError: float division by zero

    apparently area can be 0 so we need to protect against this

    If area==0: area=1

    Resizing the image resulted in problems for me, so I nulled it out with img=src

    opened by cybernard 1
  • Small updates for Python 3.9 (and OpenCV 4.5) compatibility

    Small updates for Python 3.9 (and OpenCV 4.5) compatibility

    Hi Matt, I found your blog post very interesting and this script very useful. Thanks! Since I left Python 2.x behind years ago, I check if this can be easily made to work with Python 3.x, and yes it can.

    So here are my changes that made your scripts work with Python 3.9.1 and current versions of the relevant modules:

    • cv2==4.5.1
    • matplotlib==3.3.3
    • numpy==1.19.4
    • PIL=8.0.1
    • scipy==1.5.4
    • sympy==1.7.1

    I'd be happy to see this PR incorporated into your version.

    -- Christian

    opened by cweickhmann 0
  • Python 3

    Python 3

    I tried to run this, but python 2 is deprecated, cv2 is not in pip anymore, there is opencv-python, but when I installed that and other dependences, I get errors...

    ╰─➤  page_dewarp.py example_input/boston_cooking_a.jpg
    loaded boston_cooking_a.jpg with size 2448x3264 and resized to 490x653
    Traceback (most recent call last):
      File "page_dewarp.py", line 1001, in <module>
        main()
      File "page_dewarp.py", line 954, in main
        cinfo_list = get_contours(name, small, pagemask, "text")
      File "page_dewarp.py", line 489, in get_contours
        mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE
    ValueError: need more than 2 values to unpack
    
    opened by reagle 2
Page to PAGE Layout Analysis Tool

P2PaLA Page to PAGE Layout Analysis (P2PaLA) is a toolkit for Document Layout Analysis based on Neural Networks. ?? Try our new DEMO for online baseli

Lorenzo Quirós Díaz 180 Nov 24, 2022
PAGE XML format collection for document image page content and more

PAGE-XML PAGE XML format collection for document image page content and more For an introduction, please see the following publication: http://www.pri

PRImA Research Lab 46 Nov 14, 2022
ocroseg - This is a deep learning model for page layout analysis / segmentation.

ocroseg This is a deep learning model for page layout analysis / segmentation. There are many different ways in which you can train and run it, but by

NVIDIA Research Projects 71 Dec 6, 2022
a deep learning model for page layout analysis / segmentation.

OCR Segmentation a deep learning model for page layout analysis / segmentation. dependencies tensorflow1.8 python3 dataset: uw3-framed-lines-degraded-

null 99 Dec 12, 2022
This repository lets you train neural networks models for performing end-to-end full-page handwriting recognition using the Apache MXNet deep learning frameworks on the IAM Dataset.

Handwritten Text Recognition (OCR) with MXNet Gluon These notebooks have been created by Jonathan Chung, as part of his internship as Applied Scientis

Amazon Web Services - Labs 422 Jan 3, 2023
text detection mainly based on ctpn model in tensorflow, id card detect, connectionist text proposal network

text-detection-ctpn Scene text detection based on ctpn (connectionist text proposal network). It is implemented in tensorflow. The origin paper can be

Shaohui Ruan 3.3k Dec 30, 2022
Handwritten Text Recognition (HTR) system implemented with TensorFlow (TF) and trained on the IAM off-line HTR dataset. This Neural Network (NN) model recognizes the text contained in the images of segmented words.

Handwritten-Text-Recognition Handwritten Text Recognition (HTR) system implemented with TensorFlow (TF) and trained on the IAM off-line HTR dataset. T

null 27 Jan 8, 2023
Deep learning based page layout analysis

Deep Learning Based Page Layout Analyze This is a Python implementaion of page layout analyze tool. The goal of page layout analyze is to segment page

null 186 Dec 29, 2022
OCR-D-compliant page segmentation

ocrd_segment This repository aims to provide a number of OCR-D-compliant processors for layout analysis and evaluation. Installation In your virtual e

OCR-D 59 Sep 10, 2022
Simple app for visual editing of Page XML files

Name nw-page-editor - Simple app for visual editing of Page XML files. Version: 2021.02.22 Description nw-page-editor is an application for viewing/ed

Mauricio Villegas 27 Jun 20, 2022
Validate and transform various OCR file formats (hOCR, ALTO, PAGE, FineReader)

ocr-fileformat Validate and transform between OCR file formats (hOCR, ALTO, PAGE, FineReader) Installation Docker System-wide Usage CLI GUI API Transf

Universitätsbibliothek Mannheim 152 Dec 20, 2022
~1000 book pages + OpenCV + python = page regions identified as paragraphs, lines, images, captions, etc.

cosc428-structor I had an open-ended Computer Vision assignment to complete, and an out-of-copyright book that I wanted to turn into an ebook. Convent

Chad Oliver 45 Dec 6, 2022
Deskew is a command line tool for deskewing scanned text documents. It uses Hough transform to detect "text lines" in the image. As an output, you get an image rotated so that the lines are horizontal.

Deskew by Marek Mauder https://galfar.vevb.net/deskew https://github.com/galfar/deskew v1.30 2019-06-07 Overview Deskew is a command line tool for des

Marek Mauder 127 Dec 3, 2022
An Implementation of the alogrithm in paper IncepText: A New Inception-Text Module with Deformable PSROI Pooling for Multi-Oriented Scene Text Detection

InceptText-Tensorflow An Implementation of the alogrithm in paper IncepText: A New Inception-Text Module with Deformable PSROI Pooling for Multi-Orien

GeorgeJoe 115 Dec 12, 2022
Code for the paper STN-OCR: A single Neural Network for Text Detection and Text Recognition

STN-OCR: A single Neural Network for Text Detection and Text Recognition This repository contains the code for the paper: STN-OCR: A single Neural Net

Christian Bartz 496 Jan 5, 2023
keras复现场景文本检测网络CPTN: 《Detecting Text in Natural Image with Connectionist Text Proposal Network》;欢迎试用,关注,并反馈问题...

keras-ctpn [TOC] 说明 预测 训练 例子 4.1 ICDAR2015 4.1.1 带侧边细化 4.1.2 不带带侧边细化 4.1.3 做数据增广-水平翻转 4.2 ICDAR2017 4.3 其它数据集 toDoList 总结 说明 本工程是keras实现的CPTN: Detecti

mick.yi 107 Jan 9, 2023
Detecting Text in Natural Image with Connectionist Text Proposal Network (ECCV'16)

Detecting Text in Natural Image with Connectionist Text Proposal Network The codes are used for implementing CTPN for scene text detection, described

Tian Zhi 1.3k Dec 22, 2022
huoyijie 1.2k Dec 29, 2022