Comparison between Open CV and MATLAB Performance in Real Time Applications MATLAB)

Similar documents
Comparison between Open CV and MATLAB Performance in Real Time Applications MATLAB)

IMAGE PROCESSING PROJECT REPORT NUCLEUS CLASIFICATION

Image Enhancement using Histogram Equalization and Spatial Filtering

Computing for Engineers in Python

CSE 564: Scientific Visualization

Area Extraction of beads in Membrane filter using Image Segmentation Techniques

Fast identification of individuals based on iris characteristics for biometric systems

8.2 IMAGE PROCESSING VERSUS IMAGE ANALYSIS Image processing: The collection of routines and

Scrabble Board Automatic Detector for Third Party Applications

SECTION I - CHAPTER 2 DIGITAL IMAGING PROCESSING CONCEPTS

Image Processing for feature extraction

PRACTICAL IMAGE AND VIDEO PROCESSING USING MATLAB

An Adaptive Kernel-Growing Median Filter for High Noise Images. Jacob Laurel. Birmingham, AL, USA. Birmingham, AL, USA

CoE4TN4 Image Processing. Chapter 3: Intensity Transformation and Spatial Filtering

Implementation of License Plate Recognition System in ARM Cortex A8 Board

Image Processing : Introduction

An Efficient Color Image Segmentation using Edge Detection and Thresholding Methods

Digital Image Processing

Real-Time Face Detection and Tracking for High Resolution Smart Camera System

Multi-Image Deblurring For Real-Time Face Recognition System

Retinal blood vessel extraction

VLSI Implementation of Impulse Noise Suppression in Images

License Plate Localisation based on Morphological Operations

Image processing for gesture recognition: from theory to practice. Michela Goffredo University Roma TRE

Image Quality Assessment for Defocused Blur Images

Real Time Video Analysis using Smart Phone Camera for Stroboscopic Image

Preparing Remote Sensing Data for Natural Resources Mapping (image enhancement, rectifications )

Keywords Fuzzy Logic, ANN, Histogram Equalization, Spatial Averaging, High Boost filtering, MSE, RMSE, SNR, PSNR.

Non Linear Image Enhancement

COMPREHENSIVE EXAMINATION WEIGHTAGE 40%, MAX MARKS 40, TIME 3 HOURS, DATE Note : Answer all the questions

Image Forgery. Forgery Detection Using Wavelets

Restoration of Motion Blurred Document Images

MAV-ID card processing using camera images

CSE 564: Visualization. Image Operations. Motivation. Provide the user (scientist, t doctor, ) with some means to: Global operations:

Teaching Scheme. Credits Assigned (hrs/week) Theory Practical Tutorial Theory Oral & Tutorial Total

The KNIME Image Processing Extension User Manual (DRAFT )

1.Discuss the frequency domain techniques of image enhancement in detail.

IMPLEMENTATION OF CANNY EDGE DETECTION ALGORITHM ON REAL TIME PLATFORM

ME 6406 MACHINE VISION. Georgia Institute of Technology

Computer Vision Based Ball Catcher

COMPARITIVE STUDY OF IMAGE DENOISING ALGORITHMS IN MEDICAL AND SATELLITE IMAGES

Part I Feature Extraction (1) Image Enhancement. CSc I6716 Spring Local, meaningful, detectable parts of the image.

Lane Detection in Automotive

New Spatial Filters for Image Enhancement and Noise Removal

International Journal of Advance Engineering and Research Development CONTRAST ENHANCEMENT OF IMAGES USING IMAGE FUSION BASED ON LAPLACIAN PYRAMID

Automated Driving Car Using Image Processing

A Spatial Mean and Median Filter For Noise Removal in Digital Images

Malaysian Car Number Plate Detection System Based on Template Matching and Colour Information

Lane Detection in Automotive

Follower Robot Using Android Programming

Computer Graphics Fundamentals

Historical Document Preservation using Image Processing Technique

Image Denoising using Filters with Varying Window Sizes: A Study

Checkerboard Tracker for Camera Calibration. Andrew DeKelaita EE368

Color Transformations

A Proficient Roi Segmentation with Denoising and Resolution Enhancement

An Evaluation of Automatic License Plate Recognition Vikas Kotagyale, Prof.S.D.Joshi

LAB MANUAL SUBJECT: IMAGE PROCESSING BE (COMPUTER) SEM VII

TurboDrive. With the recent introduction of the Linea GigE line scan cameras, Teledyne DALSA is once again pushing innovation to new heights.

A Proficient Matching For Iris Segmentation and Recognition Using Filtering Technique

Computer Vision. Howie Choset Introduction to Robotics

INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET

IMAGE ENHANCEMENT - POINT PROCESSING

Assistant Lecturer Sama S. Samaan

Introduction. Computer Vision. CSc I6716 Fall Part I. Image Enhancement. Zhigang Zhu, City College of New York

More image filtering , , Computational Photography Fall 2017, Lecture 4

Fast and High-Quality Image Blending on Mobile Phones

Feature Extraction Techniques for Dorsal Hand Vein Pattern

A Novel Approach of Compressing Images and Assessment on Quality with Scaling Factor

Image Enhancement in Spatial Domain

Guided Image Filtering for Image Enhancement

CellSpecks: A Software for Automated Detection and Analysis of Calcium

Research on Pupil Segmentation and Localization in Micro Operation Hu BinLiang1, a, Chen GuoLiang2, b, Ma Hui2, c

Face Detection System on Ada boost Algorithm Using Haar Classifiers

Table of contents. Vision industrielle 2002/2003. Local and semi-local smoothing. Linear noise filtering: example. Convolution: introduction

An Approach for Reconstructed Color Image Segmentation using Edge Detection and Threshold Methods

Segmentation of Liver CT Images

Image Smoothening and Sharpening using Frequency Domain Filtering Technique

Hybrid Method based Retinal Optic Disc Detection

Design of Temporally Dithered Codes for Increased Depth of Field in Structured Light Systems

An Efficient DTBDM in VLSI for the Removal of Salt-and-Pepper Noise in Images Using Median filter

Solution for Image & Video Processing

An Efficient Noise Removing Technique Using Mdbut Filter in Images

IDENTIFICATION OF SIGNATURES TRANSMITTED OVER RAYLEIGH FADING CHANNEL BY USING HMM AND RLE

System and method for subtracting dark noise from an image using an estimated dark noise scale factor

Midterm Examination CS 534: Computational Photography

Brain Tumor Segmentation of MRI Images Using SVM Classifier Abstract: Keywords: INTRODUCTION RELATED WORK A UGC Recommended Journal

A Global-Local Contrast based Image Enhancement Technique based on Local Standard Deviation

GE 113 REMOTE SENSING. Topic 7. Image Enhancement

Image Processing COS 426

Automatic Morphological Segmentation and Region Growing Method of Diagnosing Medical Images

Refined Slanted-Edge Measurement for Practical Camera and Scanner Testing

PARAMETRIC ANALYSIS OF IMAGE ENHANCEMENT TECHNIQUES

Fake Impressionist Paintings for Images and Video

Keywords: - Gaussian Mixture model, Maximum likelihood estimator, Multiresolution analysis

Chapter 6. [6]Preprocessing

Spring 2005 Group 6 Final Report EZ Park

A NOVEL APPROACH FOR CHARACTER RECOGNITION OF VEHICLE NUMBER PLATES USING CLASSIFICATION

University of Technology Building & Construction Department / Remote Sensing & GIS lecture

An Improved Binarization Method for Degraded Document Seema Pardhi 1, Dr. G. U. Kharat 2

Transcription:

Anaz: Comparison between Open CV and MATLAB Performance in Real Time -- Comparison between Open CV and MATLAB Performance in Real Time Applications Ammar Sameer Anaz Diyaa Mehadi Faris ammar3303@gmail.com d.mfaris@yahoo.com Department of Computer Engineering Technical College / Mosul Abstract: The most important operation in the image processing field is detect the objects inside an image or video, which it is used in many applications, especially in real time systems. Real time image processing in modern systems demands fast technologies, and there are variety methods to achieve this goal. This paper compare between the performance of (MATLAB) and (Open CV) to detect circular shapes that have specific color (blue) from live video in a real time. The input is a live video with resolution (640*480) pixels, taken by a web camera, and then processed by a sequence of image processing operations. The results refer to a program written in (Open CV) speed up the system up to 174% more than the same program written in (MATLAB) to do the same job. Keywords: Image processing, Open CV, MATLAB MATLAB Open CV : MATLAB). (Open CV) (480*640 (%174 (Open CV) MATLAB) Received: 13 5-2014 Accepted: 15 8-2015 183

Al-Rafidain Engineering Vol. 23 No. 4 October 2015 1. INTRODUCTION Nowadays, images and videos are all over the world, and the demand for high-speed and convenient real time processing for these images and videos is increased, especially after the development in digital communications and digital images devices. An efficient real time system is needed to extract more information from images and videos. Matuska et al. in 2012 used images with various resolution, to calculate CPU Time consumption for image processing algorithm in MATLAB and Open CV. The results of their work show that Open CV is faster than MATLAB in some algorithm from 4 to 30 times and in some case up to 100 times [1]. Sharmila et al. in 2015 propose image conversion function, and test it on various images for data conversion and contrast stretching by using Open CV and MATLAB. The final calculation reveals the MATLAB code consumes more time for the same conversion. Moreover, the total time taken for the conversion in Open CV falls less than three seconds [2]. In this paper, the input frame from the camera is segmented to pick up the target color (blue), after that smooth the resultant image to reduce noise, and at the end circles detect. The rest of the paper is structured as follows: Section 2 discusses image processing steps, starting by frame reading, segmentation, smoothing, and ended by circular Hough transforms. Section 3 introduces Steps of work, in Section 4 the results and calculation of the comparison between MATLAB and OpenCV approaches. The conclusions are introduced in Section 5. Section 6 indicates References. At the time of writing, the latest release is Open CV v.2.4.7 and MATLAB R2013a (8.1.0.604) where available and used in this paper. 2. IMAGE PROCESSING The block diagram in Figure (1) describes the sequence of image processing system, which is used to process live video from web camera. First, the system read a frame form input device (web camera). Then separate a specific color by using histogram segmentation and multi-level Read a frame thresholding. After that, smooth the resultant frame by Gaussian filter. Finally, apply a circular Hough transform function to detect circular object inside the frame. Image segmentation 2.1.Read a Frame The first step in any system that interact with real time video processing is reading the frame from an input device, the decrease in reading time leads to increase system efficiency. This paper is started by calculating the time conception in reading the frame from input device. Then made a comparison to find out, which is the best programing language (MATLAB or Open CV) to do that. The camera specifications that used as input device are listed in table (1). Table (1): The camera specifications Image smoothing Circle Hough transform Figure (1): The block diagram of image processing system Frame rate Video format Resolution 30 fps (frame per second) Mp4 640*480 pixel 184

Anaz: Comparison between Open CV and MATLAB Performance in Real Time -- 2.2.Image Segmentation Image segmentation is the separation of an image into categories or regions, which belong to different objects or parts of items. Every pixel in an image is classified to one of a number of these categories, a segmentation should meet the following requirements: 1. Pixels in the same category have analogous grayscale of multivariate values and form a connected region. 2. Adjacent pixels, which have different categories, have different values. Segmentation often is the significant step in image analysis, there is something should be taken in consideration, each pixel as a unit of observation to working with objects (or parts of objects) in the image, composed of numerous pixels. If segmentation is done fine then all other stages in image analysis are made simpler [5]. 2.2.1.Color image segmentation by multi-level thresholding Global histogram of a digital image is a popular tool for real- time image processing due to its simplicity in implementation. It serves as an important basis of statistical approaches in image processing by producing the global description of the image s information. In color image segmentation, color of a pixel is given as three values corresponding to the three component images red, green and blue (RGB). Component histograms provide additional information about the intensity distribution within the individual color channels. When computing component histograms, each color channel is considered a separate intensity image and each histogram is computed independently of the other channels [6]. Thresholding is the simplest and most generally used way for segmentation, specified a threshold value (T), or two values ( and for multi-level thresholding. The pixel located at pattern position (i,j), thresholding creates a binary image b(i,j) from an intensity image I(i,j), The multi-level thresholding is described in the following equation [3] [7].. (1) In this paper, histogram segmentation by multilevel threshold is applied directly to each component of a color space, and then the results is combined to obtain a final segmentation result. The threshold values of each color space, which is used in this paper, are shown in table (2). Table (2): The thresholds values Red 0 70 Green 70 170 2.3.Image Smoothing Smoothing, also called blurring, is a simple and normally used image processing operation. There are many reasons for smoothing, but it is typically done to reduce noise or camera artifacts. Smoothing is also important to reduce the resolution of an image in a principled way. In practice, some different types of noise usually companied in image. Noise is a pixel that vary from its actual value in an image. Noise happen in digital image, while transmit image on computer networks, or pixel value in image obtained by image input devices that does not express the actual intensity from real scene produces noise [8]. Therefore, a respectable image smoothing algorithm should be able to deal with different types of noise. However, blur and offsets of the edges regularly caused by image smoothing. 185 Blue 165 255

Al-Rafidain Engineering Vol. 23 No. 4 October 2015 In image analysis and interpretation the edge information is much imperative. So, the precision of edge's position in image should be considered in smoothing process. [9]. 2.3.1.Gaussian smoothing filter. This type of smoothing used to 'blur' images to remove noise by a two dimensions convolution operation, as a 'point-spread' function. The need to produce a discrete approximation to the Gaussian function before convolution can performed, because of the image is stored as a collection of separate pixels. The Gaussian smoothing can be applied using standard convolution methods, the function of Gaussian smoothing showed below [8] [10]:.. (2) Where x and y are the spatial dimensions, while is the standard deviation of the Gaussian distribution. In this paper, the Gaussian filter is used as a smoothing filter, with values; x =9, y = 9, and = 0.1. 2.4. Circular Hough Transforms One of the most frequently used algorithms to recognize different shapes in an image is Hough Transform. Hough Transform was invented by Paul Hough in 1962 and patented by IBM. Later then in 1972 Hough transform was modified, which is used commonly in the present day under the name Generalized Hough Transform. An extended form of General Hough Transform, used to identify circles is Circular Hough Transform. A flow-chart of circular Hough transform is shown in Figure (2). The edge detected from the Canny edge detector forms the input to extract the circle using the circular Hough transform [11]. Input Image Edge Detected Parameter Representation Coordinates of center point and radius Accumulator Figure (2): Flow-chart of circular Hough Transform 2.4.1.Parameter representation: The equation of the circle is:.. (3) As can be seen there are three parameters in the equation: a, b and r. where: a, and b are the center of the circle in the x & y coordinates respectively and r is the radius. The factor representation of the circle is [12]:... (4) (5) 186

Anaz: Comparison between Open CV and MATLAB Performance in Real Time -- 2.4.2.Accumulator: As shown in Figure (3) the black circles represents a set of edge points within the image. Each edge point contributes a circle of radius to an output accumulator space indicated by the dotted circles. The output accumulator space has a peak where these contributed circles with desired radius overlap at the center of the original circle [13]. Figure (3): Illustration of circular Hough transform 3. STEPS OF WORK The flow chart in Figure (4) describe the processing sequence and Figure (5) show the output from each step. Start Read frame from camera Segmentation using multilevel thresholding Smoothing using Gaussian filter Circular Hough Transforms Display the final frame No Circle founded? Yes Draw a red circle on the inputted frame by using center point and radius Figure (4): Flow-chart of processing steps 187

Al-Rafidain Engineering Vol. 23 No. 4 October 2015 A ball with a blue color as shown in Figure (5 - a) is used as a target object in this paper. The position and distance of the ball are altered every time during the computing of the time for each step in random form. The tic-toc instructions in MATLAB were used to calculate the time of the execution in the space of seconds. While in Open CV (C++ language) clock_t function from time.h header was used to store the processor time, then the starting time was subtracted from the ending time to get the execution time, this had been done for each step of the processing. The time taken in the space of milliseconds in C++, so the results obtained from MATLAB converted to milliseconds to achieve maximum accuracy. In every stage of the process, the execution time was calculated for hundreds of iterations then average time was found in milliseconds for each step in both programs (MATLAB and Open CV). Finally the two average times of each processing stage for MATLAB and Open CV was compared. a Frame reading c Smoothing b Segmentation d Circle Hough transform Figure (5): The results of processing stages 188

Anaz: Comparison between Open CV and MATLAB Performance in Real Time -- 4. RESULTS AND CALCULATION Comparison between MATLAB and Open CV: reading the frame from input device and histogram segmentation by multi-level thresholding was applied. After that, the resultant image will be smoothed by Gaussian filter, and then processed by Hough transform filter. The average time was calculated in millisecond for each step of execution, and the results are showed in Table (3) and Figure (6). Table (3): The results Frame reading Segmentation Smoothing Hough transform MATLAB 521.333 40.186 957.733 709.466 OpenCV 422.266 13.466 18.133 31.066 Time in Millisecond 1000 900 800 700 600 500 400 300 200 100 0 Fram reading Segmentation Smoothing Hough transform MATLAB OpenCV Figure (6): Illustration of results The results show that, the Open CV is faster than the MATLAB by about: A. 10% in reading frame from the camera. B. 2.6% in segmentation step. C. 94% in smoothing step. D. 68% in Hough Transform step. Hence, the overall speedup ratio is about 174%. The main reason of the OpenCV processing speed in image processing is that, in MATLAB it is not necessary to care about memory allocation and memory leak, but it is very important task in every processing stage in Open CV. The effect of memory allocation is showed clearly in tasks that require more memory to process like smoothing and circle Hough transform process. In addition, MATLAB is a pretty high-level scripting language, and it is built on Java, and Java is built upon C. Therefore, when run the MATLAB program, the computer is busy trying to interpret all that MATLAB code. Then turns it into Java, and then finally executes the code. Open CV is basically a library of functions written in C. Hence it is closer to directly provide machine language code to the computer to execute. Thus more image processing done at computers processing cycles, and not more interpreting. Because of that, programs written in Open CV run much faster than similar programs written in MATLAB. 189

Al-Rafidain Engineering Vol. 23 No. 4 October 2015 5. CONCLUSION The results show that the code, which is written by visual C++ and Open CV library, to find a circular object with specific color from a live video, taken by a web camera, speeds up the system by about 174%, than the code, which is written by MATLAB, for the same operations. REFERENCES [1] Slavomir M, Robert H, and Miroslav B "The Comparison of CPU Time Consumption for Image Processing Algorithm in Matlab and Open CV", University of Zilina, IEEE, 2012, pp.75-78. [2] Sharmila B, Karalan N, and Nedumaran D, "Image Processing on DSP Environment Using OpenCV", International Journal of Advanced Research in Computer Science and Software Engineering, Volume 5, Issue 2, February 2015, pp. 489-493. [3] Gary B, and Adrian K, "Learning Open CV", USA, September 2008, pp. 8-109. [4] Issue of MathWorks, "MATLAB Programming Fundamentals", September 2013 (Release 2013b). [5] Miyoun J, Myeongmin K, and Myungjoo K, "Variational Image Segmentation Models Involving Non-smooth Data-Fidelity Terms", Springer Science, 2014, pp. 277-308. [6] Rafika H and Ezzedine B, "Color Image Segmentation by Multilevel Thresholding using a Two Stage Optimization Approach and Fusion", International Journal of Engineering and Innovative Technology (IJEIT), Volume 3, Issue 11, May 2014, pp. 14-20. [7] Rohan K, Ashok K, and Sanjay B, "Review: Existing Image Segmentation Techniques", International Journal of Advanced Research in Computer Science and Software Engineering, Volume 4, Issue 4, April 2014, pp.153-156. [8] Nayan P, Abhishek S, Mayur M, and Kruti D, "A Study of Digital Image Filtering Techniques in Spatial Image Processing", IEEE, 2014, pp. 1-7. [9] Meng L and Subhashis G, "Bayesian Multiscale Smoothing of Gaussian Noised Images", International Society for Bayesian Analysis, Volume 9, Number 3, 2014, pp. 733-758. [10] Aditya G, Akhilesh B, and Kuntal C, "A Comprehensive Review of Image Smoothing Techniques", International Journal of Advanced Research in Computer Engineering & Technology, Volume 1, Issue 4, June 2012, pp. 315-319. [11] Masoud N, Ronak K, and Mehdi H, "Detecting circular shapes from areal images using median filter and CHT", Global Journal of Computer Science and Technology, Volume 12, Issue 2, 2012, pp. 1-5. [12] Dodiya B, Anu M, and Patel J, "Human Face, Eye and Iris Detection in Real-Time Using Image Processing", Journal of Engineering Research and Applications, Vol. 4, Issue 5, 2014, pp.27-31. [13] Nitasha G, Shammi S, and Reecha S "Comparison Between Circular Hough Transform And Modified Canny Edge Detection Algorithm For Circle Detection", International Journal of Engineering Research & Technology, Vol. 1 Issue 3, May 2012, pp. 1-5. The work was carried out at the Technical College / Mosul 190