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 ccc member of the Pixy2 object, for example:
Pixy2 pixy; pixy.ccc.getBlocks();
getBlocks() gets all detected blocks in the most recent frame. The new data is then available in the blocks member variable. It returns an error value (<0) if it fails and 0 (PIXY_RESULT_OK) if it succeeds.
Setting wait to false causes getBlocks() to return immediately if no new data is available (polling mode). Setting wait to true (default) causes getBlocks to block (wait) until new block data is available.
sigmap is a bitmap of all 7 signatures from which you wish to receive block data. For example, if you are only interested in block data from signature 1, you would pass in a value of 1. If you are interested in block data from both signatures 1 and 2, you would pass in a value of 3. If you are interested in block data from signatures 1, 2, and 3, you would pass a value of 7, and so on. The most-significant-bit (128 or 0x80) is used for color-codes. A value of 255 (default) indicates that you are interested in all block data.
maxblocks indicates the maximum number of blocks you wish to receive. For example, passing in a value of 1 would return at most 1 block. A value of 255 (default) indicates that you are interested in all blocks.
The number of blocks contained in the blocks member variable.
This contains all of the block data as a result of getBlocks(). Inside the Block struct:
== void print() – Calling this prints the block information to the console.
This variable contains the signature number or color-code number.
This variable contains the x location of the center of the block. The value ranges between 0 and frameWidth (316).
This variable contains the y location of the center of the block. The value ranges between 0 and frameHeight (208).
This variable contains the width of the block. The value ranges between 0 and frameWidth (316).
This variable contains the height of the block. The value ranges between 0 and frameHeight (208).
This variable contains the angle of color-code in degrees. The value ranges between -180 and 180. If the block is a regular signature (not a color-code), the angle value will be 0.
This variable contains the tracking index of the block. When Pixy2 detects a new block, it will add it to a table of blocks that it is currently tracking. It will then attempt to find the block (and every block in the table) in the next frame by finding its best match. Each block index will be kept for that object until it either leaves Pixy2's field-of-view, or Pixy2 can no longer find the object in subsequent frames (because of occlusion, lack of lighting, etc.)
This variable contains the number of frames a given block has been tracked. When the age reaches 255, it remains at 255.