#!/usr/bin/env python
import os
import subprocess
from picamera.array import PiRGBArray
from time import *
from picamera import PiCamera
from datetime import datetime, timedelta
import cv2
try:
import Image
except ImportError:
from PIL import Image, ImageEnhance, ImageFilter
from pytesseract import *
#EXTRACT TEXT
print 'pytesser:'
#img = Image.open('/home/pi/camera/IMAGE-2017-05-04_141433.png')
img = Image.open('artikelbild-02.jpg')
im = img.convert('RGBA')
enhancer = ImageEnhance.Contrast(im)
im = enhancer.enhance(3)
im = im.convert('1')
im.save('temp2.jpg')
#use tesseract library to extract text from
text = pytesseract.image_to_string(Image.open('temp2.jpg'))
print "Text:"+text
#what the text contains
if "DHL" in text:
print 'DHL Lieferant'
elif "Post" in text:
print 'Postbote'
elif "GLS" in text:
....
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-ocr+unsubscribe@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/e97baa76-1ee5-49af-b824-766ab2ec0b03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-ocr+unsubscribe@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/7d6972ac-2467-48fc-9c7b-67a3fd6d9307%40googlegroups.com.
https://github.com/tesseract-ocr/tesseract/blob/master/doc/tesseract.1.asc#config-files-and-augmenting-with-user-data
/usr/share/tesseract-ocr/tessdata/eng.user-words: (contains DHL and other words the image contains)
/usr/share/tesseract-ocr/tessdata/eng.user-patterns: (contains only \n\*)I executed the command
/usr/share/tesseract-ocr/tessdata/configs/bazaar: (containing the same lines as described in the source)
Zdenko
On Fri, May 5, 2017 at 10:25 AM, anita josic <nini....@gmail.com> wrote:
Using
tesseract --tessdata-dir /usr/share/tesseract-ocr temp2.jpg -l eng -psm 20 text
in the terminal, I get the output
‘33:;
in text.txt. Well, that is at least something, but far away from what I intended to get.
Looking forward to answers.
Am Freitag, 5. Mai 2017 09:10:49 UTC+2 schrieb anita josic:
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
I read it now, but still don't know what I need to use. I already read a lot but I still don't know what part is missing. I am hoping for real feedback and help. I am not really coming forward trying stuff on my own as you can see.
Am Freitag, 5. Mai 2017 09:23:58 UTC+2 schrieb zdenop:
Zdenko
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-oc...@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/e97baa76-1ee5-49af-b824-766ab2ec0b03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tesseract-ocr+unsubscribe@googlegroups.com.
To post to this group, send email to tesser...@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/47b1ce8d-82f7-45e6-8680-b646e362e739%40googlegroups.com.
Zdenko