Skip to content

keerthy-analyst/TEXT_EXTRACTION_USING_OCR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BizCardX: Extracting Business Card Data with OCR

Overview of the Project:

BizCardX is a software tool that uses Optical Character Recognition (OCR) technology to extract information from business cards. With BizCardX, users can easily digitize the information on their business cards, making it easier to manage and organize contact information.

Installing necessary Libraries

import easyocr
import cv2
import pandas as pd
import re
import sqlite3
import base64
import streamlit as st
from streamlit_option_menu import option_menu

Created a Table in SQL by connecting python with SQL DB using SQLITE3

conn = sqlite3.connect('mydatabase.db', check_same_thread=False)
cursor = conn.cursor()
my_table = 'CREATE TABLE IF NOT EXISTS Business_cards_data(ID INTEGER PRIMARY KEY AUTOINCREMENT,COMAPANY_NAME TEXT,EMPLOYEE_NAME TEXT,DISIGNATION Text,EMAIL_ID TEXT,CONTACT TEXT,ALTERNATE_CONTACT TEXT,WEBSITE TEXT,ADDRESS TEXT,IMAGE BLOB)'
cursor.execute(my_table)

Image Processing like converting color to gray-scale image and setting threshold value before inserting into OCR

img = cv2.imread(image)
original_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
rect, thresh_image = cv2.threshold(original_img, 70, 255, cv2.THRESH_TOZERO)

Extracting Data from the Business card

reader = easyocr.Reader(['en'], gpu=False)
res = reader.readtext(thresh_image, detail=0, paragraph=True)
result = reader.readtext(thresh_image, detail=0, paragraph=False)

Extracted data how it visualised on streamlit app

Screenshot 2023-03-23 152853

Inserting Extracted data in SQL table

my_data = 'INSERT INTO Business_cards_data(COMAPANY_NAME,EMPLOYEE_NAME,DISIGNATION,EMAIL_ID,CONTACT,ALTERNATE_CONTACT,WEBSITE,ADDRESS,IMAGE)values(?,?,?,?,?,?,?,?,?)'
cursor.execute(my_data, (company_name, name, designation, email_id, contact, alter_contact, link, address, image))
conn.commit()

Visualisation of data in Database

Screenshot 2023-03-23 151724

Home page of TEXT EXTRACTION FROM BUSINESS CARD USING OCR

Screenshot 2023-03-23 152628

link to view in your Browser

Local URL: http://localhost:8502 Network URL: http://192.168.0.102:8502

Link to view full video posted on my Linkedin

https://www.linkedin.com/posts/activity-7044629774253625344-x69e?utm_source=share&utm_medium=member_desktop

Releases

No releases published

Packages

 
 
 

Contributors

Languages