Display origin?

Hi! I’m using the rpc library to process an image and I want the master program to draw on the image for a snapshot. I’ve found that the image on the cam that is transferred doesn’t have the crosshair/rectangle on it. Right now I’m trying to pass the blob.x and blob.y values to draw a crosshair on the pygame window but they aren’t lining up.

Where is the origin (0, 0) for the display? On Pygame it’s on the top left of the screen and I am suspecting the origin for this is on the bottom right, but I just want to double check. As a side question, is there an easier way to get the crosshair from the cam to be transferred to the master? Thanks in advance!

Our image library is the top left of the screen. We do things the same way as other libraries.

Thanks for the reply. It seems I’m having an issue with transferring the x and y coordinates then; when I set up a testbench and had a similar program run from the IDE, it gave me a coordinate of (68, 60) for the blob.x() and blob.y() values. I passed those values through the rpc library to a similar program that should be doing the same thing, but now on my computer the passed values are (180, 132) after being unpacked. Do you know why the coordinates are so different?

On the H7 I’m returning the values along with a few other values using: return struct.pack(“<bfii”, status, blob_stat[2], blob.x(), blob.y()), and I’m unpacking the data with: a, b, cx, cy = struct.unpack(“<bfii”, result), where result is what called the function on the H7.

I found the solution; Pygame’s window was initialized as 640x480 and the H7 was outputting at QVGA which is 320x240. So, the coordinates were off by a factor of 2.

1 Like