Extract pixel coordinates of a rectangle


#1

I am trying to obtain the color of pixels located inside a rectangle found using the “get position” activity. To do this, I plan to extract the coordinates of the rectangle and use those coordinates in conjunction with the “colorcode” activity that I found here: ColorDetectorActivities,

The problem I’m having is that I can’t figure out how to get the pixel coordinates of the rectangle. Is there an activity that will get me this information?

Thanks.


#2

Hi @jgmcbride2004,

Output of Get Position Activity will be the rectangle coordinates which you can input into ColorDetectorActivity as given below:

X = rectangle.X
Y = rectangle.Y

Also, you can set highlight flag in ColorDetectorActivity as True to hightlight the input pixel location on the screen. This will help you to identify correct pixel location. Use it only for testing purpose.

Please follow this video:

Regards,
Nitin S


#3

Perfect. Thank you!


#4

Please mark my comment as solution if it solves your problem :slight_smile:


#5

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.