Skip to content

Smart Vision Systems leverage advanced imaging technology, machine learning, and automation to enhance product inspection, ensuring accurate defect detection, classification, and quality control in real-time.

License

Notifications You must be signed in to change notification settings

deepcodess/Smart-Vision-Technology

 
 

Repository files navigation

Flipkart-Grid-6.0

Introduction

This repository presents a comprehensive Python script designed to automate the processes of expiry date verification and fresh product identification using image analysis. It leverages the capabilities of OpenCV for image processing, Tesseract OCR for text extraction, and advanced techniques for date and color analysis to determine if a product is expired or fresh.


How to use ?

This code is only valid for VS Code and PyCharm.

The code has two parts: one for expiry date verification and the other for fresh food detection.

  • If you use the expiry date verification, click on the 'Run' button, and it will create an external window where you can upload an image of an expiry date. The code will detect the expiry date from the text, print the value, and indicate whether the item has expired or not.

  • If you use the fresh food detection, running the code will create an external window where you can upload an image of either fresh or rotten food. The code will detect if the food is fresh or rotten and show the percentage of how much it is rotten.


Key Features

  • Image Processing: Employs OpenCV to preprocess images, enhance contrast, and extract relevant features for analysis.
  • Text Extraction: Utilizes Tesseract OCR to accurately extract text from images, including expiry dates and product information.
  • Date Verification: Implements robust algorithms to parse and validate extracted expiry dates, ensuring accuracy and reliability.
  • Freshness Assessment: Analyzes image features, such as color and texture, to assess the freshness of products.
  • User-Friendly Interface: Provides a simple and intuitive interface for users to select images and view the results.

Project Preview

OPTION 1 : For Expiry Date Verification

expiry-1 expiry-2

OPTION 2 : For Fresh Produce Inspection

fruit-1 fruit-2


Explanation PPT

Here is the link to the explanation ppt. Click here


Video Solution

Here is the link to the video solution. Click here


Setting up Tesseract OCR

To download and set up Tesseract OCR, follow these steps:

Step 1: Download Tesseract OCR

  1. Go to the official Tesseract GitHub page: Tesseract at GitHub.

  2. For Windows users, you can directly download the installer from UB Mannheim Tesseract Repository:

    • Choose the latest version of the Windows installer (usually it will be an .exe file).
    • Download the file and run the installer.

Step 2: Install Python Libraries

To use Tesseract with Python, you will need to install the pytesseract library:

pip install pytesseract

Step 3: Configure Tesseract in Python (Windows)

Once Tesseract is installed, you will need to point Python to the tesseract.exe file. Here’s how to do that:

  1. Find the Tesseract Executable:

    • By default, Tesseract is installed in: C:\Program Files\Tesseract-OCR\tesseract.exe.
  2. Configure the Path in Python: Add this line to your Python code to configure the path to the Tesseract executable:

import pytesseract
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

Step 4 : Test the Setup

You can use the following code to test if Tesseract is working:

from PIL import Image
import pytesseract

# Set the path to the Tesseract executable (for Windows)
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'

# Open an image
image = Image.open('sample_image.png')

# Perform OCR on the image
text = pytesseract.image_to_string(image)

print("Detected Text:")
print(text)

Step 5 : Add Tesseract to PATH (Optional)

You can add the Tesseract folder to your system's PATH environment variable so that you don't need to specify the path to tesseract.exe in your Python script every time.

  1. Open System Properties:

    • Go to Control Panel > System and Security > System > Advanced System Settings.
  2. Environment Variables:

    • Click on Environment Variables.
  3. Edit PATH:

    • Under System variables, find the Path variable, select it, and click Edit.
  4. Add New Path:

    • Click New and add the path to the Tesseract executable (e.g., C:\Program Files\Tesseract-OCR\).

After this step, you will no longer need to explicitly define the path to the Tesseract executable in your Python code.

Installation

For expiration_date_verification.py ( to verify the expiry date of a packaged item )
  1. Run the following commands for the installation of the requireds libraries:
pip install pillow pytesseract opencv-python numpy

[Note: If error is met while installing, then run the install command separately.
For example, pip install opencv-python, pip install numpy, pip install pillow, pip install pytesseract]
  1. Run the Python file using the following command:
  python expiration_date_verification.py

For fresh_produce_inspection.py ( to inspect the quality of fresh produce )
1. Run the following commands for the installation of the requireds libraries:
pip install opencv-python numpy

[Note: If error is met while installing, then run the install command separately.
For example, pip install opencv-python, pip install numpy]
  1. Run the Python file using the following command:
  python fresh_produce_inspection.py

How to use the application

License

This project is released under the MIT License. See the LICENSE file for more information.


Programming Languages Used

Languages and Tools

Developers

About

Smart Vision Systems leverage advanced imaging technology, machine learning, and automation to enhance product inspection, ensuring accurate defect detection, classification, and quality control in real-time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%