


Here,the conversion is done using cv2.cvtCOLOR(). Tesseract works on RGB images and opencv reads an image as BGR image, so we need to convert the image and then call tesseract functions on the image.We will also resize the image so that we can get well-formatted output for all different sizes of input images. In this function, we’ll read the image using cv2.imread.Let’s jump to the extract function which takes the path of the image as a parameter.Tkinter provides GUI functionalities: open an image dialog box so user can upload an image.Provide the location of the tesseract.exe file.Import all the required libraries (opencv, tkinter, tesseract).X,y,w,h = int(text),int(text),int(text),int(text) Texts = pytesseract.image_to_data(Sample_img)įor cnt,text in enumerate(texts.splitlines()): Sample_img = cv2.cvtColor(Sample_img,cv2.COLOR_BGR2RGB) Image_ht,Image_wd,Image_thickness = Sample_img.shape Root.title('TechVidvan Text from image project')
Image text extractor install#
To install the libraries use pip installer from the command prompt / terminal: Pip install opencv-pythonĬreate main.py file and add the following code Let’s start the text detection and extraction project development Install required libraries
Image text extractor download#
To implement this project you should have basic knowledge of:īefore proceeding ahead, please download the source code of Text Extraction Project: Extract Text from Image with Python. As mentioned earlier it is open source so it is free to use. It efficiently reads text from images and is very easy to use. It is an open-source engine for optical character recognition (OCR). Keeping you updated with latest technology trends, Join TechVidvan on Telegram What is Tesseract?
