How to loops list of images and use OCR on them

ocr
studio

#1

Hi I am having an issue I have created code to loop through folder and tak the list of images that exist there but it is not opening it so I could do a screen scrape. Any advise would be great looked everywhere cannot find solution to this problem

Thanks


#2

I couldn’t understand exactly what you want to do with that System.Drawing, but you can use Load Image activity to get the image and then pass that to the OCR engine.
Please take a look at this sample: LoopImagesOCR.zip (108.3 KB)


#3

Hi Mateus,

It has worked for me seems I was using wrong type.

I am wondering can UIPath do the following by opening up the image and scrape data that I give locations for it?

For example

In the image attached is it possible to scrape “Received From” “Amout” etc. I will give it a location what data I want to scrape.

If not then is it possible to do it in Record Style for Citrix but how can I made it this was that it would loop through list of images on my laptop then?

Thanks


#4

Use get OCR text activity


#5

You can manually select the area to be read by using the Indicate on Screen activity, then pass the selected area (an UiElement) to the Take Screenshot activity, which will output an image.
Then you pass this image to the OCR engine like I mentioned before.
Check this sample: ManuallySelectAreaForOCR.zip (105.4 KB)

Another option, like @MahalingPatil wrote, is to pass the selected area directly to the Get OCR Text activity. This is probably a better option, since you won’t need to take the screenshot.


#6

HI Mateus,

Thank you for such a quick reply. Does that means that in order to crop out same location for 100 images I still need manually give it locations? Is there a way to give SelectedRegion a location that will automatically pick it up and crop it out?

What values should I pass to variable with type UIPath.Core.UiElement?

Thanks


#7

If you know where the information you want to extract is located, you can crop the image and leave just that portion. Then you pass that to the OCR engine to get the text.
This workflow will extract a portion of all images in a folder and read it with Google OCR engine: LoopCropImagesOCR.zip (336.1 KB)
This portion is define by the CropRectangle variable, so you should know the coordinates and the dimensions beforehand.

EDIT:
You can get the coordinates (a Rectangle object) during runtime using the Indicate on Screen activity and then passing them to crop the images. The trick is that the coordinates should be taken from a window having the same size as the image, else the might try to read things out of the bounds of the image and it’ll raise an exception: SelectAreaLoopCropImagesOCR.zip (337.1 KB)


#8

Hi All,

In a process I want to crop all the images in same size , so area ordinations are fix and file also not to be selected , and the output file to be saved with different name

Tired doing same could not succeed please help with some example