dsoprea / TightOCR

A slim, non-SWIG Python adapter to CTesseract (Tesseract OCR for C).
24 stars 4 forks source link

SetCvImage #2

Open andatt opened 10 years ago

andatt commented 10 years ago

Hi Dustin

There is a function within Python Tesseract (SetCvImage) that allows the passing of an image from opencv directly to Tesseract. Useage is:

api = tesseract.TessBaseAPI() tesseract.SetCvImage(image,api)

Is this available within TightOCR and if not is it implementable?

The reason in my case is that I need to process the image before passing to Tesseract as the quality is low.

Thanks again

Andrew

dsoprea commented 10 years ago

On Sat, Apr 26, 2014 at 8:27 AM, andatt notifications@github.com wrote:

Hi Dustin

There is a function within Python Tesseract (SetCvImage) that allows the passing of an image from opencv directly to Tesseract. Useage is:

api = tesseract.TessBaseAPI() tesseract.SetCvImage(image,api)

Is this available within TightOCR and if not is it implementable?

The reason in my case is that I need to process the image before passing to Tesseract as the quality is low.

Thanks again

Andrew

— Reply to this email directly or view it on GitHubhttps://github.com/dsoprea/TightOCR/issues/2 .

I've confirmed that the SetCvImage function exists and works using python-tesseract. However, the function that it's calling (SetCvImage from the SWiG) doesn't seem to exist in tesseract's C++ sourcecode, or as a symbol in the dynamic library.

I sent an email to the developer to see if he can shed some light.

dsoprea commented 10 years ago

I haven't yet received a response. I posted an issue: https://code.google.com/p/tesseract-ocr/issues/detail?id=1148

Dustin

On Sat, Apr 26, 2014 at 1:52 PM, Dustin Oprea myselfasunder@gmail.comwrote:

On Sat, Apr 26, 2014 at 8:27 AM, andatt notifications@github.com wrote:

Hi Dustin

There is a function within Python Tesseract (SetCvImage) that allows the passing of an image from opencv directly to Tesseract. Useage is:

api = tesseract.TessBaseAPI() tesseract.SetCvImage(image,api)

Is this available within TightOCR and if not is it implementable?

The reason in my case is that I need to process the image before passing to Tesseract as the quality is low.

Thanks again

Andrew

— Reply to this email directly or view it on GitHubhttps://github.com/dsoprea/TightOCR/issues/2 .

I've confirmed that the SetCvImage function exists and works using python-tesseract. However, the function that it's calling (SetCvImage from the SWiG) doesn't seem to exist in tesseract's C++ sourcecode, or as a symbol in the dynamic library.

I sent an email to the developer to see if he can shed some light.

andatt commented 10 years ago

Many Thanks! If it's not possible I might have to take a look at Leptonica for processing, I don't want to though as the PyLeptonica binding looks to be inactive.

I also tried PIL with PyTesser binding but PIL just doesn't seem to have the range of image processing options of opencv.

andatt commented 10 years ago

I found this SetOpenCV thread on the Python-Tesseract group, it looks like someone outside the project submitted this as an enhancement/patch:

https://code.google.com/p/python-tesseract/issues/detail?id=8

https://code.google.com/p/python-tesseract/source/browse/python-tesseract-0.7.4/SetCVImage.patch