An Implementation on Object Move Detection Using OpenCV

Similar documents
Object Move Controlling in Game Implementation Using OpenCV

Building Detection. Guillem Pratx LIAMA. 18 August BACKGROUND 2 2. IDEA 2

University of Cambridge Engineering Part IIB Module 4F12 - Computer Vision and Robotics Mobile Computer Vision

Last update: May 4, Vision. CMSC 421: Chapter 24. CMSC 421: Chapter 24 1

CS4670: Computer Vision

ECE 172A: Introduction to Intelligent Systems: Machine Vision, Fall Midterm Examination

Analysis of Image and Video Using Color, Texture and Shape Features for Object Identification

Edge and corner detection

Local Image preprocessing (cont d)

Object Recognition Tools for Educational Robots

SUMMARY: DISTINCTIVE IMAGE FEATURES FROM SCALE- INVARIANT KEYPOINTS

Leow Wee Kheng CS4243 Computer Vision and Pattern Recognition. Motion Tracking. CS4243 Motion Tracking 1

REAL-TIME PATTERN RECOGNITION

BSB663 Image Processing Pinar Duygulu. Slides are adapted from Selim Aksoy

Local features: detection and description. Local invariant features

Laboratory of Applied Robotics

Biometrics Technology: Image Processing & Pattern Recognition (by Dr. Dickson Tong)

CS5670: Computer Vision

EXAM SOLUTIONS. Image Processing and Computer Vision Course 2D1421 Monday, 13 th of March 2006,

Computer and Machine Vision

Progress Report of Final Year Project

A Comparison of SIFT and SURF

Digital Image Processing COSC 6380/4393

Computer Science Faculty, Bandar Lampung University, Bandar Lampung, Indonesia

Edge Detection. Today s reading. Cipolla & Gee on edge detection (available online) From Sandlot Science

Advanced Video Content Analysis and Video Compression (5LSH0), Module 4

Local Feature Detectors

Robotics Programming Laboratory

Edge detection. Goal: Identify sudden. an image. Ideal: artist s line drawing. object-level knowledge)

Complex Sensors: Cameras, Visual Sensing. The Robotics Primer (Ch. 9) ECE 497: Introduction to Mobile Robotics -Visual Sensors

CS 378: Autonomous Intelligent Robotics. Instructor: Jivko Sinapov

Lecture 6: Edge Detection

ME132 February 3, 2011

Image Processing (1) Basic Concepts and Introduction of OpenCV

Character Recognition from Google Street View Images

Outline 7/2/201011/6/

Harder case. Image matching. Even harder case. Harder still? by Diva Sian. by swashford

Image Processing

PERFORMANCE CAPTURE FROM SPARSE MULTI-VIEW VIDEO

Features Points. Andrea Torsello DAIS Università Ca Foscari via Torino 155, Mestre (VE)

Object Recognition Algorithms for Computer Vision System: A Survey

Eppur si muove ( And yet it moves )

Computer Vision. Recap: Smoothing with a Gaussian. Recap: Effect of σ on derivatives. Computer Science Tripos Part II. Dr Christopher Town

Image Features: Local Descriptors. Sanja Fidler CSC420: Intro to Image Understanding 1/ 58

EECS150 - Digital Design Lecture 14 FIFO 2 and SIFT. Recap and Outline

The NAO Robot, a case of study Robotics Franchi Alessio Mauro

CSCI 4974 / 6974 Hardware Reverse Engineering. Lecture 20: Automated RE / Machine Vision

Software Specification Document. for. Crowd_Count++ Version 1.0 November Prepared by: Juan Mejia Michael Safdieh Rosario Antunez

(Sample) Final Exam with brief answers

Edge Detection (with a sidelight introduction to linear, associative operators). Images

Edge and Texture. CS 554 Computer Vision Pinar Duygulu Bilkent University

CS4495/6495 Introduction to Computer Vision

[ ] Review. Edges and Binary Images. Edge detection. Derivative of Gaussian filter. Image gradient. Tuesday, Sept 16

Image matching. Announcements. Harder case. Even harder case. Project 1 Out today Help session at the end of class. by Diva Sian.

Scene Text Detection Using Machine Learning Classifiers

Harder case. Image matching. Even harder case. Harder still? by Diva Sian. by swashford

A New Algorithm for Shape Detection

FPGA IMPLEMENTATION FOR REAL TIME SOBEL EDGE DETECTOR BLOCK USING 3-LINE BUFFERS

Local Features: Detection, Description & Matching

Active Stereo Vision. COMP 4900D Winter 2012 Gerhard Roth

Programming and Pictures: Computational Photography and Applications to Math and Physics. GISA 2016 Session 131 Marist School Christopher Michaud

The SIFT (Scale Invariant Feature

Nonlinear State Estimation for Robotics and Computer Vision Applications: An Overview

Edges and Binary Images

Lecture 12 Recognition

Motion in 2D image sequences

Interactive Virtual Environments

Designing Applications that See Lecture 7: Object Recognition

Local features: detection and description May 12 th, 2015

3D Environment Reconstruction

Midterm Wed. Local features: detection and description. Today. Last time. Local features: main components. Goal: interest operator repeatability

Comparison of Some Motion Detection Methods in cases of Single and Multiple Moving Objects

HISTOGRAMS OF ORIENTATIO N GRADIENTS

Peripheral drift illusion

Edge detection. Winter in Kraków photographed by Marcin Ryczek

Object Recognition. Lecture 11, April 21 st, Lexing Xie. EE4830 Digital Image Processing

Final Review CMSC 733 Fall 2014

Image processing and features

Face and Nose Detection in Digital Images using Local Binary Patterns

Image features. Image Features

Introduction to Medical Imaging (5XSA0)

CSE152 Introduction to Computer Vision Assignment 3 (SP15) Instructor: Ben Ochoa Maximum Points : 85 Deadline : 11:59 p.m., Friday, 29-May-2015

Implementation and Comparison of Feature Detection Methods in Image Mosaicing

Effects Of Shadow On Canny Edge Detection through a camera

Photoneo's brand new PhoXi 3D Camera is the highest resolution and highest accuracy area based 3D

Final Exam Study Guide

SIFT: SCALE INVARIANT FEATURE TRANSFORM SURF: SPEEDED UP ROBUST FEATURES BASHAR ALSADIK EOS DEPT. TOPMAP M13 3D GEOINFORMATION FROM IMAGES 2014

Case Study: Attempts at Parametric Reduction

Feature descriptors and matching

EE368 Project Report CD Cover Recognition Using Modified SIFT Algorithm

Large-Scale Traffic Sign Recognition based on Local Features and Color Segmentation

Prof. Feng Liu. Winter /15/2019

Computer and Machine Vision

Computer and Machine Vision

Available online at ScienceDirect. Procedia Computer Science 22 (2013 )

Edge Detection. CS664 Computer Vision. 3. Edges. Several Causes of Edges. Detecting Edges. Finite Differences. The Gradient

CHAPTER 1 Introduction 1. CHAPTER 2 Images, Sampling and Frequency Domain Processing 37

Multimedia Computing: Algorithms, Systems, and Applications: Edge Detection

Edge Detection. Announcements. Edge detection. Origin of Edges. Mailing list: you should have received messages

Practice Exam Sample Solutions

Transcription:

An Implementation on Object Move Detection Using OpenCV Professor: Dr. Ali Arya Reported by: Farzin Farhadi-Niaki Department of Systems and Computer Engineering Carleton University Ottawa, Canada I. INTRODUCTION Computer vision is a rapidly growing field, partly as a result of both cheaper and more capable cameras, partly because of affordable processing power, and partly because vision algorithms are starting to mature. OpenCV itself has played a role in the growth of computer vision by enabling thousands of people to do more productive work in vision. With its focus on real-time vision, OpenCV helps students and professionals efficiently implement projects and jump-start research by providing them with a computer vision and machine learning infrastructure that was previously available only in a few mature research labs. II. METHODOLOGY Computer vision is the transformation of data from a still or video camera into either a decision or a new representation. All such transformations are done for achieving some particular goal. The input data may include some contextual information such as "the camera is mounted in a car" or "laser range finder indicates an object is 1 meter away". The decision might be "there is a person in this scene" or "there are 14 tumor cells on this slide". A new representation might mean turning a color image into a grayscale image or removing camera motion from an image sequence. For robotics, we need object recognition (what) and object location (where): a) Object recognition In OpenCV, there are a wide range of approaches to detect an object; the techniques such as: convolution/filters, thresholds, histogram and matching, contours, efficient nearest neighbour matching to recognize objects using huge learned databases of objects, etc. b) Object location camshaft tracking, structure from motion using SIFT descriptor and SURF gradient histogram grids, or just simply finding the edge of the object and momentarily checking the location of object s centre on pixel by pixel based movement. A. Convolution Convolution is the basis of many of the transformations. In the abstract, this term means something we do to every part of an image. What a particular convolution "does" is determined by the form of the Convolution kernel being used. This kernel is essentially just a fixed size array of numerical coefficients along with an anchor point in that array, which is typically located at the center. The size of the array is called the support of the kernel. We can express this procedure in the form of an equation. If we define the image to be I(x, y), the kernel to be G(i, j) (where 0 < i < M i 1 and 0 < j < M j 1), and the anchor point to be located at (a i, a j ) in the coordinates of the kernel, then the convolution H(x, y) is defined by the following expression: B. Canny The most significant new dimension to the Canny algorithm is that it tries to assemble the individual edge candidate pixels into contours. These contours are formed by applying a hysteresis threshold to the pixels. This means that there are two thresholds, an upper and a lower. If a pixel has a gradient larger than the upper threshold, then it is accepted as an edge pixel; if a pixel is below the lower threshold, it is rejected. If the pixel's gradient is between the thresholds, then it will be accepted only if it is connected to a pixel that is above the high threshold. Again, in OpenCV, there are various techniques for finding the object location, e.g. background subtraction (to find the moving objects), corner finding, optical flow, mean-shift and

void cvcanny( const CvArr* img, CvArr* edges, double lowthresh, double highthresh, int aperturesize = 3 The cvcanny() function expects an input image, which must be grayscale, and an output image, which must also be grayscale. C. Threshold double cvthreshold( CvArr* src, CvArr* dst, double threshold, double max_value, int threshold_type Frequently we have done many layers of processing steps and want either to make a final decision about the pixels in an image or to categorically reject those pixels below or above some value while keeping the others. The OpenCV function cvthreshold() accomplishes these tasks. The basic idea is that an array is given, along with a threshold, and then something happens to every element of the array depending on whether it is below or above the threshold. The cvthreshold() function handles only 8-bit or floating-point grayscale source images. CV_THRESH_BINARY_INV dst i = (src i > T)? M : 0 Fig. 1. Each threshold type corresponds to a particular comparison operation between the i th source pixel (src i) and the threshold (denoted in the table by T). Depending on the relationship between the source pixel and the threshold, the destination pixel dst i may be set to 0, the src i, or the max_value (denoted in the table by M). cvadaptivethreshold() allows for two different adaptive threshold types depending on the settings of adaptive_method. In both cases the adaptive threshold T(x, y) is set on a pixel-by-pixel basis by computing a weighted average of the b-by-b region around each pixel location minus a constant, where b is given by block_size and the constant is given by param1. If the method is set to CV_ADAPTIVE_THRESH_MEAN_C, then all pixels in the area are weighted equally. If it is set to CV_ADAPTIVE_THRESH_GAUSSIAN_C, then the pixels in the region around (x, y) are weighted according to a Gaussian function of their distance from that center point. The adaptive threshold technique is useful when there are strong illumination or reflectance gradients that we need to threshold relative to the general intensity gradient. This function handles only single-channel 8-bit or floating-point images, and it requires that the source and destination images be distinct. D. Adaptive Threshold There is a modified threshold technique in which the threshold level is itself variable. In OpenCV, this method is implemented in the cvadaptivethreshold() function: void cvadaptivethreshold( CvArr* src, CvArr* dst, double max_val, int adaptive_method = CV_ADAPTIVE_THRESH_MEAN_C, int threshold_type = CV_THRESH_BINARY, int block_size = 3, double param1 = 5 Fig. 2. Binary threshold versus adaptive binary threshold: the input image (top) was turned into a binary image using a global threshold (lower left) and an adaptive threshold (lower right raw image courtesy of Kurt Konolidge.

E. Contours Although algorithms like the Canny edge detector can be used to find the edge pixels that separate different segments in an image, they do not tell us anything about those edges as entities in themselves. The next step is to be able to assemble those edge pixels into contours. cvfindcontours()is a convenient function in OpenCV that will do exactly this for us. Specifically, with assigning memory storages, OpenCV functions gain access to memory when they need to construct new objects dynamically; then we will need to use sequences (as something similar to the generic container classes), which are the objects used to represent contours generally. With those concepts in hand, we will get into contour finding. A contour is a list of points that represent a curve in an image. Contours are represented in OpenCV by sequences in which every entry in the sequence encodes information about the location of the next point on the curve. The function cvfindcontours() computes contours from binary images. It can take images created by cvcanny(), which have edge pixels in them, or images created by functions like cvthreshold() or cvadaptivethreshold(), in which the edges are implicit as boundaries between positive and negative regions. Drawing a contour on the screen using cvdrawcontours() function is the next step. Here we create a window with an image in it. A trackbar sets a simple threshold, and the contours in the thresholded image are drawn. The image is updated whenever the trackbar is adjusted. Fig. 4. Trackbars for up and down thresholds. 4) Finding the edge of the object using Canny or Threshold (Adaptive Threshold) functions (Fig. 5). 5) Creating dynamic structure and sequence for the contours, and finding the current location (x, y) of the object s centre after finding its contours. 6) Finally, drawing and detecting the object s move, in two ways: III. RESULTS AND DISCUSSIONS In this project, using OpenCV, we have tried to implement a simulation of object move detection (Fig. 3). The procedure of requirements for this implementation has the following steps: 1) Capturing the image as a frame from a camera. 2) Converting the image/frame to 8-bits grayscale image to be compatibly usable in some filters like Canny. 3) Creating trackbars for up and down thresholds (Fig. 4). Fig. 5. Edge of the object. Fig. 3. The project result (including four windows). Fig. 6. Hot keys of instruction.

Fig. 7. Drawing the centre point of the object in move. a) Detecting the average move and direction (one of four: left, right, up, down), after the object passes a minimum distance threshold and comes back to the threshold area. Fig. 10. Result sample: average Left and Up. b) Detecting the highest move and direction (one of four: left, right, up, down), after the object passes a maximum distance threshold. Fig. 8. Result sample: average Right and Up. Fig. 11. Result sample: highest Left. Fig. 9. Result sample: average Right and Bottom. Fig. 12. Result sample: highest Right.

IV. CONCLUSION Computer vision applications are growing rapidly, from product inspection to image and video indexing on the Web to medical applications and even to local navigation on Mars. OpenCV is also growing to accommodate these developments. One of the key new development areas for OpenCV is robotic perception. This effort focuses on 3D perception as well as 2D plus 3D object recognition since the combination of data types makes for better features for use in object detection, segmentation and recognition. Robotic perception relies heavily on 3D sensing, so efforts are under way to extend camera calibration, rectification and correspondence to multiple cameras and to camera plus laser rangefinder combinations. Creating capable robots subsumes most fields of computer vision and artificial intelligence, from accurate 3D reconstruction to tracking, identifying humans, object recognition, and image stitching and on to learning, control, planning, and decision making. Any higher-level task, such as planning, is made much easier by rapid and accurate depth perception and recognition. It is in these areas especially that OpenCV hopes to enable rapid advance by encouraging many groups to contribute and use ever better methods to solve the difficult problems of real-world perception, recognition, and learning. OpenCV will, of course, support many other areas as well, from image and movie indexing on the web to security systems and medical analysis. The wishes of the general community will heavily influence OpenCV's direction and growth. There is a worldwide community of interactive artists who use OpenCV so that viewers can interact with their art in dynamic ways. The most commonly used routines for this application are face detection, optical flow, and tracking. The focused effort on improving object recognition will allow different modes of interacting with art, because objects can then be used as modal controls. With the ability to capture 3D meshes, it may also be possible to "import" the viewer into the art and so allow the artist to gain a better feel for recognizing user action; this, in turn, could be used to enhance dynamic interaction. The needs and desires of the artistic community for using computer vision will receive enhanced priority in OpenCV's future. A group of manufacturers are aiming to develop cellphone projectors perfect for robots, because most cell phones are lightweight, low-energy devices whose circuits already include an embedded camera. This opens the way for close-range portable structured light and thereby accurate depth maps, which are just what we need for robot manipulation and 3D object scanning. Computer vision has a rich future ahead, and it seems likely to be one of the key enabling technologies for the 21st century. Likewise, OpenCV seems likely to be (at least in part) one of the key enabling technologies for computer vision. Endless opportunities for creativity and profound contribution lie ahead. REFERENCES [1] Bradski, G., Kaehler, A. 2008, Learning OpenCV: Computer Vision with the OpenCV Library. O Reilly Media Inc., Sebastopol, CA.