Hi Vitor,

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

https://github.com/arturaugusto/display_ocr

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 <[email protected]>:

> 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 [email protected].
> To post to this group, send email to [email protected].
> 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
> <https://groups.google.com/d/msgid/tesseract-ocr/6f41fa9c-ebb1-43e5-a4d0-a791aad8fceb%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> 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 [email protected].
To post to this group, send email to [email protected].
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/CAGP33S7B%3DR9CPS4DFHLvxCh98oCi-JX4QHX7bbOfNYNMqqd2cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to