Vous êtes sur la page 1sur 7

1

IMAGE PROCESSING BASES ON FPGA AND


RASPBERRY PI
A. Benalcazar, S. Caza, R.Cevallos, L. Oscullo
Universidad de las Fuerzas Armadas
aleksb@live.com
sccaza@espe.edu.ec
ricevallos1@espe.edu.ec
lsoscullo@espe.edu.ec

AbstractReal-time image processing usually requires enormous throughput rate and huge amount of operations. Parallel
processing in form of specialized hardware or multiprocessing
are therefore indispensable. This paper describes a flexible programmable image processing system using Field Programmable
Gate Array (FPGA) and compares for algorithms for image
processing for detection of objects in a FPGA and Raspberry
PI . The algorithms implemented on the FPGA, that is capable
of supporting the spatial and temporal parallelism allows image
processing operations , can be divided into subsystems, which
can be run concurrently with each other. While the Raspberry
PI, has a high processing capacity and allows using the OpenCV
library for object detection
Index TermsImage Processing, FPGA, Raspberry PI, real
time, detecting objects

I. INTRODUCCION
The algorithms of image processing require a sustained data
transfer, usually require a large amount of resources, such as
memory components, rapid capacity operation of the CPU,
devices, image capture, display devices, interfaces, among
others.. [1]. At the same time, errors in the acquisition and
digitization of images, noise and imperfections in the lens of
the camera generating discontinuities on images , that can
affect the systems performance artificial vision[2].For this
reason the use of a filter stage, as a median filter is an effective
method for removing noise based on the momentum of the
images is needed.[3]
Artificial vision systems are composed of subsystems that
gets information by capturing an image to analysis it.[4],
for this have been developed different algorithms based on
different hardware such as Raspberry PI and FPGA.
The implementation has been done on a FPGA in order to
have better performed with less resources, taking advantageof
the quick interconnection between logic blocks.[5], While the
Raspberry PI is a single board computers (SBC) of low cost
that has a central processor, a graphics processor and RAM.[6]
In this work are described previous work of image processing based on FPGA and Raspberry PI cards, then will be
described the algorithms for removing noise in the image by a
median filter in the FPGA and the algorithm object detection,
finally are described the algorithm for object detection based
on color implemented on a PI Raspberry.

FPGA
FPGAs are designed to create from a simple combinational
logic to systems with embedded microprocessor, transmission
series to 3.5GB / s data devices, all with the same device.
Therefore FPGAs have different characteristics, but we can
say that the main ones are the following:
A large number of terminals E / S. From 100 to about
1400.
Lots of Flip-Flops.
Memory blocks (BRAM) dual port, single port, up to
18Mbits, configurable as RAM, ROM, FIFO
Blocks dedicated
Transmission transceivers series of very high speed between 1.5 to 10.0 Gb / s
Processor embedded in hardware
Processors described in software, HDL
Type Controllers Delay Lock Loop (DLL) and Phase
Lock Loop (PLL) clock up to 550MHz.
Control impedance programmable for each terminal E /
S

Fig. 1. FPGA Altera Flex.

Raspberry PI
The Raspberry PI , that is shown on the Figure 2 , it is a
small low-cost computer, with minimum power consumption
that plugs into a computer monitor or a TV, and use a
keyboard and a standard mouse. It allows people of all ages
to explore the computer, and to learn programming languages
like Scratch and Python. It is able to do taks that is expected of

a desktop computer from surfing the Internet and playing highdefinition video with making spreadsheets, word processing,
and playing games [6]. This card has the following features:
512 MB of RAM.
Processor ARM de 32 bits.
700Mhz speed with the possibility of incresing to 1ghz.
USB x 2
HDMI
Ethernet
Works with 5V - 1.5A

image recognition and real-time optimization design hardware


easily.
Paper [9] shows the implementation of an image processing
algorithm on a FPGA using a Xilinx Spartan-6 FPGA family.
The work describes the use of a reprogrammable device that
allows continuous changes and optimizations in the design of
hardware easily.
Concerning the Raspberry PI cards, some investigations
such as [10],[11],[12], show algorithms for tracking line in
a marine environment, detecting a laser spot, or even the
implementation of a robotic arm for object classification,
where the image processing and the ability of these key cards
for the development of these type of applications.
Finally, the management of these cards that is showed by
[13], who allows implementation of a system that can handle
multiple algorithms image processing in parallel and real-time
network for a system of image processing using a Spartan 6
FPGA together with a PI Raspberry, which provides the system
with a portable angle remote applications.

Fig. 2. Tarjeta Raspberry Pi.[6]

Morphological operators
Morphological operators in image processing refers to a
class of algorithms based on the geometrical structure of
an image, which can be used in greyscale images for edge
detection, texture analysis and restoration. Within morphology,
they have two operations dependent element structured and
how it fits in the object. [7]
Erosion refers to the contraction of an object in an image
Expansion: refers to enlargement of an object in an imag
Both concepts depend on a structured element, known as a
window is moved over an image, similar to the window of
pixels used in the filter order by rank. The output of an
expansion operation is a pixel in the foreground for all points
in the structured to the point that the original pixel element is
set to a picture object. The erosion and dilation greyscale can
also be obtained by a filter order by rank.
II. RELATED WORK
Several efforts have been made in many areas of image
processing in order to implement their respective algorithms
in hardware, where more highly optimized and parallel algorithms are possible. The work presented in [3] , employs
the use of FPGA to implement a hardware median filter,
using VHDL to reduce noise in the image implemented. The
architecture optimized proposed for the filter helps to reduce
computing resources.
Autors in [8], [1] , talk about applying image processing
to various applications, and how this requires application
dependent designs and filters their work allows to developed
algorithms for image processing, enhancement, and filtering
for systems development vision of a robot for object tracking,

III. IMAGE PROCESSING IMPLEMENTED IN A


FPGA

The implementation of image processing algorithms in realtime processors currently is quite uncomfortable because the
image size can be large and with high resolution. A suitable
alternative is to use this technology Field Programmable Gate
Array (FPGA). [1].

Sorting Filter Medium


In image processing, noise removal is common practice for
a sample most appropriate and can get better results. The
median filter is a nonlinear technique digital filtering, often
used to eliminate noise. It is very widely used in digital image
processing, since, under certain conditions, preserves edges
while eliminating noise[14].
The main idea of the median filter is to run through the
image pixel by pixel, replacing each pixel with the median of
neighboring pixel. At each displacement the ordering of pixels
is performed and the central pixel value called the origin by
the average value determined by the result of the system is
replaced, as shown in Figure 3. Similarly when the pixel of
greatest intensity is taken the maximum filter as well as the
minimum filter is obtained when taken at lower pixel value.
An example of the application of the median filter on an image
shown in Figure 4

Fig. 5. System Implemented in the FPGA card. [4]

Fig. 3. Filter Medium:. A window of nine pixels of order 5 is moving,


then the arrangement thereof, and outputting the pixel it takes found in the 5
position.[4]

Fig. 4. Example of the application of the median filter. [9]

Implementation of a Filter Medium


Figure 5 shows the block diagram of the entire system,
where the image is converted to GIF format to binary using
the Matlab software, then is sent to the FPGA via serial
communication, where it is processed is displayed and the
image is sent again to PC via RS-232. Finally, through a
program of Matlab the processed image to the original format
becomes.[4]
The recognition algorithm based object FPGA, is based on
morphological operators. This imple- mentation can be divided
into 3 stages: A window generation step, a counter of rows
and columns and the specific final stage of the algorithm to
be implemented.
The objective of the Windows Generator is stored in a buffer
the number of pixels needed to form a window of NxN (where
N defines the window size). After this, the window generator
must be doing a sliding window over the entire image to
achieve processing all pixels.[7]
The counter of rows and columns are responsible for
determining which pixels from the edges of the image are,

this is done because the edges of the image can not apply the
processing window for lack of information.[7]
Serial Communication Module: This module consists of a
block baud rate generator, which is implemented by a counter
which generates a sampling signal whose frequency is 16 times
the baud rate selected for the UART. This signal is used by
the receiving block and serial transmission to detect the input
data and generate the output data.[15]
Window Generator: The generator is a module designed
windows in VHDL for selecting pixels in the region to be
processed by flip flops and 2 FIFO buffers. This generator is
used to select the corresponding to a region for use in the
filters system pixels.
Count Rows and Columns: The Count of rows and columns
indicate whether a pixel filter output is on the edge of an
image or not, since each pixel filter output is assigned to the
corresponding position of the pixel that is in the center of the
processed window.
Median filter: The filter medium is a subset belonging to the
statistical filter order (order by rank)[16] . The main feature of
these filters is that they require the order of lowest to highest
value of the pixels involved in the operation. This block is
performed in order to obtain the VHDL of the pixels of the
window of interest.

Fig. 6. Image processing for the elimination of errors acquisition using a


FPGA card. a) Input Image b) Image processed with an FPGA.[4]

O BJECT DETECTION SYSTEM BY COLOR


The implementation of the system for the detection of
objects by color for the vision system of a robot, uses a
CMOS image sensor, while for the software development
environment of Xilinx ISE was used, allows developers to

implement specific logic circuits using hardware description


language such as VHDL and Verilog HDL[8].
The block diagram for the circuit of image processing
shown in Figure 7 for object detection, the circuit includes
a circuit state machine and a FIFO buffer that controls the
timing for transmitting pixel data to incorporated processor.

IV. IMAGE PROCESSING IN RASPBERRY PI


The implementation of mobile robot with camera was made
by integrating components of the project to work as a single
system. The hardware part is composed of a development
board Raspberry PI, a webcam, wireless network card and
the movement system.
While part of the software is integrating the operating
system installed on the SD card Raspberry Pi, the library
computer vision OpenCV [7], Web Server Lighttpd, which
is part of the monitoring system, and the source code of the
program It is representing the system image processing. The
steps for implementation are:

Fig. 7. Block diagram of the circuit for processing blocks implemented in


an FPGA. [8]

The circuit image capture this algorithm receives pixel data


(1 byte) to 27 MHz from the module CMOS camera and
includes four pixel data (4bytes) for supplying the circuit state
machine according to the size width FIFO buffer. The circuit
state machine is temporarily set between image capture and
buffering to insert 4bytes 2 pixel data to the FIFO. Therefore,
the algorithm includes three states "expect", "write" and "write
recognizes for transmitting pixel data, as shown in Figure8.

Fig. 8. State machine diagram for the FIFO memory. [8]

In this object detection algorithm color information obtained from the CMOS camera module is used. The object
recognition method is based on color sets thresholds for pixel
components and all pixels, it was considered that the target
color is orange.
It is assumed that the color orange set destination, so the
white pixels indicate the target color or object and black pixels
indicate that they are not the desired object.

Install the operate system Raspbian (Linux Debian


Wheezy) OpenCV library OS 2.4.9, the Lighttpd server.
Connect Webcam and wireless card to the USB ports
Connects Raspberry PI. The Web camera and wireless
card are compatible with the system; therefore, it is not
necessary to perform additional configuration.
GPIOs ports are connected to motion system. Implementation Monitoring System, a web page with four
frames in which images of image processing system is
created. Establishing that each is updated every 200 ms.
The image processing system was implemented within a
folder, located inside the card Raspberry PI development,
which is compiled and run on the same system.

In the implemented algorithm spatial analysis and color images, the mobile robot environment is performed, with an important stage as is the implementation of Canny edge detector
that helps edge detection, the purpose is the recognition of
a specific object within the field of view of a web camera
mounted on the robot, all within the field of digital imaging
and digital processing them.[7]
The methodology for the detection and identification of the
object of interest using Digital Image Processing is analyzing
images captured with a webcam, where brands, colors and
shapes of an object, detailed in Figure 9.

Fig. 9. Flow Diagram of the algorithm implemented in Raspberry PI.[7]

Start
When you turn the system automatically it performs the
wireless connection and starts the monitoring service, through
a web server, also verifies the connection and operation of the
webcam.
Search brands
It requires the object to be analyzed is in front of a white
sheet with square marks 3cm in every corner of the paper,
this helps the robot can focus the object, once focused image
capture is performed, filter applied for convert the image to
grayscale and eliminate as much noise as possible. The image
is segmented by Canny algorithm, which seeks local maximum
gradient of the image, the contours strongly marked white on
black background and thus obtaining a binary image. These
contours are analyzed to detect whether or not square, if you
find the 4 pictures mean that the mark was found and the
distance between the centers is calculated.
Detect color and shape
The distance between the centers is used to make a square
sample of 25 pixels side, covering an internal section of the
object to be analyzed. It shows that the color of each pixel is
obtained to create a histogram of colors and mask that helps
separate the image of the object and the background of it,
then the characteristic values are saved for serving identify
the object.
Search for and detect the object
Once recognized the object, the robot turns right and begins
to search for an object with the same characteristics, if it
detects an object like it focuses on the camera and take a
picture. It is compared with the contour of the object to search
through their invariants moments, obtaining a numerical value
representing the similarity between the two figures, if greater
than 40 means that the objects are different and the closer to
zero, the greater the similar.

Fig. 10. Proposed methodology for the detection and recognition of objects
by color and shape in Raspberry PI. [7]

V. RESULTS
Once detailed all the features and configurations image
processing for both cards, you can see that their object
recognition methods are different, and once implemented in
their respective robots the following results were obtained:
FPGA Implementation:: The object recognition method is
based on color groups of pixels and test the algorithm ball
was used Figure11.
It is noted that the method using the RGB format cannot
capture all the color ball, as seen in the Figure 12, , so that
the noises are eliminated around the object orange in color
detection. In Figure 13 we can see the bilinearization image
in which the pixels white show the object of interest, while
the pixels in black display which is not the object of interest is
observed. This method allows to recognize objects in an easy
way, but the drawback is that the object has to be recognized
must have a color previously established, and must have a high
contrast with its surroundings.

Fig. 11. Original Image. [8]

Finalize
If you find a similar object, the mobile robot is placed in
front of him and stops moving.

Fig. 12. The region grouping deciding RGB (Orange).[8]

the following occasions, only compares the objects in their


environment with those recorded in its memory to recognize
objects.
Below is a comparison table:

Raspberry PI

FPGA

Request

Specify color

Get object models with a colored background


Descriptive language VHDL

Programming

Linux operating system

Processing speed

700 MHz to 1GHz

80 MHZ to 550 MHz

Resolution Image

320 x240 pixeles od 32 bit of color

256x 256 pixles of 32 bits of color

Recognition Method

Grups of color of the pixeles

Model in memory

Tabla I
C OMPARISON TABLE

Fig. 13. Bilinear image.[8]

Raspberry PI Implementation:: In the Figure 14 We can


see displays with the results obtained, with the recognition
algorithm, with a light level seen sufficient for the detection.
In the "Original" image shown its true color with brands
required for analysis of the object, in the "Imagen1" detection
marks to filter process is observed, "Imagen2" shows the color
histogram of the object analyzed; and "Imagen3" shows the
contour saved object that will be the basis for matching.

Fig. 14. Object recognition. [7]

VII. CONCLUSIONS
It is necessary to eliminate some errors that occured in
the acquisition and digitization of images that introduce
discontinuities, that can affect systems performance of the
artificial vision system. The use of FPGAs as a tool for
image processing is very powerful, because with minimum
benefits can implement algorithms for image processing for
error correction that requires a lot of processing and images
of an acceptable size, however the programming language of
these cards may cause difficulty in the management thereof,
so that a knowledge of VHDL is required.
Using Rapsberry Pi as a tool for image processing satisfactory results establishing itself as a powerful tool for application
development of alternative vision, its main advantage is its
powerful processing capacity and the large number of libraries
OpenSource that support is obtained by and facilitate user
programming.
The Raspberry Pi has been the first to offer a very low
price a complete team. Its implementation is simple, once
installed on the SD operating system, we only need to feed
the Raspberry USB card, this feature is great as it no plug
is required, just a computer with USB output. It can be used
for any use, but always remembering its limitation in power.
Graphically it is very powerful, thanks to its GPU VideoCore
4. We can play lot of content, which is a great advantage in
the field of computing.

VI. COMPARED WORK


As clearly seen in the results, both methods of object recognition are efficient, but each one has certain characteristics,
according to the application to which the robot approach, such
as if the algorithm in the FPGA where the using of filter of
medium allows us to get a better pictures quality , also it
provides an easy implementation because of the capabilities
of your processor , that is evident, but in his implementacon
is necessary to define a specific color for the object that tries
to recognize, the same must contrast with its surroundings to
avoid confusion.
Instead of the algorithm used in Rasberry PI, it hasnt
needed to defined the color of the object to recognize because
the algorithm itself deciphers, but requires that the object of
analysis is over a white background with different brands
allow focus it on the image that will receive the robot,
it is noteworthy that this is done only the first time, for

R EFERENCES
[1] K. C. S. C. C. W. Luo, The implementation of an assistive robot with
real-time image recognition functions, System Integration (SII), 2013
IEEE/SICE International Symposium on, 2013.
[2] P. E. V. R. Ing. Alexander Quintero M, Algoritmos de procesamiento de
imagenes en fpga, Revista Colombiana de Tecnologas de Avanzada,
2011.
[3] M. S.S.Tavse, P.M.Jadhav, International journal of emerging technology
and advanced engineering, International Journal of Emerging Technology and Advanced Engineering, 2012.
[4] J. O. W. A. J. R. A. A. Q. J. Ocampo, Desarrollo de algoritmos de
procesamiento de imagenes basados en operadores de vventana sobre
una fpga, Primeras Jornadas de investigacion y Transferencia, 2011.
[5] Smith, Implementing Median Filters in XC4000E FPGAs.
[6] R. PI. [Online]. Available: https://www.adafruit.com/category/105
[7] E. A. A. Z. J. V. C. Aviles, Implementacion de reconocimiento de
objetos por color y forma en un robot movil, Universidad Autonoma
Metropolitana, 2012.
[8] H. H. K. A. Komori, Real-time image processing system by using
fpga for service robots, The 1st IEEE Global Conference on Consumer
Electronics 2012, 2012.

[9] M. A. K. M. M. I. A. Aljarrah, Implementing image processing


algorithms in fpga hardware, IEEE Jordan Conference on Applied
Electrical Engineering and Computing Technologies (AEECT), 2013.
[10] B. S. C. Samreen Amir, Nimrah Ahmed, Implementation of line
tracking algorithm using raspberry pi in marine environment, IEEE
International Conference on Industrial Engineering and Engineering
Management, 2014.
[11] M. I. A. . Y. I. N. Aryuanto Soetedjo; Ali Mahmudi, Raspberry pi
based laser spot detection, IEEE International Conference on Electrical
Engineering and Computer Science, 2014.
[12] J. S. Viren Pereira, Vandyk Amsdem Fernandes, Low cost object sorting
robotic arm using raspberry pi, IEEE Global Humanitarian Technology
Conference - South Asia Satellite (GHTC-SAS), 2014.
[13] Z. D. D. . J. J. T. S. Gengaje, Network on chip based multi-function
image processing system using fpga. Advances in Computing, Communications and Informatics (ICACCI), 2015 International Conference on,
2015.
[14] A. Marion, An Introduction to Image Processing, Chapman and Hall,
1991, p. 274.
[15] P. P, FPGA Prototyping by VHDL Examples, 2013.
[16] N. A., Further study of image processing techniques on fpga hardware,
2010.

VIII. BIOGRAPHIES

Lorena Samantha Oscullo Naranjo She was born


in Sangolqui-Ecuador on July 3, 1993, completed
her primary and secondary education at the school
Giovanni Antonio Farina, obtaining her Bachelor
specialty Physical Mathematician. Nowadays, she is
pursuing eighth semester of the career of Ingeniera
Electronics Automation and Control at the University of the Armed Forces ESPE.

Dayana Ballagn Alulema

Stalin Xavier Caza Negrete He was born in Quito,


Ecuador, on April 7, 1992. He did his secondary
education at the "Instituto Nacional Meja" in the
specialty of Mathematical Physics in 2010. He is
currently pursuing his studies at the University of the
Armed Forces ESPE race engineering Electronics
Automation and Control, is interested in robotics
projects, it does not exercise professionally.

Dayana Ballagn Alulema

Alexander Pal Benalczar Romn Born in Quito,


Ecuador on 30 April 1992. He studied at the Municipal Education Unit Eugenio Espejo, graduating with
Bachelor specialty Physical Mathematician. At the
moment he is studying the eighth level of the career
of Electronic Engineering majoring in Automation
and Control at the University of the Armed Forces
ESPE- Quito. It deciding to continue his studies of
electronics is studying at the Polytechnic School of
the Army based in Sangolqu. Presently he is living
in Quito.
Dayana Ballagn Alulema

Rubn Ignacio Cevallos Ron He was born in


Quito, Ecuador on 15 August 1993. He completed
his primary and secondary studies in Educational
Unit "Pensioner University", obtaining his bachelor
degree mathematical physicist. He is currently pursuing eighth level of Electronic Engineering, Automation and Control at the University of the Armed
Forces ESPE. Currently not exercise any paid work
because of her studies

Vous aimerez peut-être aussi