Skip to content

FileNotFoundError: [WinError 2] The system cannot find the file specified #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 59 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,64 @@
ocr-text-extraction
===================
## Requirements

I am not actively supporting this script. It was just an experiment.
`sudo apt-get install python-imaging`

Processes an image to extract the text portions. Primarily
used for pre-processing for performing OCR.
`sudo apt-get install tesseract-ocr`

Implemented in Python using OpenCV.
`sudo apt-get install python-opencv`

## Example

![Before processing](http://raw.githubusercontent.com/schollz/ocr-text-extraction/master/test.jpg)

1. First process the image

`python process_image.py test.jpg text.jpg`

![After processing](http://raw.githubusercontent.com/schollz/ocr-text-extraction/master/text.jpg)

2. Extract text

`python extract_text.py`

Output:

```bash
4 WkiJre €99 Bread

A good, basic white bread.

with

I. 21/2 cups lukewarm water
2 packages dry yeast
1/4 cup honey
1 cup dry mile
2 eggs, beaten
4 cups unbleached white flour

II. 4 teaspoons salt
1/3 cup butter or margarine
3 caps or inore unbleached white flour for forming the dough
1 cup (approx.) white flour for kneadian

Proceed with the directions for recipe #1, adding the beaten eggs afte
stirring in the dry milk.



is moister and chewier than the white e ;g bread.

r’/
'3. ' " er
ast
J
V -

```


### Acknowledgements

`process_image` implemented in Python using OpenCV by Jason Funk Copyright (c) 2012,based on the paper "Font and Background Color Independent Text Binarization" by T Kasar, J Kumar and A G Ramakrishnan http://www.m.cs.osakafu-u.ac.jp/cbdar2007/proceedings/papers/O1-1.pdf

Based on the paper "Font and Background Color Independent Text Binarization" by
T Kasar, J Kumar and A G Ramakrishnan
http://www.m.cs.osakafu-u.ac.jp/cbdar2007/proceedings/papers/O1-1.pdf

Copyright (c) 2012, Jason Funk <[email protected]>
3 changes: 3 additions & 0 deletions extract_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Image
import pytesseract
print pytesseract.image_to_string(Image.open('text.jpg'))
File renamed without changes.
Binary file added test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added text.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.