Community
cancel
Showing results for 
Search instead for 
Did you mean: 
idata
Community Manager
1,220 Views

How to install tesseract-ocr on intel edison

I have to install tesseract-OCR on Intel Edison mini-breakout.

I have followed these steps.

opkg install tesseract

installed properly

opkg install python-setup tools

root@RamishaEdison:/Intel# opkg install python-setup tools

Unknown package 'python-setup'.

Unknown package 'tools'.

Collected errors:

* opkg_install_cmd: Cannot install package python-setup.

* opkg_install_cmd: Cannot install package tools.

opkg install tesseract-ocr

root@RamishaEdison:/Intel# opkg install tesseract-ocr

Unknown package 'tesseract-ocr'.

Collected errors:

* opkg_install_cmd: Cannot install package tesseract-ocr.

I tried running this python program on Intel Edison

import cv2

import cv2.cv as cv

import tesseract

import numpy as np

import pyttsx

import pytesseract

scr = cv2.imread('/Intel/godisgreat.jpg',0)

# cv2.imshow('loaded image', scr)

api = tesseract.TessBaseAPI()

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

api.SetPageSegMode(tesseract.PSM_AUTO)

image = cv.CreateImageHeader((scr.shape[1],scr.shape[0]), cv.IPL_DEPTH_8U, 1)

cv.SetData(image, scr.tostring(), scr.dtype.itemsize*scr.shape[1])

tesseract.SetCvImage(image,api)

tex=api.GetUTF8Text()

conf=api.MeanTextConf()

g=open('god.txt' , 'w')

g.write(tex)

g.close()

g = open("god.txt")

thegod=g.read()

with open("god.txt", "r") as f:

for line in f:

cleanedLine = line.strip()

if cleanedLine: # is not empty

print(cleanedLine)

cv2.waitKey(0)

cv2.destroyAllWindows()

Getting error is

root@RamishaEdison:/Intel# python memsimage.py

Traceback (most recent call last):

File "memsimage.py", line 9, in

api = tesseract.TessBaseAPI()

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

I don't how to solve this

But this same program running well on windows python shell.

Tags (1)
0 Kudos
4 Replies
idata
Community Manager
173 Views

Hello Ramisha93,

 

 

Thanks for reaching out!

 

 

The error means that you haven't installed the libraries that the code requires to run. The opkg outputs that you receive say that the packages you are trying to install do not exist on the repo.

 

 

I tried to install the required packages, these are the steps I took:

 

 

pip install --upgrade pip

 

pip install pytesseract

 

pip install opencv-python

 

pip install pyttsx

 

opkg install tesseract tesseract-dbg tesseract-dev tesseract-doc

 

pip install tesseract-ocr

 

 

I was able to get rid of some errors but the following stayed:

 

 

Traceback (most recent call last):

 

File "2test.py", line 10, in

 

api = tesseract.TessBaseAPI()

 

NameError: name 'tesseract' is not defined

 

 

Where did you get this code? Which packages did you install in Windows in order to make run it?

 

 

Let me know.

 

Pedro M.
idata
Community Manager
173 Views

Hello Ramisha93,

 

 

Do you have any updates about this?

 

 

Pedro M.
idata
Community Manager
173 Views

I collected code by googling. I modified the code according to my requirements of project.

But while running python progrom on windows i it acquires black screen like cmd.exe.

Still same error is following.

idata
Community Manager
173 Views

Is it possible for your to share the link of the page where you found the code you based your project in?

 

 

I'm afraid I don't understand this sentence:

 

 

"...But while running python progrom on windows i it acquires black screen like cmd.exe…"

 

 

What do you mean by that?

 

 

Did you install any python packages in order to run this code on your PC? If so, which ones and how?

 

 

Let me know.

 

Pedro M.
Reply