How we can extract some specific value from JPG

Here is the JPG image of a cheque , from where I wanted to extract only MICR code and IFSC code.
I have tried Screen scarping and Tesseract OCR but not getting exact value as marks in Image. can some one help please ?

Hi @Srinibash_Dash,

Welcome to the community :slight_smile:

The image seems to be pretty clear, but the OCR isn’t always the right way to extract data as it’s hit and trial as per requirement

Do the following:

  1. Try different OCR’s present such as Microsoft, Google (both are free)
  2. Try checking how they are getting the values
  3. Once you reach a good understanding which one is good, pick it for all the images :slight_smile:

Hope this helps

Good day.

If you use python tesseract, you will be able to get far better results than those microsoft and tesseract users @Srinibash_Dash

1 Like

Correct Hareesh, we are getting better result , but getting like
image .
Can you please suggest any way to convert it back to original value

You got that result using python ocr? @Srinibash_Dash

yup , Tesseract ocr

tesseract OCR is google ocr, but you need to write a piece of code to use python OCR

Hmmm… that might take some time for me. But will try it out definitely.
Thanks a ton for the input

Thats great @Srinibash_Dash

But let me know if you want code :slight_smile:

I would love to see it @HareeshMR can you please share it with me :slight_smile:

Also how to use it :stuck_out_tongue:

This is the actual code I have, here I’m reading a image and extracting all the text on the screen. To read that, I used python tesseract and storing the text in a text file. I hope you know how to call python code and pass the parameters to it @Shubham_Varshney

try:  
    from PIL import Image
except ImportError:  
    import Image
import pytesseract

pytesseract.pytesseract.tesseract_cmd = r"C:\Users\hamadasi\AppData\Local\Tesseract-OCR\tesseract.exe"

#filename = 'D:\Python screenshot\Deepfieldglass.png'


def ocr_core(filename = None):
    if filename is None:
        #filename = 'D:\Python screenshot\Deepfieldglass.png'
        return "file name is null"
    text = pytesseract.image_to_string(Image.open(filename))  # We'll use Pillow's Image class to open the image and pytesseract to detect the string in the image
    textfile = open(r"Text file path","w+")
    textfile.write(text)
    #return text.encode("utf-8")
    return "Successful"

#print(ocr_core(filename))
2 Likes

@Hareesh, still not recognizing MICR code correctly. I learnt about Xebia - cheque analysing solution but not finding any related activity in Packager Manager !

Hi, Would you be able to provide more detail please?
I’ve never used Python with UiPath before

thanks

Just install the package UiPath.Python.Activities @qwerty1

You will get the python activities available in the activities pane and just drag them

HI Hareesh,

can you help me on the same.I am unable to import pytesseract .

Hi @puja12

Have you installed pytesseract after downloading it?

I am not able to download it.can you sent any link.

Yes done