Detecting variuos objects of the same signature

Added by Mohammad Shahili over 2 years ago


I have ran into a problem in my project. I have taught the pixy 2 signatures. There can be multiple (2 or at most 3) objects of the same signature that the pixy sees at a time, but I only need to use the information (x-y coordinates) of a specific object within that group. I was wondering if there is a way of coding the pixy to answer to an object of a specific signature that has a specific x or y coordinate. I am using Arduino uno to code the pixy.

I appreciate any help or ideas,


Replies (1)

RE: Detecting variuos objects of the same signature - Added by Edward Getz over 2 years ago

It sounds like you just need some help with programming your Arduino (are you using an Arduino?)

Here is the Arduion API:

You can write a piece of code:

  int i, blocks; 
  // grab blocks!
  blocks = pixy.getBlocks();

  // If there are detect blocks, print them!
  if (blocks)
    Serial.print("Detected ");
    for (i=0; i<blocks; i++)
       if (pixy.blocks[i].x==some_value && pixy.blocks[i].y==some_other_value)

Note, testing for specific values of x and y tends to not be a very good strategy. It would be better to have a range:

if (x0<=pixy.blocks[i].x &&  pixy.blocks[i].x<=x1 && y0<=pixy.blocks[i].y &&  pixy.blocks[i].y<=y1)

hope this helps!