Você está na página 1de 5

International Conference on Control, Automation and Systems 2010 Oct.

27-30, 2010 in KINTEX, Gyeonggi-do, Korea

Design of Embeded Image Data Processing System


LI Da-zhai1,LI Yu-xia2
1.School of Mechanical Engineering and Automation,BeiHang University,BeiJing,China,100191 (Tel:+86-13910029652;Email:lidazhai@buaa.edu.cn) 2.School of Mechanical Engineering and Automation,BeiHang University,BeiJing, China,100191 (Tel:+86-13401170435;Email:lyx05507@163.com) Abstract: Aim at the detecting one-dimensional bar-code in nowdays of real - time need, designing a low cost and moderate function image processing system.The acquisition and processing of image are the key components of the system. The system uses S3C2440 ,which installs Linux, as the core with cir-cuit realize image processing function, multi - communication interface constitute image transmission channels. It is used as the central processing unit that is responsible for collecting, graying , filtering, thresholding the image and bar-code recognition, to connect a variety of interface logic match through the serial port and with a large memory for image storage. Experiments show that the system not only can meet the fast processing, but also meet the requirements of small and portable. Key wordsembedded system; interface ; frame buffer; video4linux; image processing

1. INTRODUCTION
Because of the rapidness and accuration, bar-code technical application has already been used in each realm of computer.The traditional mode that gets the bar-code information is based on optoelectronics scanning technique.With the development of the digital image processing, image absorbing mode based on the digital camera appeared in recent years, and the translating code system also appeared in the same time.In this text, it successfully carries out to collect the image with the common camera based on the Linux system platform and carries on digital processing ,then recognizes the one-dimensional bar-code accurately[1].

screen interaction, while communicating with the external device through the serial port.
NAND SDRAM

Image acquiring module S3C2440 LCD tounch module UART RS232communication SCM

Fig. 1

Hardware functional block diagram of system

3 ALGORITHM OF SYSTEM
3.1 The Driver of USB Port Digital Camera Video4Linux (V4L) is a Linux kernel for the driver of the video device, which has a range of application programming interface functions about video equipment such as the popular TV cards, video capture cards, and USB cameras in the market now. The driver of usb port for the camera needs to provide the basic I/O operational interface- functions as open, read, write, close, interruption handling, memory mapping capabilities as well as the implementation of interface function ioct1 about I/O channel controlling and so on.These are

2 THE DESIGN OF HARDWARE SYSTEM


The system based on embeded board is composed with the image processing module, serial transmission module, the USB interface image acquisition module, LCD touch screen module. The image processing module ,as the core of the system, uses Samsung S3C2440-based on linux. As Figure 1 shows, during the detection, image datas are stored in memory module, then are received for image processing. Human-Computer Interaction is implemented during the image processing through the LCD touch

978-89-93215-02-1 98560/10/$15 ICROS

887

Authorized licensed use limited to: IEEE Xplore. Downloaded on September 04,2011 at 17:20:22 UTC from IEEE Xplore. Restrictions apply.

defined in the struct file_operations,so when the application file carries on the operations to the device, such as open, close, read, write, Linux kernel woulde access the driver to provide function through the file_operations structure. The driver of the digital camera in the system is achieved based on the following steps : Firstly the USB controller driver module is compiled into the kernel statically ,so that the platform will support USB interface, and then use insmode dynamiclly to load its driver module when it need to use the camera in the collection, so that the camera can work properly. 3.2 Algorithm of Collecting Image Under Video4 Linux After the USB camera has been driven, just to prepare a collection of video streaming applications on it. According to the characteristics of the embedded system , write application in host computer at first, and then use the cross- compiler to compile the application to generate an executable file for the target platform.The followings are specifically presented the procedures. 3.2.1 Image Collection Programme: 1)Open the image equipment which is corresponding to the file ,the system uses the function grab_fd = open (/ dev/video0, O_RDWR), grab_fd is a returned file description when the device is opened( if it opens in error it will return -1) . 2)Use ioct1 (grab_fd, VIDIOCGCAP, &grab_cap) to read the struct video_capability to get camera information. After the successful return of the function, this information is copied from kernel space to users space programs. 3)There are two ways to capture the video image: one is to read directly by read(), the other is memory mapping by mmap (). The read () reads data through the kernel buffer; and the mmap () gets data via mapping the device file to memory without using the kernel buffer. The fastest disk access is usually slower than the slowest of the memory access, so mmap () method accelerates the I/O access. In addition, system calling of mmap () allows processes to share the same file by mapping shared memory, each process can access common memory as the same as the file access. The access just need to use pointer rather than call the file functions. Because of the
[3] [2]

above advantages, the method of memory mapping is used[4]. 3.3 Digital Image Processing To conduct a one-dimensional bar-code detection, it should process the bar-code image firstly. 3.3.1 Graying and Binarization Algorithm Graying is actually a kind of black and white image, but it is different from a bitmap image with only two kinds of black and white color.The number of grayscale of colors is much more than two kinds of color as to 8-bit grayscale image which has 256 gray levels pure black and pure white, the others are gray between black and white, but the proportion of white and black is different. Binarization is to deal the 256 brightness level of gray image through selecting appropriate threshold to obtain the binary image reflecting the characteristics of the overall and portion . 3.3.2 Threshold Selection The selection of threshold is the most critical step of binarization .we use the method of dynamic threshold. The method considerates the neighborhood characteristics of pixels and can adaptively change the threshold according to images in different backgrounds to get more accurate binary image.It includes fours steps as follows: 1) Separate the image to sub-images with the m * m pixels.( Such as: 512 * 384 can be divided into 8 * 6 sub-images with 64 * 64) 2) Get threshold of each sub-image blocks by using the method of the minimum error threshold and make the threshold as a focal point for the sub-image while indicating it as T(ij), (i, j) is the coordinate of the entire image. 3) Get the thresholds of other pixels using the 8 * 6 thresholds of the Step 2 with the method of bilinear interpolation, that is T (i, j). 4) Indicate each pixel grayscale of the image with F (i, j), if F (i, j)> T (i, j), then the point is considered as the target point. 3.3.3 Edge Detection As the image captured includes two parts, the target

978-89-93215-02-1 98560/10/$15 ICROS

888

Authorized licensed use limited to: IEEE Xplore. Downloaded on September 04,2011 at 17:20:22 UTC from IEEE Xplore. Restrictions apply.

area with bar-code area and background area without bar-code area,we need separate the target area from the image.The image that has been grayed and binarizated presents with typical characteristics that the white and the black points appear alternately in the area while only black points appear in the other area.Only count the number of the white points to fix the position of the four edges when the number exceeds a certain value. 3.4 Bar-Code Detection The target area brings with unequal distortion, mainly noise. The purpose of shaping the image is to remove the noise. Different noise deals with in different ways. According to the characteristics of the image , there are more than two consecutive points of their differences with the surrounding in a certain direction, leading to glitch noise and salt noise. In this system, the use of median filtering can effectively remove these two kinds of noise. 3.4.1 Method of Median Filtering 1) Sort out an odd number of data from the image of a sampling window. median value. 3.4.2 Main Characteristics of Median Filtering Output and input noise density of median filtering relates to the distribution, while output and input of the average filter unrelates to the distribution .To the suppression of random noise, median filtering is worse than the average filtering. But in terms of pulse interference,especialy the pulse width is less than m / 2, the distant narrow pulse interference, median filtering is very effective. According to the size of the image, if we adopt the 3 *1 template, it can not thoroughly remove the image noise in the particles of salt. With 7* 1 or 9 * 1 template, little difference with 5* 1 template in the first glance, but a closer observation, the details of layer structure of the bar-code image are not clear compared with the original image. If the template is longer, this trend will be more obvious, the details of layer also increasingly unclear.Therefore ,to chose 5 * 1 template, which can effectively remove interference, keep the
[5]

specific

details,

simplify
[6]

algorithm,

and

avoid

unnecessary calculations.

3.4.3 Algorithm of Decoding Process Decoding methods often be used,such as the width measurement, the average method, distance to similar edge measurement. The distance to similar edge measurement is used in the system. 1) Design ideas To determine the logic character values through measuring the distance of the adjacent elementss similar side in the symbols, rather than by the actual measurement values to the width of elements. Width measurement method and the average method demand highly about the image, because they are measuring the actual width of the symbols of each element, and then get the code value by looking up table. If the actual measured values have deviation with the standard value, it is unable to achieve decoding.The implement as follows: The length of the entire character is set L, then L = T1 + T3, then the average width unit element of this character will be I = L / 7, so the distance between the similar side of T1, T2, T3 of this character ,contains the number of unit elements width, respectively 7T1 / L, 7T2 / L, 7T3 / L, as following shown. Because of the distance between the similar side ,contains the number of unit elements width , corresponding to the logical value of the EAN code. So it is able to come to the logical value of this character by looking up table .If the edge distance interpretations based on the similarity of the EAN code characters are 1,7,2 and 8, that can be distinguished by calculating the number of the width of each elements in the unit of the characters. [7] T1 T3

2) Replace the processed data with the post-sorted

T2 Fig.2 Distance between the similar edge of EAN code The advantage of the similar distance decoding is that

978-89-93215-02-1 98560/10/$15 ICROS

889

Authorized licensed use limited to: IEEE Xplore. Downloaded on September 04,2011 at 17:20:22 UTC from IEEE Xplore. Restrictions apply.

even if the bar-code symbols print defectively or scan inadequately making the deviation larger between the actual measurement value and the theoretical value, it still can correctly interpret according to the similar distance from edge.

5 RESULTS OF EXPERIMENT
According to the above design ideas build an image processing system for image processing in this experiment. The results of experiment show as follows

4 THE DESIGN OF THE SOFTWARE SYSTEM


Based on the above algorithms,designing for Fig.5 The conventional diagram of original picture

implementation in the operating system, each algorithm can be modularized into a executable function, image processing is written as a separate task, read microcontroller signal through the serial port ,and collect and process the image according to the received signal, then send a signal to microcontroller based on the results of processing.Flow chart of the system task shows in Figure3 The driver of the camera

Fig.5 The conventional diagram of graying and binarization

Detect the signal of

microcontroller

Fig.6 The conventional diagram of thresholding and cutting

Signal=1 Yes

no

Collecting and storaging image Graying and Binarization Threshold Selection

Fig.7 The conventional diagram of median filtering and decoding

6 CONCLUTION
Design image processing system based on

Edge Detection Median Filtering Decoding

S3C2440 ,which collects and processes image datas,then LCD obtains information of target location , providing displaying important foundation for cutting. On the other hand ,the and system comes with multiple communication interface to sending signal=3 communicate with outside and friendly Human-Computer Interaction based on LCD touching screen. This embedded image processing system greatly simplifies system structure, reduces system design cost, shortens development cycle compared with ordinary image processing card.

No
Right

Yes
LCD displaying and sending signal=2 Fig.3 Flat chart

ACKNOWLEDGEMENTS

978-89-93215-02-1 98560/10/$15 ICROS

890

Authorized licensed use limited to: IEEE Xplore. Downloaded on September 04,2011 at 17:20:22 UTC from IEEE Xplore. Restrictions apply.

This work is supported by Vanguard Fund


BeiHang University(300256).

REFERENCES
[1] Liu Shaoying,Lu Jilai Detection of QRS complex using mathematical morphology and wavelet transform [J]. Journal of Tsinghua University (Science and Technology), 2004,44 (6): 852-855. [2] P. Raghavan, A. Lad, S. Neelakandan, Embedded Linux System Design and Development, Auerbach Publications, 2006. [3] R. Love, Linux Kernel Development, Addison Wesley, 2005. [4] XIE Jue, ZHAO Hui-bin, YE Yi-Min, A Method Based on Timer Management in Linux Improvement [J], for Real-Time Scheduling Computer

Engineering and Application, Beijing, 2003, 39(34). [5] J. Ready, Embedded Linux: Prepare for the coming software crisis, Appliance Design, June 2007. [6] C. M. Chao, Y. C. Tseng, and L. C. Wang. Reducing Internal and External Fragmentations of OVSF Codes in WCDMA Systems with Multiple Codes. In Proceedings of IEEE Wireless Communications and Nehvorhing Conference, volume I, pages 693498,2003 [7] R. Wang, Y. Tsai, An image-hiding method withhigh hiding capacity based on best-block matching and k-means clustering, Pattern Recognition, 2007.

978-89-93215-02-1 98560/10/$15 ICROS

891

Authorized licensed use limited to: IEEE Xplore. Downloaded on September 04,2011 at 17:20:22 UTC from IEEE Xplore. Restrictions apply.

Você também pode gostar