Skip to main content

This repository contains a Python program designed to execute Optical Character Recognition (OCR) and Facial Recognition on images.

Project description

Optical Character Recognition (OCR) and Facial Recognition Program

This repository contains a Python program designed to execute Optical Character Recognition (OCR) and Facial Recognition on images.

Table of Contents

  1. Introduction
  2. Prerequisites
  3. Usage
  4. Modules Description

Introduction

The Python program imports several packages necessary for OCR and facial recognition. It accepts a list of images as input, performs OCR, rotates the images to the busiest rotation, extracts ID information, and performs facial recognition by extracting the biggest face from the images. The program then computes the similarity between the faces and exports the extracted ID information into a JSON file.

Prerequisites

Ensure the following packages are installed: cv2 PIL (Image) easyocr pandas (pd) skimage.transform (radon) regular expressions (re) datetime concurrent.futures NumPy (np) TensorFlow (tf) VGG16 model from Keras (tensorflow.keras.applications.vgg16) tensorflow.keras.preprocessing (image) scipy.spatial.distance model_from_json from Keras (tensorflow.keras.models) subprocess urllib.request dlib time matplotlib.pyplot facenet json io importlib.resources You can install these packages using pip:

pip install opencv-python Pillow easyocr pandas scikit-image regex datetime concurrent.futures numpy tensorflow dlib matplotlib facenet-pytorch jsonpickle importlib_resources

Note: Keras and the VGG16 model come with TensorFlow, so there is no need to install them separately.

Usage

To use this program, you can clone the repository, place your images in the same directory and modify the IMAGES list accordingly. Run the program in your terminal or command prompt as: python ocr_and_facial_recognition.py

Please note that this program does not include any user interface and does not handle any errors or exceptions beyond what is included in the code.

Modules Description

Importing Necessary Packages: The program begins by importing all the necessary packages used in the OCR and Facial recognition steps.

Data Introduction:

This section defines a list of image file names that will be used as input for the OCR and facial recognition steps of the program.

Load easyocr and Anti-Spoofing Model:

Two functions to load the easyOCR package with English language support and the anti-spoofing model respectively.

Data Preprocessing:

Several functions are defined here to open and read an image file, convert it to grayscale, perform a radon transform, find the busiest rotation, and rotate the image accordingly.

Facial recognition:

This section is dedicated to detecting faces in an image using a HOG (Histogram of Oriented Gradients) face detector, extracting features, and computing the similarity between two sets of features using the cosine similarity metric.

Information Extraction:

Finally, the program uses OCR to extract information from an image, computes the similarity between faces in different images, and outputs this information in a JSON file.

Please refer to the source code comments for more detailed explanations.

This is a basic explanation of the project and its usage. This project was last updated on 24th May 2023 and does not have any GUI or error handling beyond what is included in the code. For more details, please refer to the comments in the source code.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

idvpackage-3.0.32.tar.gz (3.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

idvpackage-3.0.32-py3-none-any.whl (3.5 MB view details)

Uploaded Python 3

File details

Details for the file idvpackage-3.0.32.tar.gz.

File metadata

  • Download URL: idvpackage-3.0.32.tar.gz
  • Upload date:
  • Size: 3.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for idvpackage-3.0.32.tar.gz
Algorithm Hash digest
SHA256 270c3acf114e8383a95783c1229f79b0c5b005b7801aba8c0625eab61b29d6e7
MD5 c62e9f1b527024ca8f35e4fa3be09a3d
BLAKE2b-256 9740b154e3b7d6778561c3238e1baea0ba82aeeac668606cbf27e0926667fa6a

See more details on using hashes here.

File details

Details for the file idvpackage-3.0.32-py3-none-any.whl.

File metadata

  • Download URL: idvpackage-3.0.32-py3-none-any.whl
  • Upload date:
  • Size: 3.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for idvpackage-3.0.32-py3-none-any.whl
Algorithm Hash digest
SHA256 e8c6f409caa7f82cbcaf27a39372aac4720c92cf7c3d5c4148f8e88570a9f07c
MD5 313cd1fcd81e0c82c6aff181046ccb84
BLAKE2b-256 eb3c5dd7c907e75f6e4f3d38bb0370ee96e200c0fa5d22ef40ffb764b391023a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page