Skip to content

Commit 8689592

Browse files
authored
Merge pull request #401 from Yaswanth820/master
Added extract_text_from_image script
2 parents dd413cc + 76f9d71 commit 8689592

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Extract text from image
2+
3+
This script extracts text from an image using the EasyOCR library.
4+
It can support multiple languages.
5+
6+
## Usage
7+
8+
1. Create a virtual environment
9+
2. Install the requirements - `pip install -r requirements.txt`
10+
3. Run the script - `python main.py`
11+
12+
## Output
13+
14+
Output will be printed to console.
15+
16+
Happy coding!!
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import easyocr
2+
3+
gpu = False # if you want to use GPU, set gpu=True
4+
languages = ['en'] # refer https://www.jaided.ai/easyocr/ for supporting languages
5+
6+
reader = easyocr.Reader(languages, gpu=gpu)
7+
8+
IMG_PATH = 'test1.png'
9+
result = reader.readtext(IMG_PATH)
10+
11+
text = ''
12+
for tup in result:
13+
text += tup[1]
14+
15+
print(text)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
easyocr==1.6.2
107 KB
Loading

0 commit comments

Comments
 (0)