Skip to main content

in automation anywhere 360.. consider there is an image which is basically a colored table.. how to extract only the colored values from that table

Hi ​@Krishna 144,

 

Are you taking about Web extraction or Document extraction?


@Padmakumar It would have to be web/application/image extraction since document extraction doesn’t support color. Document Automation maps all documents to grayscale to assist in the OCR process.

@Krishna 144 Are you talking about something like this?

In this case, it is an image. I believe it’s called a “heat chart”.

If this were me and the heat chart was always the same dimensions, I would use Python along with the cv2 library to read pixel values. Knowing the dimensions of the center of the four corners and how many rows/columns there are, you can calculate which pixels you need to read.

If you choose to do this and are using a static image, I strongly recommend not using JPEG format as it is a lossy format and will slightly vary the pixels values, especially along borders that have a high contrast. PNG is a good format for this.

FYI: The cv2 library loads an image and converts it to an array. 

import cv2

#load the image to an array
img = cv2.imread("c:\temp\heatchart.png", 0)

#get the dimensions of the image (array), channels = bits/pixel
rows,cols,channels = img.shape

#display all the array values
for i in range(rows):
for j in range(cols):
k = img i,j]
print(k)

 


@Padmakumar - web extraction


@Krishna 144 Can you give us a screen shot or a little more information if I was even close to what you were asking?

Even for web extraction, you can use the Automation Anywhere action to save the screen shot as a graphic or automate saving the graphic from the web page to a temporary folder. Then you can have the Python script read the pixel values appropriately.

Since this is web extraction, if it is just a table with CSS classes for the cells, you can capture the table using a Recorder: Capture and use the “InnerHTML” property to get the source code for the table. Then, using string processing, you can parse the raw HTML and determine the colors for the cells.


Reply