Previously, we had made a smart glass that was able to detect the presence of people and recognise them for the visually challenged. Expanding that DIY to a second version, we are now going to make a smart glass that runs OCR and uses computer vision. A camera mounted on the front of the glass for carrying out the above will allow visually challenged people to read.
Bill Of Materials
In this version, you will also need a pair of goggles.
First, we need to install some of the required modules and libraries for our project. As the smart glass is based on real-time video processing, by using OCR we will extract the text from the image. Here, a module is needed that can capture images from a camera. By using a speech synthesis module, the text in those captured images can be converted into speech.
So first we need to install the following libraries
To install them, use below links:
sudo apt-get install espeak sudo apt-get install espeak python-espeak sudo pip3 install opencv2
Import the required libraries to the code and then set the path where the video frames are to be saved for further processing for text extraction.
Next create a while loop in the code, which will capture real-time video from the camera. Using cv2, convert the image into BGR and save it to the path previously set. Then call PyTesseract that will open the saved video frame for processing the image and extracting text from it. Then by using eSpeak, the speech engine will convert all that text into audio and read it.
Fix the camera onto the eyeglass and run the code. By putting a book in front of the camera and waiting for a few minutes without any movement, it will automatically start reading the book. To hear it on the radio, connect your earphones to the Raspberry Pi headphone TRRS jack. You can also connect any Bluetooth earphone.