Pixy2 Quick Links
Basics
Connecting Pixy2 to…
Pixy2 Modes / Programs
Software and Support
Basics
Connecting Pixy2 to…
Pixy2 Modes / Programs
Software and Support
This API can be called through the video member of the Pixy2 object, for example:
Pixy2 pixy; uint8_t r, g, b; pixy.video.getRGB(50, 75, &r, &g, &b); // get red, green, blue values at location x=50, y=75
Firmware versions 3.0.11 and greater will automatically switch to the video program when making requests through the video API.
It is recommended to take a look at the video_get_rgb example in the Arduino Pixy2 library.
This is currently the only function supported by the video program. It takes an x and y location in the image, and pointers to red, green and blue variables that get written into by the getRGB() function with the red, green and blue values of the pixel at that location in the image. getRGB() actually takes a 5×5 section of pixels centered at the x, y location and performs an average of all 25 pixels to obtain a representative result.
The image coordinates are shown below.
The width and height values are both available through pixy.frameWidth and pixy.frameHeight, if you don't want to remember their specific values.
.