Color Tracking tutorial error


Ive been following the tutorial color tracking on the oF wiki

The problem is when i copy everything across to xcode to a new example app, when compiling i get an error about…

ld: duplicate symbol _finderRed in […/]testApp.o and […/]main.o

Which is unlike any error i’ve had before (no helpful red pointers unfortunately).

Anyone have any idea as to whats going wrong?

Im hoping to modify the code to get the x,y values of an 2 infrared led’s (that are at a fixed distance to one another so that i can eventually work out distance from lens, so if anyone knows of any code lying around…)


Did you use include guards in testApp.h?

#ifndef bla_bla  
#define bla_bla  
...code of header file goes here...  
#endif // bla_bla  

Regarding the distance from the camera: unless you are certain that the orientation of the two LEDs is not going to change, you need three to get the distance. If you’re sure it’s not going to change, the equation should be basic trigonometry. Once you calculate the distance in pixels in the image plane, the distance from the camera will be something like a/tan(b*c) where a is the physical distance of the LEDs from each other, b is the distance between the LEDs in the image plane, and c is a scaling factor that converts pixel-distance to radians (using the camera’s FOV).