Skip to content

These are simple projects on python to detect texts from images and print that out as text, crop image also as audio file.

Notifications You must be signed in to change notification settings

MUMTAHINA-766/Car-lisense-number-detection-and-text-detection-from-images

Repository files navigation

Car-lisense-number-detection-and-text-detection-from-images!

car1

car1

car2

car3

car4

imgttxt1

imgttxt3

textbox1

textbox2

AudioDet1

Step : 1 :- Installation and environment setup

Here, I’ll use Python as a programming language to complete the OCR task.Make sure we have python 3 installed in our system then we are ready to install OCR and Tesseract, use the commands mentioned below one by one:

pip install opencv-python

pip install pytesseract

Step 2:- import libraries in visual studio code:

import pytesseract

import cv2

import os

from gtts import gTTS

import numpy as np

import imutils

Step 3:- Read and image and detect the texts show as output:

image = cv2.imread("image/Sample_image.png")

(converting image into gray scale image)

gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)

(Converting it to binary image by Thresholding

 this step is require if you have colored image because if you skip this part   then tesseract won't able to detect text correctly and this will give incorrect result)

threshold_img = cv2.threshold(gray_image, 0, 255, cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]

(display image)

cv2.imshow('Result', image)

img = Image.open('image/Sample_image.png')

(Display the image until press any key)

cv2.waitKey(0)

(Detect the text from image and print it:)

text = tess.image_to_string(img)

print(text)

Step 4 : Make the text audible and save the audio file:

audio = gTTS(text = xy, lang = 'en', slow = True)

audio.save("quote3.wav")

os.system("quote3.wav")

About

These are simple projects on python to detect texts from images and print that out as text, crop image also as audio file.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages