Using Python and its libraries for Optical Character Recognition on images to recognize text using Pytesseract and identifying faces associated with the recognized text using OpenCV.
The project is being coded in Python3. In this project, we will manipulate images using pillow a Python imaging library and then apply optical character recognition to the images we have, to recognize text which will be done using Pytesseract, and we will be using the OpenCV library to identify faces in images.
pip install Pillow
pip install opencv-python pip install pytesseract pip install numpy
These will be the basic application of these dependencies that will be used in this project.
There are two datasets that will be used.
The dataset is provided within the zip file. As mentioned we will be using two different datasets. One which is of small size for the reason for faster computation and another which is much larger which will take a longer time.
If you want to use your own dataset all you need to do is:
if you have your dataset already within a directory then,
pages_list=os.listdir('small_size_iamges')#within the quotes type your directory name
or,
if your dataset is within a zip file then follow the below technique.
for this, we will be importing zipfile library.
os.mkdir('large_size_images') local_zip = 'datasets/large_size_images.zip' #change this line to the location of your dataset zip_ref = zipfile.ZipFile(local_zip, 'r') zip_ref.extractall('small_img') zip_ref.close()
Both methods have been used in the notebook for better understanding.
Submitted by Adarsh Hiremath (adarshhiremath)
Download packets of source code on Coders Packet
Comments