You are on page 1of 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/261240183

Implementation of mobile platform using Qt and OpenCV for image


processing applications

Conference Paper · September 2011


DOI: 10.1109/ICOS.2011.6079235

CITATIONS READS

15 2,229

2 authors, including:

Dr. Sankaraiah Sreeramula

12 PUBLICATIONS   65 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

Image and video analytics using deep learning (CNN and RNN) View project

All content following this page was uploaded by Dr. Sankaraiah Sreeramula on 08 September 2016.

The user has requested enhancement of the downloaded file.


2011 IEEE Conference on Open Systems (ICOS2011), September 25 - 28, 2011, Langkawi, Malaysia

IMPLEMENTATION OF MOBILE PLATFORM


USING QT AND OPEN CV FOR IMAGE
PROCESSING APPLICATIONS
Deepthi.R.S1 S.Sankaraiah2
Manipal Centre for Information Science Faculty of Information Technology
Manipal University Multimedia University
Manipal, Karnataka, India Cyberjaya, Selangor, Malaysia
deepthi.rs@manipal.edu sreemula.sankaraia10@mmu.edu.my

Abstract: The new advancement in technology made mobile I. INTRODUCTION


phone as smart phone with highly computing capabilities
and low processing power. Currently, achieving real-time The main difficulty facing in the advance of image
image processing routines such as convolution, processing applications such as in mobile phones, which
thresholding, edge detection and some of the complex concerns the limited memory and CPU resources in
media applications is a challenging tasks embedded in order to store the images and the intermediate
smart phone, because of limited memory. An open calculations, since there is limitations on the hardware
software framework, Symbian OS is used in mobile devices resources available the operating system which runs on
to provide a good starting point for developing the the hardware do not provide complex image processing
multitasking kernel, integrated with communication libraries. Furthermore, today’s mobile phone doesn’t
protocols, data management and graphical user interface contain committed arithmetic units for accomplishment
for reducing the total development time. To resolve the of floating point operations which are inappropriately
problems faced by the image processing applications in frequent in several applications [1]. The mobile
mobile phones a new application environment was
animation and applications which include smaller
display resolution, low quality image capture etc. is with
developed. This environment provides the resources
mobile devices with additional challenges [2]. Most of
available in the operating system which runs on the
the present smart mobile phones from Nokia use an
hardware with complex image processing libraries. This
ARM9 processor with Symbian operating system with
paper presents the capture of an image from the printed
internal memory 64MB to 128MB [3]. This needs atleast
media, applied to image processing algorithms to scaling
Symbian 3rd version, which offers provision for the Qt
and translation of the image, wipe out the noise, and detect libraries. With the new technology era, Music, movies,
the edges. Then the developed software chops the comics books and other forms of media has been out-dated and
strip along border into individual units, store on the one technology left behind – the comic book industry.
permanent memory and and display on the handset. The There are PC solutions for reading digital comics, but
application Graphical User Interface was designed using Qt they never fakes the feel of sitting back or reading the
and Visual C++ Integrated Development Environment latest X-Men or Green Lantern comic.
(IDE) for implementing image processing algorithm using OpenCV is an open source library, which is widely
Open Source Computer Vision Library (OpenCv). Many used in image processing applications to attain
image processing methods pre-processes images, which are instantaneous acknowledgement for embedded
Set Region of Interest (ROI) crop, flattening with Gaussian applications [4]. OpenCV library is written in C,
Filter, RGB to Grey scale adaptation, Histogram confirming fast and convenient code, and which
equalization and Detect Border. This developed software compiled for many embedded platforms. OpenCV
integrated in mobiles by the cross compilation of Qt and the library involves the elementary image tasks, which are
OpenCV software for windows XP Operating system. The logical & arithmetic operations. This also consists of
result utilized the CANNY method in finding edges of the complex operations, object detection and object tracking.
image using OpenCV. The integrated approach succeeded Qt is a cross-platform application and UI framework that
in mobile phone by detecting the edges, chopping the allows developers to write applications once and deploy
images to required format of individual units, then stored it them across many desktop and embedded operating
using OpenCV and finally displayed on a mobile phone systems without rewriting the source code.
without any loss of image information. The impacts of This paper describes how efficiently image
memory latency, synchronization and the data processing applications can be run on mobile platform.
management overhead are in significant manner. The results obtained demonstrates without loss of image
information. The remainder of this paper is organized as
Keywords- OpenCV, Visual C++ Integrated Development
follows: In Section 2, it provides previous works on
Environment, Qt, Image Processing Library, Region of mobile platform. In Section.3, the simulation
Interest, Smart Phone, Embedded Platform. environment and the experimental methodology to
evaluate the dynamic library functions are presented.

978-1-61284-931-7/11/$26.00 ©2011 IEEE 284


2011 IEEE Conference on Open Systems (ICOS2011), September 25 - 28, 2011, Langkawi, Malaysia

In Section.4, the implementation of mobile application IV. IMPLEMENTATION OF MOBILE PLATFORM


using Qt are discussed in detailed. In Section 5, the USING OpenCV
extensive simulation results, analysis and the
performance of the image quality are presented. Section
The image processing algorithms are implemented
6 consists of the conclusion and the future work
using OpenCV. OpenCV was designed for high
suggested.
computational efficiency with a strong focus on real-
time applications. OpenCV was written with optimized
II. PREVIOUS WORKS ON MOBILE PLATFORM
C, so it could yield benefit of multi-core processors. The
library was improved with C language according to
Since OpenCV library has many useful functions,
mobile platform for image processing use on Windows.
which is widely used in many applications. Willow
Figure 1 shows the proposed implementation of image
Garage’s personal robot was developed using the
processing application on mobile.
OpenCV library with image Recognitio n system [5].
Stanley, also used OpenCV library for his image
Create frame
processing engine. J.-P. Farrugia et al. uses GPUCV
library, it needs additional computational resources, HOME START
quick processing and with extra power consumption [6]. CAMERA
Even though GPUCV library is group of OpenCV vision Open
tasks, these can’t use in embedded platforms such as
mobiles, automotives and robots, which limits to thermal DISPLAY Not ok Capture
constraints. In Masayuki Hiromoto et al. paper gives THUMBNAILS
embedded applications includes mobile, robotics and etc. VALID
Select
This also requires special embedded processors to
achieve image recognition within the system’s size and DISPLAY PROCESS Ok
READ FILE
limited power [7]. Clemens Arth et al. was developed FRAME IMAGE
the specialized DSP based enhanced system for image
recognition [8]. To overlay these issues on embedded Save
applications, we propose optimized OpenCV
implementation for image applications for mobile
platforms.
Figure1: Implementation of image processing on a mobile
III. METHODOLOGY AND SIMULATION
ENVIRONMENT Opening of the application it will display home screen
which has four options:
In this section the tools and methodology to
implement and evaluate the dynamically loading IPP A. Create a strip
with OpenCV libraries are detailed. The Intel Integrated The application will start the camera and initiates it
Performance Primitives (IPP) was used to collect according to the .config file and has the standard buttons
automatically OpenCV functions, to optimize the which are default to the handset, which basically
processors on the assembler level. So the task is to make includes capture button, settings and cancel button. The
those image processing libraries available on the user can take picture by pressing capture. When the user
development environment. This was performed with the takes picture the application will start all the image
image processing applications in real time. The processing steps. If it succeeds the images will be stored
computations on the processing are modeled as cycle- in the specified directory in .config file and displays the
accurate. The experimental results focused on the more images. If user press cancel button it opens the main
complex comic images. we have used QT SDK by Nokia screen. If the user press settings the camera settings will
v210.05for the implementation of image application. be opened and changed values will be written to .config
This was developed by using OpenCV 2.0.0.CMAKE file
2.8 GUI for cross compile OpenCV 2.0.0 for Microsoft
Visual studio C++ 2008 Express edition to get the image B. Open a strip
processing libraries. The simulation has done with The application goes to the default directory and
Visual studio 2008 on Dell Laptop. Dell Laptop built checks for the images and displays as list/thumbnails so
with Intel Core2 Duo CPU T5750 operated on Windows the user can select the image. When image is selected it
XP OS, running at 2.0GHz with 32KB L1 D-Cache, will display in full screen. It also has a button for going
32KB L1 I-Cache 2MB L2 cache with 8-way set back to the image selection screen.
associative and 2GB RAM. Then using Qt, cross C. Help
compiled images loads into Nokia mobile operated with Opens a file in the text edit box which is only
Symbian OS to display images without loss of quality of readable where instructions for using the application is
image. given

285
2011 IEEE Conference on Open Systems (ICOS2011), September 25 - 28, 2011, Langkawi, Malaysia

D. Exit: Exit the application. B. Grey Scale


An image, with each pixel value has single sample
The figure 2 shows the proposed flow of the image then it is known as Grey scale digital image, also it
processing application on a system. In this, first it starts conveys only intensity information. Grayscale images
with image capture, that captured image would be stored are also called black-and-white, representing the
as temporary image in temporary buffers. Temporary nonexistence of any chromatic discrepancy. The figure
image converted to grey scale using RGB to grey scale 4, shows the algorithm of grey image conversion with
converter. Grey scale image smoothened by using OpenCV
Gaussian filter. Once smoothens the image, that
equalized by using image histogram and so on, the # read image with gray scale effect
detailed steps explanation given with individual blocks. IplImage*grey_image=
cvLoadImage(IMAGE_PATH,CV_LOAD_IMAGE_GR
Capture Image AYSCALE);
#Show grey scale image
cvNamedWindow( "grey scale",
CV_WINDOW_AUTOSIZE) ;
Save as temp cvShowImage( "grey scale",grey_image );
image #Release image windows
cvReleaseImage( &grey_image );
Figure 4: Algorithm gray with OpenCV

RGB to Grey scale C. Gaussian blur


Blurring image is the modest process in image
processing. Blur, is a process done to reduce noise. As
this can be achieved in different ways, this paper
Smoothen demonstrates one method a basic Gaussian blur. By
Gaussian Filter convolving the image with a Gaussian filter, Gaussian
blur can be attained. The libraries, OpenCV includes a
gaussian filter that can be applied to an image by calling
the cvSmooth function. Mathematically, convolving the
image with a Gaussian function is similar to two-
Histogram equalization dimensional Weierstrass transform. Convolving with
circle would exactly make a replica of bokeh
No effect[9].Since the Fourier transform of a Gaussian is
Is OK? alternative Gaussian, applying a Gaussian blur has the
consequence of reducing the image's high-frequency
Yes
components, so Gaussian blur could be designed as low
pass filter. While applying a low-pass filter, its mask is
Detect Border (cumulative weighting the neighboring values in the image, which
sum) results on decreasing the difference between these
values. Therefore this procedure smooth sharp edges in
the objects and causes effect of blurriness. If the given
Get temp image image is sharp, practically it may take a minimum of
about 3–5 iterations of low-pass filter to obtain a
noticeable blurred image [10]. The figure 5 shows the
Set ROI crop and save algorithm of Gausian blur with OpenCV.

from pycam import VideoCapturePlayer as VCP


from Opencv import cv
End def GaussianBlur(image):
Figure 2:The flow of the Image processing application on Mobile
***Blur an image ***
IplImage*smooth_image=
A. Capturing Image cvCreateImage(cvGetSize(grey_image),IPL_DEPTH_8
The figure 3, demonstrates the algorithm of U,1);
#Carry out the filter operation
opening a new camera capture device to capture once
cvSmooth(smooth_image, temp_image,
frame, then open open new window to display the result CV_GAUSSIAN, 3,3);
with the use of OpenCV libray. #Show smoothened image
1. from opencv import highgui as hg cvNamedWindow( "Smooth_image",
2. capture = hg.cvCreateCameraCapture CV_WINDOW_AUTOSIZE) ;
3. hg.cvNamedWindow(Snapshot) cvShowImage("Smooth_image",temp_image );
4. frame = hg.cvQueryFrame(capture) #Release image windows
5. hg.cvShowImage(Snapshot, frame) cvReleaseImage( &temp_image );

Figure 3: Image Capture and display with OpenCV Figure 5: Algorithm for Gaussian Blur with OpenCV

286
2011 IEEE Conference on Open Systems (ICOS2011), September 25 - 28, 2011, Langkawi, Malaysia

D. Image histogram This employed, since initial two was n’t with significant
Image histogram performs as a graphical consideration, to fully remove likelihood of several
illustration of the tonal scattering in a digital image. It replies to an edge.
plots the number of pixels for each tonal value. By
looking at the histogram for a specific image, viewer will F. Region of Interest
be able to judge the entire tonal distribution at a glance.
This technique raises the total contrast of several images A Region of Interest, was selected based on subset
specifically when the functional statistics of the images of samples within a dataset identified for a particular
is being denoted by the neighboring contrast values. purpose. The ROI is set to the coordinates after
Which permits areas of the lesser native contrast to calculating the cumulative sum and the ROI is cropped
achieve a greater contrast. Image histogram technique and saved to the permanent memory. The region with
has advantageous in images by backgrounds & rectangular shape inside an image is known as Region
foregrounds with two in bright or two in dark. of Interest , this method is used to segment object for
Specifically, the technique can be primer to superior other processing. The Figure 6 shows the selection of
sights of bone arrangement in x-ray images. The main sub-image Using ROI
benefit of this technique is legitimately straightforward .
method and an inverse operator.

E. Edge detection

Edge detection is an important image processing


tool that is used as a fundamental pre-processing step
in image processing applications. Edges map have a
significant role in application such as image
categorization, image registration, feature extraction,
Figure 6: Image with Region of Interest (ROI)
and pattern recognition. An edge detector can be
defined as a mathematical operator that responds to the In figure 6, a Region of Interest is well-defined at upper
spatial change and discontinuities in gray levels of pixels leftward of image. When the ROI
set in an image [11]. Edge detection algorithms can be defined, many OpenCV tasks will accomplished on that
generally categorized as parametric models, template specific place. This gives extra advantageous, if object
matching, or gradient-based algorithms [12]. Most of has to crop from an image or to achieve pattern
edge detection operators operate on grayscale images matching in sub-image. Always, Region of Interest
since color image components impose some sort of should be within image. The figure 7 shows the cropping
complexities in detecting edges [13]. In grayscale of image with OpenCV. The region of interest is given in
images, an edge can be detected by investigating the the form of height, width and depth in the command
discontinuity in gray levels [14,15]. However, in color window. For example 60:80:210 then the given area is
images there are won’t be clear and defined color being taken as the region of interest.
edges, although color images carry more information
and have the potential of having more hidden and #Set Region of interest from the original image...
accurate edges [16,17]. Novak and Shafer found that 90 #Here cropping the image from minimum row index to
percent of edges are the same in both grayscale and the max row of a cartoon strip
color images, leaving 10 percent of edges to be cvSetImageROI( original_image, cvRect(
detected through the use of color information [18]. min_col,min_row, (max_col-min_col),(max_row-
The limitation factor in detecting all the edges in gray min_row) ) );
level images is due to the fact that different colors have #Create a cropped image from the source image
different hue values but they share the same IplImage* cropped = cvCreateImage(
intensity value. Some of the common edge detection cvGetSize(original_image),original_image-
techniques for color images utilize fusion technique of >depth,original_image->nChannels );
edges detected at different color space using traditional #Do the copy
edge detectors. There are two fusion methods used to cvCopy( original_image, cropped, NULL);
find edges [19]. The first fusion method finds the cvResetImageROI( original_image );
gradient and the edge map at each of the three RGB #Show cropped image
levels, then fuses the resultant edge maps output. The cvNamedWindow( "cropped",
second method fuses the gradients at each RGB CV_WINDOW_AUTOSIZE) ;
component, and then finds the edge map of the final cvShowImage( "cropped", cropped );
fused gradient. In order to advance in existing techniques cvWaitKey();
of edge techniques, Canny surveyed with list of #Release the image window
conditions [20]. Most apparent is small error rate. The cvReleaseImage(&cropped);
significant task is, edges taking place must n’t be
unexploited. Another condition is, the edge points should Figure 7: Algorithm for cropping with OpenCV
be with proper confined manner. Final condition is, for
every single edge there should be only sole response.

287
2011 IEEE Conference on Open Systems (ICOS2011), September 25 - 28, 2011, Langkawi, Malaysia

G.OpenCV Images Store


As per established standards, edge detector initially
IplImage is a C structure to store OpenCV smoothen the image to remove noise. Subsequently,
images,. Image Processing Library (IPL) is inheritance finds the image gradient to focus areas with
from the actual OpenCV versions, which may require. extraordinary three-dimensional derivatives. This
IplImage data type is defined in CXCORE. Furthermore algorithm tracks along the regions & finds if any pixel is
to raw pixel data, which comprises many of imaginative not at maximum, then it overwhelms. By using
fields, together called the Image Header. Which include hysteresis, array can further reduced. To track residual
width - width of the image in pixels and height – height with pixels which are not overwhelmed hysteresis?
of image in pixels, depth – is numerous predefined Hysteresis also facilitates two thresholds. If the
coefficients, which designate the number of bits per magnitude is lower the first threshold, it sets to zero,
pixel per channel. then it is made as non-edge.

V. EXPERIMENTAL RESULTS AND DISCUSSIONS

In this section the experimental results are


presented. In first stage, the simulation was done using
OpenCV 2.0.0.CMAKE 2.8 GUI with visual studio C++
2008. The image of color to grey scale conversion is
shown in figure 8. The image after smoothening is
shown in figure 9. Histogram equalization accomplishes
by effectively spreading out the most frequent intensity
values. In Image histogram, the histogram equalization
function is known, subsequently the actual histogram can
be get back. Image after histogram equalization is shown Figure 10: The image after histogram equalization
in figure 8.
If the magnitude is more than the high threshold create
an image. If the magnitude is between the 2 thresholds, it
is called as zero except the path from one pixel to
another pixel with a gradient above T2. In order to find
the gradients, Edge Detection algorithm proceeds with
derivative of an image and then determines the direction
of these gradients (vertical, horizontal, diagonal up,
diagonal down). If every gradient has sufficient
amplitude, our system will keep track on the gradient to
find the amplitude, until it falls less than the low
threshold or the gradient track variations abruptly. This
algorithm will also suppress local non-maximums
around the edges. The figure 11 shows the image after
the edge detection.

Figure 8: RGB to GreyScale image conversion

Figure 11: Image after the edge detection

Region of Interest defined by using the function:


cvSetImageROI( IplImage* img, CvRect rect ), in that
img is source image & rect is region inside the source
image. The figure 12 shows the image after ROI
cropping.
Figure 9: The image after smoothening

288
2011 IEEE Conference on Open Systems (ICOS2011), September 25 - 28, 2011, Langkawi, Malaysia

and displayed on the handset.The result utilized the


CANNY method for finding edges of the image using
OpenCV. The integrated approach succeeded in
detecting the edges, chopping the images to required
individual units and to stored it using OpenCV. This
developed software can be easily integrated in mobiles
by the cross compilation of QT and the OpenCV
software for an Operating system. The future work can
be extended to the computationally intensive
applications of real-time video processing on mobile
platform using OpenCV and Qt.
Figure 12: The image after ROI cropping
REFERENCES
The simulated images using OpenCV 2.0.0.CMAKE 2.8 [1] Khana, The future of Mobile Application Storefronts, Wireless
GUI with Visual Studio C++ was cross compiled by Expertise market report, 2009
using Qt SDK by Nokia v210.05 as a mobile platform. [2] Fitzek and Reichert, Mobile Phone Programming and its
Application to Wireless Networking, 2007
After cross compiling with the Qt the complete output of [3] Jurgen Scheible and Ville Tuulos, Mobile Python: Rapid
processed image was shown in figure 13. prototyping of applications on the mobile platform, 2007
Figure 14 shows the full view of the cropped image. [4]. http://sourcefouge.net/projects/opencvlibrary.
[5] Willow Garage, Inc., Willow garage.
http://www.willowgarage.com/ (August 2009).
[6] J.-P. Farrugia, P. Horain, E. Guehenneux, Y. Alusse, GPUCV: a
framework for image processing acceleration with graphics
processors, in: Proceedings of the ICME, 2006.
[7]. Masayuki Hiromoto, Kentaro Nakahara, Hiroki Sugano,Yukihiro
Nakamura, and Ryusuke Miyamoto, “Aspecialized processor
suitable for adaboost-based detection with haar-like features,” in
Proc. of CVPR, 2007.
[8]. Clemens Arth, Florian Limberger, and Horst Bischof,“Real-time
license plate recognition on an embedded DSP-platform,” in
Proc. of CVPR, June 2007.
[9]. S. Dikbas, T. Arici, and Y. A1tunbasak, "Chrominance Edge
preserving Grayscale Transformation with Approximate First
Principal Component for Color Edge Detection", IEEE Proc.
ICIP 2007,11,261-264,2007.
[10] K. Panetta, S. Qasi, and S. Agaian, "Techniques for detection
and classification of edges in color images", SPIE Proc.,
Volume 6982, pp. 69820W-69820W-11 (2008).
[11]. K. Panetta, S. Qasi, and S. Agaian, "Techniques for detection
and classification of edges in color images", SPIE Proc.,
Volume 6982, pp. 69820W-69820W-11 (2008).
Figure 13: Qt Creator Implementation using Qt SDK by Nokia v210.05 [12]. H.M. Merklinger, “A Technical View of Bokeh,” Photo
Techniques,1997
[13]. Linear Gaussian blur evolution for detection of blurry images E.
Tsomko1 H.J. Kim1 E. Izquierdo2
[14]. X. Wang and J. Jian-Qiu, "An edge detection algorithm based on
Canny operator". IEEE Proc. of the seventh International
Conference on Intelligent Systems Design and Applications
(ISDA2007),623-628, 2007
[15]. E.J. Wharton, K. Panetta , and S. Agaian, "Logarithmic edge
detection with applications"., Journal of computers, 3(9), 2008.
[16]. S. Wesolkwoski and Ed. Jernigan, "Color Edge Detection IN
RGB using Jointly Euclidean Distance and Vector Angle".
University of Waterloo,Waterloo Canada, Vision Interface 9-
16, 1999
[17]. A. Koschan, "A Comparative Study on Color Edge
Detecton", IEEE Proc. ACCV'95, Singapore, IlL 547-478,1995
[19]. S. Dikbas, T. Arici, and Y. A1tunbasak, " Chrominance Edge
preserving Grayscale Transformation with Approximate First
Principal Component for Color Edge Detection", IEEE Proc.
ICIP 2007,11,261-264,2007.
[19]. A. Koschan, "A Comparative Study on Color Edge
Figure 14: Full view of the cropped image Detecton", IEEE Proc. ACCV'95, Singapore, IlL 547-
478,1995.
[20]. JOHN CANNY “A Computational Approach to Edge Detection”
VI. CONCLUSION AND FUTURE WORK IN IEEE Transactions on Pattern Analysis and Machine
Intelligence, 679-698, 1986.

In this paper, we presented a method to capture


an image from the printed media, then applied the image
processing algorithms to scaling and translation of the
image, wipe out noise, do background subtraction, image
rotation, detect edges. The developed software was able
to slice or chop the comics strip along border into
individual units, stored on the permanent memory and

View publication stats


289

You might also like