This Project denotes the process via which object and colour detection and object tracking is accomplished by the Stride Master Robot via the use of The Brain Module and Python Open Computer Vision Libraries.
The aim of this project will be to design, construct and program a Stride Master Robot Platform Module of which enables the process of object Detection and Tracking via the Stride Master Robot Module.
This project will be based upon the Stride Master peripheral Brain Module, of which is composed of a 4 Gb Raspberry pi 4 embedded Commuter equipped with a full Desktop Linux distribution of Raspian.
The Raspberry Pi 4 connects any Internet-connected computer or smartphone and via the VNC protocol allows remote access of its desktop functions.
The Pi 4 has been configured with Arduino IDE to allow accessing of Robot Sensor information via a serial USB connection and Py Charm Python IDE for the execution of Python scripts.
This module is also augmented with a Pi cam, a Raspberry pi camera, and a servo motor to actuate such in the vertical axis.
Via a Python Script and the Pi Camera Library Live video of the robot's surroundings is captured in a BGR Format, in which the incoming video's matrix of pixels are stored via their BGR (BLUE GREEN RED) Value in Hexadecimal. Such video is then converted into an HSV Format where pixel characterization is done via the pixel's Hue, Saturation and Colour Value of which can be easily worked upon.
There are two main modes of Object detection that can be employed by this Module:
Haar Cascade Object Detection
Colour Quantification Object Detection
A Haar Cascade is an Object Detection Algorithm of which stored has been pre-trained against a Data Set of images containing a critically identifiable feature or Object of which can be used within our Object Detection Program. In this case, a Face Detection Haar Cascade was employed within the module for simplicity.
Via comparison on the incoming video image matrix data against the pre-trained Haar Cascade, relevant objects can be identified and located within the incoming video and acted upon.
The Face within the image is isolated and via Open CV contour detection, a rectangular box can be used to bound the image of the face via such features points of extremum relative to the image centre. Such provides easily manipulated positioning data relative to the viewpoint of the Pi Camera and the mean Geometric centre of the Face is found via such dimensional information.
Via a simple positioning Algorithm, the robot will always attempt to firstly, position such mean point to the direct centre of the image array and secondly, ensure the area occupied by the Image is at a preset maximum value. Such is accomplished by an array of Preset commands communicated to the robot via a 3 digit 4 channel Binary Communication Connection Detailed further below.
Here such a program can be seen in action, however, due to limited processing resources and the resource-intensive Haar cascade algorithms, the rate of actionable data output is too slow for our means and hence the next means of object detection will be used in Robot Demonstrations.
This method is simpler and less resource-intensive whilst allowing for the identification of a wider range of objects via the classification of their colour.
Here, each pixel of the incoming video in the HSV format is analyzed and cross-referenced against a predetermined range of Hue, Saturation and Value characteristics of which depict the desired colour. Such pixels are then isolated and then displayed as a matrix of pixels called a Mask and the contours of the mask are analyzed such that a rectangular box can be used to bound the image of the object via such features points of extremum relative to the image centre. Such provides easily manipulated positioning data relative to the viewpoint of the Pi Camera and the mean geometric centre of the object is found via such dimensional information.
Via a simple positioning algorithm, the robot will always attempt to firstly, position such mean point to the direct centre of the image array and secondly, ensure the area occupied by the Image is at a preset maximum value. Such is accomplished by an array of preset commands communicated to the robot via a 3 digit 4 channel Binary Communication Connection Detailed further below.
Such a positioning method is shared between these two methods of Object Detection.
To optimize the Rate of actionable data transmission, the box illustration was removed from the image feed to free processing resources.
Communication between the Stride Master Robot and the Brain Module is achieved via the aforementioned 3 Digit Binary Data Communication System. A four-channel wire connector is connected to the digital pins between the robots, which can occupy and read respectively either an ON or OFF state. Three channels are used as binary digits and each sequence of digits correspond to a different command as shown below, allowing for the aforementioned inter-module communication. The fourth channel serves as a check channel, giving the receiver board a "Heads up" that a command will be issued and to await such command.
Here is the truth table used for the 3 Digit Binary Data Communication System.
Whilst a targeted object is not in the line of sight of the object detection system, The Stride Master Search algorithm is executed, in which the robot rotates 45 degrees via the use of the GAP Module, after which it does a 120-degree vertical sweep of its surroundings using the Pi camera's servo actuator. If the object is not found, such is repeated for a maximum of 8 repetitions, after which the robot moves half a meter forward and such process iterates until a targeted object is located.
Here this object detection system is demonstrated via the Stride Master Robot. The robot will always try to locate and approach a target of which is red via means of Colour Quantification Object Detection. Whilst a red object is not in the robot's line of sight it will execute the Stride Master Search Algorithm as detailed above and once the robot's target is sufficiently close, the robot will cease motion unless given alternative directives.
In the videos below three Video feeds are shown. First is that of the Overhead Overview of the robot's operations, Second is that of the Robot Object Detection System's Live video input and Lastly is the mask applied to such video to allow for object detection.
As stated above, to optimize the rate of actionable data transmission, the box illustration was removed from the image feed to free processing resources.
In this demonstration, red piece of wood is being tracked.
In this demonstration, the red face of a Rubix cube is being tracked.
Going forward with this project, firstly, to allow for greater Object detection capabilities, a more powerful computer will be used in the stead of the Raspberry Pi 4, Like a Latte Panda or Nvidia Jetson or possibly a method via which data processing is done on an external Windows computer and commands relayed back to the main robot.
After such further algorithmic optimizing will be in order along with the use of a wider variety of Haar Cascades for Haar Cascade Object Detection.
Next, a higher quality camera can be employed with a larger field of vision to improve the time taken to find desired Objects.
Finally, a means of object permanence can be added where the program categorizes less relevant non-targeted objects within its previous field of view relative to the robot, via the GAP Module, as to map its environment and adaptively generate optimized means of search through such environment to improve the time taken to find desired Objects.
For further information on the robot Platform and the other Modules used in the demonstration Go to Project Stride Master