endorno / python-tesseract

Automatically exported from code.google.com/p/python-tesseract

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'module' object has no attribute 'SetCvImage'

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?

1. Installing python-tesseract-0.8-1.7_20130612_.macosx-10.8-x86_64 using the 
instructions from the wiki on an Mac OS X system that has opencv and tesseract 
(+ other dependencies) installed.

What is the expected output? What do you see instead?

Upon running a test file:

import cv2.cv as cv
import tesseract

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

image=cv.LoadImage("eurotext.jpg", cv.CV_LOAD_IMAGE_GRAYSCALE)
tesseract.SetCvImage(image)
text=api.GetUTF8Text()
conf=api.MeanTextConf()

The compiler produces an error indicating a missing method:
AttributeError: 'module' object has no attribute 'SetCvImage'

Therefore there's something wrong with the installation?

What version of the product are you using? On what operating system?

python-tesseract-0.8-1.7_20130612_.macosx-10.8-x86_64 on OS X 10.6.8 and Python 
2.7.5 with supposedly the correct dependencies installed.


Original issue reported on code.google.com by matti.v....@gmail.com on 29 Jun 2013 at 8:28

The line: tesseract.SetCvImage(image)
Should obviously be: tesseract.SetCvImage(image, api)

The problem persists though.

Original comment by matti.v....@gmail.com on 29 Jun 2013 at 8:50

How about installing the svn version?


svn checkout http://python-tesseract.googlecode.com/svn/trunk/ python-tesseract
cd python-tesseract
python setup.py clean
python setup.py build
python setup.py install --user
export PYTHONPATH="/usr/local/lib/python2.7/site-packages:$PYTHONPATH"
python test.py

Original comment by FreeT...@gmail.com on 30 Jun 2013 at 3:36

you might need to rebuild opencv first. It is broken lately

brew tap homebrew/science
brew install opencv

Original comment by FreeT...@gmail.com on 30 Jun 2013 at 4:29

Reinstalled everything starting from brewed Python 2.7.5 and proceeding to 
install all libraries. Upon installing python-tesseract from the svn source, 
the problem persists.

Original comment by matti.v....@gmail.com on 30 Jun 2013 at 7:38

Contents of python-tesseract module in my system:

Original comment by matti.v....@gmail.com on 30 Jun 2013 at 7:47

Attachments:

If your IOS is version 10.8.5, it shall work. 

Original comment by FreeT...@gmail.com on 10 Nov 2013 at 3:46

Original comment by FreeT...@gmail.com on 9 May 2014 at 7:52

  • Changed state: Fixed