Re: [tesseract-ocr] WebCam Text Recognition

445 views
Skip to first unread message

Artur Augusto

unread,
Mar 20, 2015, 7:40:33 AM3/20/15
to tesser...@googlegroups.com
Hi Vitor,

Did not had time to test your code, but I have a sample app that does exactly what you want:


it's intended to recognise numbers using a 7 segments font traineddata, but you can use other trained data and change the whitelist chars.



Artur

2015-03-18 15:28 GMT-03:00 Vitor Guimarães <vitorgui...@gmail.com>:
Hi guys, I'm trying to do tesseract recognize text from webcam. This is my code, but these errors are occurring:

Error in pixGetDepth: pix not defined
Error in pixGetWpl: pix not defined
Error in pixGetYRes: pix not defined
Please call SetImage before attempting recognition.

~Please, sorry my bad english



import cv2
import tesseract

api = tesseract.TessBaseAPI()
api.Init(".", "eng", tesseract.OEM_DEFAULT)

while(True):
    ret, frame = cv2.VideoCapture(0).read()
   
    api.SetImage(tesseract.pixRead("gray"))
    print("OCR output:\n%s" %api.GetUTF8Text());           
   
    cv2.imshow('Frame', frame)                                        
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

api.End()
cv2.VideoCapture(0).release()                                       
cv2.destroyAllWindows()    


--
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 http://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit https://groups.google.com/d/msgid/tesseract-ocr/6f41fa9c-ebb1-43e5-a4d0-a791aad8fceb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages