Real-time moving target detection system based on DM642

Publisher:脑洞飞扬Latest update time:2011-08-26 Keywords:DM642 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

Digital video systems have been widely used in the fields of intelligent transportation, image recognition, and security monitoring. As an important part of digital video systems, motion target detection is the basis for subsequent applications such as target recognition and target tracking. This paper proposes a real-time motion target detection system solution based on DM642 . Relying on the powerful computing power of the DM642 chip, the data throughput and real-time performance of target detection are guaranteed. This solution is reasonably designed, highly scalable, and has practical application value.

1 Moving Target Detection Algorithm

There are many algorithms for realizing moving target detection, generally including optical flow method, background difference method, adjacent frame difference method, etc. The optical flow method realizes motion detection by solving the optical flow equation. Its algorithm is complex, the amount of calculation is large, and it is difficult to meet the real-time requirements; while the adjacent frame difference method has a simple algorithm and a small amount of calculation, but its anti-interference ability is very poor, and the detection effect is not ideal; while the background difference method has a simple algorithm, a small amount of calculation, and a strong anti-interference ability. Therefore, this paper adopts this method to realize moving target detection. The specific steps are as follows: first, obtain the digital image for preprocessing, then use the background difference method to realize motion detection, and then use the Otsu method to perform adaptive threshold segmentation on the obtained image, and finally obtain the detected moving target through filtering. Figure 1 is the flow chart of moving target detection in this paper.

Flowchart of moving target detection www.elecfans.com

1.1 Image acquisition and preprocessing

Configure the system's video input and video output FVID drivers in CCS, obtain the digital YUV video stream corresponding to the video stream captured by the camera from the VPORT port of TMS320DM642, and store it in the cache IMG_CURRENT, IMG_PREVIOUS, and IMG_BACKGROUND. IMG CURRENT stores the current image, IMG_PREVIOUS stores the last stored image, and IMG BACKGROUND stores the image as the background image. The image resolution is 720×576, and each component is 8 bits. Since the acquired video image inevitably contains noise, these noises must be suppressed. This article uses Gaussian filtering to perform Gaussian filtering on the obtained YUV video information. The filtered image is saved in the IMG_CURRENT cache.

1.2 Background subtraction processing

After the video image is preprocessed, the background difference method is used to detect the moving image. The steps are as follows:

(1) Get a frame of image as the initial background Bg(x,y,tk);

(2) Get the next image again after 4 frames, and use it as the current image Curr(x,y,tk);

(3) According to the background difference method, the difference image Sub(x,y,tk)=|Curr(x,y,tk,)-Bg(x,y,tk) is obtained;

(4) Count all sums

, compared with the set threshold FF, if it is less than the threshold FF, the background is updated according to the following formula Bg(x,y,tk)=α*Curr(x,y,tk)+(1-α)*Bg(x,y,tk-1);

(5) Repeat steps (2) to (3) above.

In the above background difference method, a frame of image at the time of power-on can be randomly obtained as the initial background image. In order to make the difference between images more obvious, the next image is obtained as the current image at intervals of 4 frames, and background difference is performed to obtain the difference image. The sum of the grayscale of the difference image is compared with the set threshold FF to determine whether the current background needs to be updated. The threshold FF is an empirical value, and this paper takes 20000. The coefficient a in the background update formula reflects the speed of background update, and its value range is between [0, 1]. The larger a is, the faster the background update speed is, and the smaller a is, the slower the background update speed is.

1.3 Binarization of difference image

The difference image is binarized according to the following formula:

The threshold TR in the formula is obtained by Otsu method. In actual testing, it is found that when the threshold TR obtained by Otsu method is directly used to process the differential image binarization, if there is no object movement, the binarized image is a noisy binary image. It is difficult to completely eliminate the binary noise image directly processed in the subsequent morphological filtering. By analyzing the histogram of the differential image, it is found that when there is no object movement, the histogram of the differential image is mainly distributed between 0 and 10, and the threshold obtained by Otsu method is between 1 and 6; when there is object movement, the histogram of the differential image is distributed between 0 and 255, and the threshold obtained by Otsu method is above 20.

Based on the above analysis, this paper adopts an improved method. If the threshold obtained by the Otsu method is less than 10, it means that there is no object movement, otherwise it means that there is object movement. When the threshold is less than 10, the binarization is performed according to the following formula:

f(x,y,tk)=0 when TR<10

That is, when there is no object movement, the obtained binary image should be completely black, so that the subsequent morphological processing only needs to process the binary image when there is object movement. Figure 2 shows the results of direct binarization when there is no object movement and binarization using the improved method. Among them, a) is the result of the difference image when there is no object movement when the threshold is directly obtained by Otsu's method. It can be seen that the image is full of noise; b) is the result of the difference image segmentation when there is no object movement after judging the threshold obtained by Otsu's method. It can be seen that the image is completely black at this time, that is, there is no moving object, which is consistent with the actual situation and simplifies the subsequent morphological processing.

2 TMS320DM642 Implementation of Algorithm

2.1 Hardware Platform

The hardware platform uses TMS320DM642 as the CPU, and the main frequency of the chip is 600MHz. The video codec chip uses SAA7115H and SAA7105H. In addition, two SDRAM chips (4M×64bit) are used as storage media for temporary image storage, and a FLASH is used to achieve self-starting. The hardware platform block diagram is shown in Figure 3.

This hardware platform obtains analog images from the camera, and obtains standard YUV4:2:2 digital image code stream in BT.656 format through SAA7115 decoding, and then temporarily stores the code stream in SDRAM through the EDMA function of DM642, and then processes it with the algorithm, and then sends it to SAA7105 for decoding through the EDMA function of DM642, and outputs it through the CVBS pin, so that the processing results of the system can be displayed in real time on the monitor.

2.2 DM642 Implementation of the Algorithm

The system software is completed in the integrated development environment CCS provided by TI. The programming is implemented in C language and assembly language. The software adopts the RF-5 architecture recommended by TI and uses three threads tsk_inpu-t, tsk_process, and tsk_output.

The execution flow of the software is as follows:

(1) Initialization of TMS320DM642. Including initializing BIOS, CSL, and setting CACKE;

(2) Initialize the RF-5 module. Use CHAN_init, ICC_init, and SCOM_init to initialize the CHAN module, ICC module, and SCOM module respectively;

(3) DSP/BIOS schedules the execution of three threads, tsk_input, tsk_process, and tsk_output, according to the scheduling rules of the operating system. Among them, tsk_inpufi calls the FVID driver by calling the FVID_create, FVID_control, and FVID_aUoc functions in sequence, opens the input channel, and obtains the YUV422 digital video code stream in BT.656 format obtained by SAA7ll5. tsk_process is responsible for processing the digital image obtained by the tsk_input thread using the motion image detection algorithm, which calls the algorithm function described in the previous section. After processing, the moving target is segmented. tsk-output is responsible for calling the FVID_create, FVID_control, and FVID_alloc functions, opening the output channel to output the segmented digital video stream through SAA7105 and display it on the monitor. These three threads run in parallel under the scheduling of DSP/BIOS, and data exchange between the three threads is realized through the SCOM module.

In the above program, the core program is the tsk_process thread, and its main code is as follows:

While(1)

{……

Background(): //Get the background and update it according to the conditions

Diff_picture(): //Difference between background and current image

Otsu_binary(): //Threshold segmentation and binarization using the improved Otsu method

Filter_obitct(): //Filter the binary image to obtain the moving object, which is the detection result.

}

2.3 Software Optimization

When using TMS320DM6425 to develop a moving target detection system, software code optimization is particularly important to ensure efficient and real-time detection results. When programming based on TMS320DM642, we refer to the characteristics of the chip and make the following optimizations when writing the algorithm:

(1) Use pipeline technology. Use the compilation options -o2 and -o3 to make full use of software pipeline technology to improve operating efficiency.

(2) Optimize registers. Use the performance analysis tool Profiler provided by CCS to rewrite frequently called C language code in assembly language and use the assembly optimizer to optimize it to maximize the execution efficiency of the code.

2.4 Experimental Results

The experimental results of the moving target detection system based on DM642 are shown in Figure 3.

3 Conclusion

This paper uses TI's dedicated image processing chip TMS320DM642 to build a hardware platform, uses background difference method to detect moving objects, uses Otsu's method to obtain adaptive threshold, and judges whether there is object movement according to the threshold value, which simplifies the subsequent morphological processing, and then binarizes the differential image, and finally uses morphological processing to eliminate isolated points. After experiments, the motion detection system in this paper has strong adaptability, can avoid background deadlock, and can minimize the occurrence of ghosting and voids.

Keywords:DM642 Reference address:Real-time moving target detection system based on DM642

Previous article:Reliability Design Based on MC68HC376 Single Chip Microcomputer
Next article:What is visual programming of microcontrollers?

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号