How To Extract Text From An Image In Python | Pytesseract | Image To Text Processing

Hello YouTube welcome back to my tutorial in my earlier tutorial I was talking about programming Linux using which we can extract any text from an image okay so in this tutorial I will talk about the same thing which is extracting any kind of text from an image but that we will do in Python using the Python language how.

We can extract any text so like like Linux we also need a module in Python called tesseract piety select which is there in Python also so all you have to do is you have to.

Install this module called PI tesseract okay so if you go to your right Python prompt and if you type help you you can list out the modules which are there okay so you have to make sure that that module is.
Present in your spite and pack.

Is if it is not there then you have to install it so I was just checking ok here you see this is the module that we need PI to select and also as we are doing the image processing so we.

Need this this image library P I am okay yeah python image library so yeah we have all these things so if you don’t have this what you have to do is you.

Have to install it the IP install VIP installer and sorry pipe installer and then you have to install what do you call PHP install and then the package name.

Which is which is PI to select and then also you have to install e il right so you have to run this command as well as I’m sorry I this is already.

There in my system so probably I don’t need to do it okay so anyway if it is not there you can install it right okay another thing that here you need to install is we just call the program so if I Tony meas library which is PIL so this all three of you stop but once you have these all what is present in.

Your pattern okay now you can start with the Miss processing so let’s say we have a program we have an image and you understand text out of it so we’ll just write a simple program okay let’s say image text so we’ll start with this shebang line yeah so what we have to do is we have to as we are doing the image processing so we need the image class okay so we will not I will not import the entire library we import the.

Image class also we need this image to string function from from PI Deseret right.

We are all set we are done with imports now what we have to do is we have to open an image okay we can specify an image okay so either.

You can take it from the input we can run a command like internal image name or something like that or you can specify the image then you can hard code the email inside industry but we are giving an image let’s say I have it in my home and then anything yeah I mean let’s say happy this one is sexy thought sure to JPEG or.

What it is should be its jpg fine so we are taking this image right okay so we will return to return the image attribute so now what we will do is we will use this image which which is open to convert into the string right okay so image under swing.

So we use this image with p.

opened and simply we can put this much this it should be enough and it will definitely return.

Text so we say text okay so turning a text call to this and then we can print the text right I think this should be it let’s try it.