Typical solutions of image processing, which are always seen
in university laboratories, are run fully with the CPU of the computers which
apply them. Those solutions, usually of real-time type, require a large memory
capacity of each computer’s RAM. Hence the burden on both the CPU and RAM is
high, which will slow down the computer and in the worst case: it will crash or cause a hang. Therefore FPGA – field -programmable gate array, is increasingly applied
as an extra hardware to the computer to assist the task of running the image
processing solutions. This article discusses a recent laboratorial test for
image processing with FPGA, which was conducted by Mr. J.P. Bernecker and the
writer, two postgraduate students of University of Applied Sciences of
Darmstadt (Hochschule / HS Darmstadt). The test result showed that a real-time solution can be easily
executed on a low performance computer with the help of FPGA.
NOTE: This article is written as a translated simple excerpt from the test report which was produced by two students mentioned above and was originally written in German language. Among the sources are named in the end.
During the Summer Semester 2012 at the HS Darmstadt in Germany, the
students of the postgraduate course Optical Engineering and Image Processing
(Optotechnik und Bildverarbeitung) had to run different laboratorial tests for
the subject Industrial/Applied Image Processing (Angewandte Bildverarbeitung).
The writer was paired with his lab partner to run 2 tests for image processing
which used FPGA.
The other tests available to those students were such as
inspection of liquid mixture using infra red camera, observation of the Venus transit etc.
Figure 1 - Linescan camera Basler Sprint spL4096 - 70 km |
The test was conducted using two main instruments – a linescan
camera (Zeilenkamera) and a frame grabber card, which comes with the
field-programmable gate array (FPGA). The linescan camera has only 1 row, hence
1-dimensional, of pixel, which is different than conventional cameras which use
CCD or CMOS chip with 2 dimensional array of pixel. The linescan type is mainly
utilized in barcode reader, fax, scanner etc. In the following Figure 1 the camera
which was used for this task is depicted along with its sensor. This is a model
of Basler Sprint spL4096 – 70 km, with 4096 pixel along its column.
FPGA
FPGA is an integrated circuit, into which a logical circuit
can be programmed. Alternatively it can be understood as a reuseable silicon
chip. To program an FPGA , high languages such as VHDL (Very high speed
integrated circuit Hardware Description Language) are used. The FPGA has
diverse, prefabricated logic blocks, of which the purposes are to comprise the
logical connection of conditions of the input signals to the output signals and
to inquire as well as to set the conditions in periphery elements over specific
I/O blocks.
With the logic blocks such chips can be so configured that
they implement certain hardware functions. The configuration files originate
from the compilation of digital algorithms that are developed into softwares.
Framegrabber
Figure 2 - Frame grabber Spartan XC2S 600 E-FPGA |
The FPGA chip which was used in this test is a type of
Spartan XC2S 600 E-FPGA, a product of the firm Xilinx Inc. This chip is mounted
onto a frame grabber MicroEnable III-XL (see Fig. 2), which is produced by
the firm SiliconSoftware. A frame frabber is an intelligent card/electronic
device for high quality image acquisition and processing. The frame grabber
sets up the connection between the camera and the computer.
Why Image Processing
with FPGA?
FPGAs are used to reduce the large data streams from
hardware into frame grabber. In FPGA-assisted image processing, the necessary
computing power for image analysis is significantly decreased. This is the
result of less work processes that fall to the CPU/processor, which does not
have to partake in the procedures of image analysis. Therefore the latency/time
delay from the image acquisition at the input until the output after the
processing is notably recduced. Examples of image pre-processing with the help of FPGA are
image transformationss, corrections of shadow effects and binary morphology.
The Test: Oscillating
String
Figure 3 - Setup of the test |
The test which was given to this 2-man groupd consists of 2
parts: Static image of a rotating roller and the swinging string. The former’s
purpose is to teach students about the parameterization of linescan camera.
However this article will only discuss more of the latter,
as it is directly about the application of FPGA as image processor. The
objective of this test part is to detect the oscillation of a guitar string via
the linescan camera (see Fig. 3)
Figure 4 - Oscillation of the guitar string - an inverted gray level image |
In the process of detecting the oscillation, the center of
gravity (COG) of every image row and the instantaneous position of the string
will be determined (see Fig. 4). With those determined COGs, an audio file of WAV-format
will be generated, which replicates or recreates the detected oscillation of
the guitar string. This WAV-file can be easily played on conventional media
players. Audacity, an open source software, was used in this test.
The following image (Fig. 5) shows a design – a program which is
developed on the platform VisualApplets. This design was a work of a previous
group (students Mr. U. Häberle and Mr. Klöß) and was allowed to be used in this
test to ease the current group’s jobs. The programming on VisualApplets is
quite complex and requires more time than the allocated for this test,
especially for beginners. One can notice that the interface in VisualApplets is
similar to those of MATLAB-Simulink and LabVIEW.
This design consists of the following steps – loading the
images in the buffer, inverting, converting to binary images and the generation
of a WAV-file.
Due to some problems, the design above has been synthesized
– i.e. a C++ source code is generated from the design and the program is run
from Visual Studio, instead of the proper platform microDisplay, which comes
along with VisualApplets in the complete package.
The outputs of every execution of this program are always
the same - a TXT-file which lists all
the calculated COGs and the expected WAV-file.
With Audacity, the oscillation or displacement of the guitar
string is visualized and further deductions can be drawn (see Fig. 6).
Figure 6 - The playback of the oscillation via Audacity |
From this image, one can easily notice that the guitar
string was plucked five times during the period of image acquisition.
Conclusion
This test has served as a platform to deliver a good insight
into the possibilities and problems that are associated with FPGA technology.
The C++ program which was run from Visual Studio has yielded comparable and good
results. Apart from that, the execution of the software caused frequent crash,
hence the frequent restart of the computer. Such tests should use only prepared
applets, as the developing of one’s own applet is too extensive for an
experiment which must be done in only two period blocks (90 minutes each) per
session/week.
Sources
- National Instruments Tutorium: Einführung in die FPGA-Bildverarbeitung mithilfe des NI LabVIEW FPGA Module (Jan 04, 2012)
- National Instrumens Tutorium: Einführung in die FPGA-Technologie: Die 5 größten Vorteile (May 20, 2012)
- SiliconSoftware - Official website http://www.silicon-software.de/
Nisi Dominus Frustra.