Presentation on theme: "No soda cans were harmed in the production of this project RAT Soda can detection system What is it RAT is an attempt to create a system to detect any."— Presentation transcript:
No soda cans were harmed in the production of this project RAT Soda can detection system What is it RAT is an attempt to create a system to detect any soda cans in a given scene. Such a system could be used in an facility which discourages food and drink. The name RAT is used because of previous work done with the Psychology Department at the University of Nevada Reno, where a program called Mouse Vision was created to track the movements and behaviors of a mouse in a cage. The system is also designed to “rat out” anyone who is violating lab policy. The proof of concept phase The image on top shows the three initial targets for the system. The images on the right show the result of a simple color detection system. The results from this initial phase showed that detecting coke cans would be easiest. The tools and basis In avoid the need to directly use the Video for Linux API (V4L), the program was written as an extension to a program called Motion (http://motion.sourceforge.net)http://motion.sourceforge.net In its simplest form motion uses a standard webcam and a computer running Linux to detect motion, however it also has a large number of other functions and is very easy to modify. The program djpeg is also used to decode JPEG images into the PPM format, which is much easier to read and analyze. TrollTech's Qt was used to create the GUI interface for the utility ppmtail, which can be used to watch a running scan. How does it work RAT uses color segmentation and shape analysis to detect coke cans. The first stage of analysis analyzes colors and reduces the scene to a set of smaller regions. The first color analysis compares each pixel against a given base color. First the total difference between the color components of the target are summed up and then compared against a threshold. This produces fairly generous regions of detection, but filters out most of the scene. The second color filter compares the ratios of the components of the color (for example 2:1:1 to detect a light red). This approach reduces the number of regions drastically. The two filters compliment each other well. The first is sensitive to brightness and saturation but generous towards hue variations. The second is insensitive to brightness, but detects hue variation very easily. The image as masked by the two processes This produces two bit maps which are then intersected into one final bitmap of possible coke cans. The next phase processes the region for size, shape and solidity: - Any regions which are too small or too large are immediately culled, since we are assuming for simplicity that all coke cans will be held at a generous distance from the camera. This cuts out a lot of the single pixel noise artifacts. - A rectangle which encloses each region is found, and the area is calculated. This is compared to the number of pixels in the region. If they differ too much then the object does not fit well into a rectangle and is probably not a soda. - The ratio between the height and width of the previously calculated rectangle is checked against the observed ratio of soda cans. This way any stretched out or obtuse rectangular objects are culled out. After all of these processes have run on the list of regions, we assume anything left is a soda can. RAT in action: ppmtail explained: While running, the system continually writes the latest image to a file called scan.ppm, so you can see the results of the latest image processing. Ppmtail is a GUI program which views a given image file and reloads it every second, so it operates similar to running tail -f to watch a file as it is written to.