<< return to Pixycam.com

Detecting variuos objects of the same signature

Hi,

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,

Sincerely,
Mohammad

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

Here is the Arduion API:

http://cmucam.org/projects/cmucam5/wiki/Arduino_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 ");
    Serial.println(pixy.ccc.numBlocks);
    for (i=0; i<blocks; i++)
    {
       if (pixy.blocks[i].x==some_value && pixy.blocks[i].y==some_other_value)
           do_something;



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)
       do_something;

hope this helps!

Edward