Considering the issues with color detection method in the previous section method used for the image processing section of the project, the Image segmentation method was tested out. Considering that the tracking part of the system once the object is identified, the focus was given on understanding, implementing and testing the segmentation method. Some time was also spent to complete a go to goal swarm algorithm that was being developed for a while now.
Image segmentation
Segmentation is basically separating out certain sets of pixels for processing from a given image. For this implementation, a “Thresholding method” will be used to segment out the quadcopter from the background. The simplest way to go about this is to take a reference background image before the copter come into the area of search (i.e. the area directly in front of the camera). Correspondingly, a loop can be set up to do the following:
Like the color detection code, the video is produced by a while loop taking a certain number of snapshots, processing them and using the output and displaying the data in real time. In this technique, since a reference of the background is taken prior to the loop, it can be subtracted from the corresponding images leaving just the object of interest (it should be noted that the images must be converted to grayscale for the subtraction, to remove the color components from the image). Then using a threshold brightness value of pixels, the image is converted to binary where the object is highlighted. Some further process is needed to clear out some noise. The following is a set of images showing this process in action.
Testing out this technique showed promising results where the copter was tracked successfully for longer distances (about 10 ft before I ran out of space to fly the bot). The bot was still being detect as it moved and looked blurry in the snaps.
However, in the same tests, a drawback of this technique was seen as the shadow of the bot on the wall in the background caused some it to be seen as an object. This was easily corrected though by filtering out objects that are larger that the size that the bot can be. This is a risky fix though as under certain conditions the shadows may be smaller, or as the bots go further away, they may become too small and be filtered out so perhaps a physical solution would be better (ensure the light source is directly above or perhaps a darker background).
As positive as the results are, some more techniques will be tested out as well to find out if there can be a better and more accurate mode of detection. During this time, the segmentation will be pushed to the limits and to try and see if more issues like the shadows pop-up.
Note: In Matlab 2014b, the image acquisition is missing and must be downloaded separately. This can be done in Matlab Command window>Add-ons>Get Hardware Packages>Install from Internet>OS Generic Video Interface.
0 Comments