jeudi 3 mars 2011

Suivi d'objet - Object Tracking

When I started to improve my Boe-Bot with vision, my inital goal was to make it follow a color object. I managed to do some successful tests but it's time to finish to program this behavior.


To simplify image processing, the tracked object will be a bright color, easy to spot in my apartment environment. This yellow commercial item will be just fine :






Image processing steps, applied on this screenshot :




First, the "Mean Filter" reduces the noise, especially when the tracked object is far from the robot.


A "RGB filter" is used to remove all the pixels that are not orange.



The "Center Of Gravity" module provides 3 useful variables : X and Y coordinates of the orange blob COG, and the size of the blob.



The 3 available variables are processed :
  • COG_X is used to calculate robot heading (upper-left corner)
  • COG_Y is used to tilt the camera to keep the object into the field of vision (upper-right corner)
  • COG_BOX_SIZE is used to determine if the robot needs to move forward or backward, in order to stay at a constant distance from the object (center)

Finally, a VB script sets 3 variables corresponding to the pulses to be sent to each servo through the serial port (lower line of values on the screeshot)

The BS2 waits for these 3 values and sends them to the servos.




Conclusion :
  • Exactly like for the obstacle avoidance behavior, the lighting is essential to provide high quality images to Roborealm. I'm thinking about adding an embedded lighting device such as LEDs mounted on the cam chassis. Probably a future improvement !
  • The robot reacts quickly when the tracked object moves, it's a good start.
  • A lot of parameter need to be ajusted to prevent the cam tilt jitter, to mitigate the risk of image processing error (noise, background color filter...)