CURENT Education & Outreach

 Object Recognition and Feature Detection in Images Using MATLABSadhana Venkataraman – Farragut High SchoolYukai Tomsovic – West High SchoolMs. Gangotree ChakmaAbstract- Our goal in this project was to find an efficient way to extract information from pictures using MATLAB. MATLAB is a program that has many image processing capabilities and allows users to modify and edit images. We explored four of many image processing capabilities: Edge detection, shape detection, color segmentation, and feature detection. Image processing is used in many fields and will be used even more extensively in the future. INTRODUCTIONIn this age of technology, data collection is not only an extremely important component in all technical fields but also in all aspects of people’s daily lives. However, today, the real issue is becoming less about a lack of data and more about a lack of efficient methods to apply and represent that data. Images are one important source of data that is still in great need of more advanced methods to access the valuable information within. Through image processing, the number of ways one can utilize information stored in images is limitless. Currently, image processing is already being used in X-rays, MRIs, astronomy, robots, and much more. The relevance of image processing in our lives today is unquestionable, and the development of more precise methods of analyzing images can change the way we view the micro and macroscopic world.LITERATURE REVIEWThere are three main components of image processing: acquiring and importing the image, analyzing and manipulating it, and using this analysis to get a useful output that can be in the form of an image, a component of an image, or an analysis-based report (Anbarjafari). In order to successfully research all the components in image processing, we used many reliable resources, including MATLAB, our mentor, and several articles on the MathWorks website. We used these resources to explore the many capabilities of MATLAB and research their applications in different fields of work. Our research looks at four important abilities of image processing: edge detection, shape detection, color segmentation, and feature detection. We used edge detection and shape detection to find the edges of objects in images and to measure the properties of those objects. Our research examined color segmentation by grouping colors manually by specifying the pixel ranges and with k-means clustering. Finally, we researched feature detection, which can be used as a means of comparison between different images or objects. These features taught us about the practical uses of MATLAB’s image processing toolbox.METHOD & RESULTSEdge DetectionOur first step was to experiment with the edge detection capabilities of MATLAB. Edge detection is crucial to image processing as it is the foundation for more complicated image analysis processes. In order for MATLAB to successfully identify all the edges of objects in an image, the image must be converted to a binary image to create the necessary contrast between the object in the image and the image background. Otsu’s method creates a binary image by calculating a threshold that “minimizes intraclass variance of black and white pixels in a grayscale image” (“Global Image”). Using the threshold from Otsu’s Method, the function ‘im2bw’ converts all pixels greater than that threshold to a white pixel and all pixels lower than the threshold to a black pixel. This conversion creates the binary image in Figure 2. From the binary image, the function ‘bwlabel’ labels and counts the connected components. Each component, or object, can then be measured individually. 31718259525-1904928575Figure 1. Original imageFigure 2. Binary imageCalculating the area of each object in Figure 1 can identify the types of objects in the image, for if the area was small, MATLAB can recognize the object as a penny and as a quarter if the area was large. This feature is useful in robotics to teach robots to identify and count money. The same method used for the coins can be applied to images containing different shapes. In Figures 4-6, MATLAB converted the color image to a binary one. 20478756572254295775657225-76199695325 Figure 4. Original image Figure 5. Grayscale image Figure 6. Binary imageFigure 7. Code used to count shapes from Figure 6.400050123825Figure 8. Output after running code in Figure 7.55245066675Then, utilizing a range of area for each shape, MATLAB counts the number of objects that fall in the square shape area range of greater than 10000 pixels, the number of objects in the triangle shape area range, in this case between 7000 and 9000 pixels, and so on for the rest of the shapes. In Figure 8, the output of the code shows that there is one of each shape present in the image.Shape DetectionWhen an image contains clearly defined circles, MATLAB’s shape detection capabilities allow one to more accurately identify the shapes and thus, more accurately measure properties. The function ‘imdistline’ draws a line on the image that one can then use to measure the radii of the circles in terms of the number of pixels. Using this information, we set a threshold ranging from the radius of the smallest circle to the radius of the largest circle to ensure that MATLAB would find all the circles in that range. When using the ‘imfindcircles’ function , one must also change the object polarity in the code to ‘bright’ or ‘dark’ depending on whether the circle is lighter or darker than the background color. Figure 8. Original image Figure 9. Image after MATLAB found circles.As seen in Figure 8, MATLAB found most of the circles, but it did not find all of the yellow circles due to the lack of contrast between the foreground and background. This example gives some insight on the difficulty of image processing, for while variability in images may be easy for our eyes to detect, it is much more difficult for the computer to distinguish these subtle differences. Color SegmentationAfter identifying the shapes, it may also be useful to identify the color of the shapes. Using the pixel of the center point of each circle that found from before, one can determine how many circles of each color were present. This process is similar to identifying the shapes by their area from the edge detection examples. The function ‘impixel’ returns an array of three numbers, the last of which is the pixel of, in this case, the center of each circle. The if loop shown in Figure 10 means that if the center pixel is greater than 200 (line 27), for example, then that center pixel represents one blue circle. This process is repeated until all circles have been grouped into a category.Figure 10. Code for color segmentation by manually specifying pixel ranges30003750 Figure 11. Original image Figure 12. Image after circles are foundFigure 11 represents the original image, and Figure 12 shows the image after the circles have been found. This method is not perfect, for MATLAB failed to identify one of the red circles in the middle. In addition, many of the circles that MATLAB drew are not an exact outline of the circle in the picture, meaning it miscalculated the center of the circle. Despite these discrepancies, MATLAB correctly identified the number and color of the circles as seen in Figure 13. Figure 13. From left to right: yellow, green, red, blueFeature DetectionFeature detection can identify the similarities between two images and determine whether two images are the same (“Finding Corresponding”). We started by comparing two identical images but distorted one image by rotating and rescaling it. The ‘detectSURFFeatures’ and ‘extractFeatures’ functions in lines 15-18 identifies key features in both the original and the distorted image. Lines 19-21 finds the matching features between the sets given.Figure 12. Code for feature detectionOur next step was to find the corresponding points between both images. In order to do display the matching points, we wrote a code to tell MATLAB to display a color-coded overlay of the original and distorted images. Using the overlay, MATLAB located the same points on both images and connected them in order to recover the distorted image to look exactly like the original. We also wrote an if statement that would program MATLAB to tell us whether the two images were the same or different. 28860750 Figure 13. Original image Figure 14. Distorted image Figure 15. Overlay of original and distorted images Figure 16. Comparison of original and distorted 1238251418173095625376767 16097250 Figure 17. MATLAB tells us that the images are identicalMATLAB can also identify whether two pictures are different. In order to demonstrate this, we used pictures of two different fingerprints and used the same process. After trying to find similarities (Figure 18), MATLAB determines that the pictures are different (Figure 19). Figure 17. Image 1 Figure 18. Image 230331831691217Figure 19. MATLAB tells us that the images are different.3033183169121728670251117224 Figure 18. Overlay of original and distorted imagesDISCUSSIONImage processing techniques are currently being implemented in the medical field, astronomy, and even archaeology. Shape detection is used in medical imaging and screening to detect sickness based on cell shape, and color segmentation can distinguish different types of tissue, cells, and tumor borders. In addition, scientists and doctors use color segmentation in medical thermography to detect breast cancer, tendon or ligament injuries, and areas of poor blood circulation. Astronomers use image processing to detect patterns in waveforms and to classify stars and galaxies. Archaeologists also use image processing to find missing fossils or artifacts in their research. Through this research project one can see that while image processing influences many fields, this technology has not yet reached its limit of usefulness. In fact, image processing has barely been implemented in the real world considering its promising future. For example, future image processing projects include translating text from simply an image of that text, navigation systems for the visually impaired, facial recognition, and much more. Thus, the path forward can take a variety of forms. Image processing has the potential to completely change the way we view the world and approach problems, and this project gives some insight towards this potential. CONCLUSIONOur objective for this project was to find an automated, and therefore, quicker and more efficient, way to extract important data in images. We researched the fundamental image processing properties of MATLAB. The techniques we researched are the foundations for more advanced technology in various lines of work. This project also gave us an introduction to MATLAB and an understanding of its abilities, and we will continue to build upon what we have learned. Image processing techniques are getting more popular as time goes on, and it is very important for people in all fields to know how it can benefit. ACKNOWLEDGEMENTSWe would like to thank our mentor Ms. Gangotree Chakma for teaching us what we know about MATLAB and for being a huge help in this project. We would also like to thank Dr. Chen and Mr. Wills for giving us the opportunity to do this Young Scholars Program and learn about research and the research process. This work was supported in part by the Engineering Research Center Program of the National Science Foundation and the Department of Energy under NSF Award Number EEC-1041877 and the CURENT Industry Partnership Program. REFERENCESAnbarjafari, Gholamreza. "Introduction to Image Processing." Sisu@UT. University of Tartu, n.d. Web. 13 June 2016. "Color-Based Segmentation Using K-Means Clustering." Documentation. MathWorks, n.d. Web. 13 July 2016."Find Corresponding Interest Points Between Pair of Images." Documentation. MathWorks, n.d. Web. 15 July 2016."Global Image Threshold Using Otsu's Method." Documentation. MathWorks, n.d. Web. 12 July 2016."Object Counting." Documentation. MathWorks, n.d. Web. 15 July 2016. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download