1.Hardware part:
Three students in our group are responsible for setting up Raspberry Pi components in accordance with the official Raspberry Pi manual which can be accessed via the URL: https://projects.raspberrypi.org/en. In the first place, the Raspberry Pi board was successfully supplied with power via a micro USB port. Secondly, the board was connected to a display screen as the primary output. In order to realize image recognition, a compatible camera is indispensable. Therefore, the camera was also connected to the exclusive camera module port on the board via a ribble cable. The hardware components were basically settled down and the connected components can be observed as below:
Figure 1: Camera Connected with Raspberry Pi Board
Figure 2: Connect Screen with Raspberry Pi Board
2. Software Part
The other two members in our group are supposed to write python code in Raspberry Pi to apply OCR to input images photoed by the camera and display the recognition outcome on screen. To achieve that, an open-source python library named as Pytesseract has to be installed within python. And the specific operations are shown as below.
Firstly, the following commands should be typed in to install the dependant configuration so that the program can accept multiple types of input such as png, jpeg.
sudo apt-get install g++ # or clang++ (presumably)
sudo apt-get install autoconf automake libtool
sudo apt-get install autoconf-archive
sudo apt-get install pkg-config
sudo apt-get install libpng12-dev
sudo apt-get install libjpeg8-dev
sudo apt-get install libtiff5-dev
sudo apt-get install zlib1g-dev
Secondly, install Leptonica by typing:
sudo apt-get install libleptonica-dev
Subsequently, Tesseract OCR tools should be installed:
sudo apt-get install tesseract-ocr
Finally, install Pytesseract:
pip install pytesseract
After all these operations, a check is necessary. Therefore, we typed the code in command line shown below to inspect the version of Tesseract. The corresponding version information was displayed successfully.
tesseract --version
Nevertheless, when we attempted to import the pytesseract by typing the code shown below in python IDE--thorny in Raspberry Pi. Error reported. It showed that "No module named pytesseract", which means there is something wrong during the process of installing pytesseract. However, the error is not obviously discernable and what we can do is to retrieve the process and debug. Therefore, we decided to leave this error next week.
import pytesseract
from PIL import Image
Comentários