This Python project involves processing images within a provided ZIP file containing newspaper images. The task is to search through these images for occurrences of names and faces. The script will utilize various libraries to perform tasks such as face detection, optical character recognition (OCR), and image composition to create contact sheets.
- Python
- zipfile: Python's built-in library for working with ZIP files. Used to extract images from the provided ZIP file.
- PIL: Python Imaging Library. Utilized for image processing tasks such as image opening, manipulation, and contact sheet creation.
- pytesseract: Python wrapper for Google's Tesseract OCR engine. Enables optical character recognition to search for keywords within images.
- OpenCV (cv2): Open Source Computer Vision Library. Used for face detection within images and other computer vision tasks.
- Clone the repository:
gh repo clone Talhamuhammadali/Image-Processing-from-zipfile
- Setup Virtual Envirnoment:
python3 -m venv myenv
ON Windows:myenv\Scripts\activate
ON Linux:source myenv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Place the ZIP file containing newspaper images in the files folder.
- Run the script
image_processing.py
.Replacepython image_processing.py --name "anyname"
"anyname"
with the desired name to search for.
- Face Detection: Utilizes OpenCV for detecting faces within images.
- Keyword Search: Performs OCR using Tesseract to search for specific keywords within the images.
- Contact Sheet Generation: Uses PIL to composite images with detected faces into contact sheets.
A zip file is included in the files folder. Use script to find 'Christopher' by using:
python image_processing.py files/project.zip --name "Christopher"
The processing takes ~15-20m for me as it was done on an old pc.The results are saved in the main folder. the result for this case is:
Try the following example:
python image_processing.py files/project.zip --name "Mark"