OpenCV Stacy O’Malley CS-590 Summer, 2007
What is OpenCV? Open source library of functions relating to computer vision. Cross-platform (Linux, OS X, Win2K, WinXP). Originally developed by Intel. Free for commercial and research use (view license agreement).view license agreement
Uses Object Identification & Recognition (content-based image retrieval) Face recognition Gesture recognition Ego-motion (camera stabilization) Human Computer Interface (how to input/output visual information) Image Processing (image restoration, scene reconstruction)
Uses (cont’d) Mobile Robotics (controlling industrial robot, autonomous vehicle) Motion Tracking & Understanding (video surveillance) Structure from Motion (building a 3D model from video of a moving object) Modeling Objects or Environments (industrial inspection, medical image analysis, topographical modeling)
Installation Download OpenCV library from sourceforge. sourceforge Run the setup.exe to install OpenCV. Set up development environment. Tutorials/examples: CS Wiki OpenCV Wiki
Demo Load a color image. Convert an image color space. Convert an image from grayscale to binary. Find the contours in an image. Simple color segmentation.
Load a Color Image In order to perform any image processing, the image must be loaded first. Use function cvLoadImage to load an image from a specified file and return a pointer to the loaded image. Supported file formats: Windows bitmaps - BMP, DIB JPEG files - JPEG, JPG, JPE Portable Network Graphics - PNG Portable image format - PBM, PGM, PPM Sun rasters - SR, RAS TIFF files - TIFF, TIF
Convert Image Color Space Different devices use different color spaces so a conversion may be necessary for further image processing. Use function cvCvtColor to convert image from one color space to another.
Convert Image to Binary Binary images are produced to separate an object in the image from the background and/or for removing noise from the image. Use function cvThreshold to convert a grayscale image to a binary image.
Find Image Contours Finding the contours in an image is useful for connected component detection, shape analysis and object recognition. Use function cvFindContours to find contours in a binary image.
Simple Color Segmentation Images are segmented to distinguish objects from the background; it involves the classification of each image pixel to an image part. Use function cvKMeans2 to perform the K-Means clustering algorithm on the image.
Resources OpenCV Wiki OpenCV on Sourceforge OpenCV on Intel Website
OpenCV