<< return to Pixycam.com

Convert x and y data from Pixy2 cam to real life distance

Hi guys,
I am currently using a Pixy2 Camera for a autonomous package retrieval robot project. The microcontroller I am using is Arduino Mega. I am able to get the data including x, y, distance, length and width data on the serial monitor with the camera detecting a Lego block. I wonder how to actually convert the x and y coordinate data into physical unit like cm or in?

ps: lego blocks are 2x2 and 2x4 normal block.
I really appreciate any form of help that you can give!

Hello,
Consider that a 1 inch object could be 50 pixels wide or 5 pixels wide depending on how close it is to the camera (Pixy).

Are your LEGO blocks all the same distance from Pixy?

If so, the actual width of the LEGO is a constant multiple from the width in pixels that Pixy reports.

Hope this helps!

Edward

Hello Edward,
Yeah, the distance will be the same. I decided to put the camera overhead to map the camera’s coordinate to my testing area coordinate. Now I’m just trying to figure out how to send the camera’s x and y data to the arduino wirelessly.
Thanks for your help!

Cheers,
William