1. Hardware Part
Last week, the components necessary to OCR have been assembled whereas these components are not enough to make a robot "mobile". Therefore, three members of our group discussed the way of implementing a mobile robot and found it requisite to purchase extra components, which consists of a set of 4tronix initio robot kit shown in figure 1 and a Robohat controller shown in figure 2.
Figure 1: 4tronix Initio Robot Kit
Figure 2: Robohat Controller
Moreover, they also intended to utilize a group of buzzers as audio output. Nonetheless, this plan ended up being discarded since it was difficult to control the buzzer.
2. Software Part
With scrutinizing the process of installing Pytesseract in the Raspberry Pi, the reason why we failed was revealed: The version in which we installed Pytesseract was Python 2.7 whereas the version we were currently using was Python 3.0. More importantly, there was no way of overcoming this obstacle by modifying the path Pytesseract. Consequently, we decided to eliminate all the data in Raspberry Pi and reinitialize it. Besides, it should be noticed that we also deleted the Python 2.7 so that the Pytesseract can only be installed in Python 3. After all the work mentioned above, we attempted to import the pytesseract again and we succeeded. Then we began to test the functionality of our camera.
To begin with, all libraries and classes correlated to OCR and camera should be imported as below.
import pytesseract
from PIL import Image
from picamera import piCamera
from time import sleep
Subsequently, with referring to the official manual of Raspberry Pi camera, we typed in the codes shown below to implement OCR on Raspberry Pi.
cameara = piCamera()
camera.start_preview()
sleep(2)
img = camera.capture('path')
camera.stop_preview()
imageRecognition = pytesseract.image_to_string(img.open('path'),config='--psm 6')
The camera successfully cooperated with OCR but we found it cannot work effectively. In other words, the program can only recognize the words or sentences when the camera works in a bright environment. We thought this should be blamed on the internal mechanism of OCR algorithm.
Comentarios