Weka is a powerful data mining tool that develops predictive modeling and data analysis based on information it receives. A more accurate way to predict if a ball is within an image view or not is to perform machine learning. I used Weka to produce a decision tree based upon data that will be collected. I took multiple pictures with the Nao’s camera, some with the orange ball in view, and others without. By using these images, it is possible to determine attributes that are similar in images with the ball in the frame. The problem is, Weka does not accept image files, so I had to transform these images into a data file somehow. Since images are just made up of hundreds of pixels with certain RGB values, I created a custom program that displays all of the RGB values of a given image. (This research spawned an image to pixel value convertor code that will be given to the OpenCV community) Once all of the RGB values of an image was produced, they were than set as data inside a Weka file (Figure 3.1), with the RGB values each being a separate attribute. Another attribute was added, called the ballFound method. This was just a Boolean method that outputted either a YES, or NO. After each pixel data line, the ballFound attribute would determine if the those RGB values produced an orange color. If the values returned an orange color, the ballFound method would be set to YES, if not it would return NO. So if an image file returned a certain number of YES’s, this characteristic would determine if an orange ball is within a given image frame or not.

Figure 3.1 Image converted to a data file for Weka
Ultimately the goal is for Weka to produce the most accurate and efficient decision tree based on the ballFound method. The more data that Weka evaluates, the predictive modeling it develops will be more precise. Therefore 30 images were taken, with 20 of them having the ball in view and 10 without. These pictures were then loaded into the OpenCV program that was custom created to convert images to RGB pixel values. Next each image had it’s own separate data file. Once done these data files were given to Weka for analysis. The decision tree the Weka produces is shown in figure 3.2.

Figure 3.2 Weka produced decision tree
In order to utilize this decision tree within the Nao’s vision code, this tree must be converted into multiple conditional statements in C++. Here is the code snippet that was added:
if (blue <= 95 && red > 84)
orangePixelCount++;
This fundamental is the decision tree. If the blue value has a pixel value of 59 or less and if the red value has a pixel value greater than 44, than an orange pixel value is found. In the vision code, if there is more than 30 found orange pixel values, than a ball is determined to be inside the image frame. Now the question is, does this decision tree improves the object recognition accuracy. This was tested by comparing the two different methods. One using the Weka decision tree code and the other code without. In the vision codes, there were drawing methods implemented in order to visually see how many orange pixel values were found in an image and where. The method using the Weka decision tree has blue dots drawn and the program without the decision tree has red dots drawn over the orange pixels found (Figure 3.3)

Figure 3.3 Comparison of Code with decision tree and without
Clearly the vision code using the decision tree produced by Weka (on the right) identifies more of the orange pixels on the ball. The precision on both codes are excellent however the recall on the code using the decision tree is significantly greater. Thusly Weka helps tremendously in color detection. A more in depth graph compares the accuracy and pixel values found. (Figure 3.4)

Figure 3.4 Weka Comparison Graph
Not only can Weka be utilized for robotic vision, it can also be used to figure out the best or most efficient tasks the Nao should perform. Decision trees are highly useful when paired with Artificial Intelligence.