Design and Implementation of Moving Target Detection System Based on DM642

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 system, moving target detection is the basis of subsequent target recognition and target tracking. This paper proposes a real-time moving target detection system based on DM642. It relies on the powerful computing power of DM642 chip to ensure the data throughput and real-time performance of target detection. The scheme is reasonable in design, strong in scalability, and has practical application value.

1 The moving target detection algorithm implements many algorithms for moving target detection, generally including optical flow method, background difference method, and adjacent frame difference method. The optical flow method realizes motion detection by solving the optical flow equation. The algorithm is complex and computationally intensive, and it is difficult to meet the real-time requirements. The adjacent inter-frame difference method is simple in algorithm and small in computation, but its anti-interference ability is very poor. The detection effect is not ideal; the background difference method is simple, the calculation is small, and the anti-interference ability is strong. Therefore, this method is used to realize the moving target detection. The specific steps are as follows: firstly, the digital image is obtained for pre-processing, then the background difference method is used to realize the motion detection, and then the obtained image is subjected to adaptive threshold segmentation by the Otsu method, and finally the detected moving target is obtained by filtering. Figure 1 is a flow chart of moving object detection in this paper.

This article refers to the address: http://


1.1 Image Acquisition and Pre-Processing Configure the video input and video output FVID driver 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 In IMG_BACKGROUND, IMG CURRENT stores the current image, IMG_PREVIOUS stores the last image stored, and IMG BACKGROUND stores the image as the background image. The resolution of the image is 720 x 576, and each component is 8 bits. Since the acquired video image inevitably contains noise, these noises must be suppressed. Gaussian filtering is used to perform Gaussian filtering on the obtained YUV video information. The filtered image is saved to the IMG_CURRENT cache.

1.2 Background Difference Processing After processing the video image, the motion image is detected by the background difference method. The steps are as follows:
(1) Acquiring a frame of image as the initial background Bg(x, y, tk);
(2) The next image is acquired again at intervals of 4 frames as the current image Curr(x, y, tk);
(3) Obtain the difference image Sub(x, y, tk)=|Curr(x, y, tk,)-Bg(x, y, tk) according to the background difference method;
(4) Statistics all values Compared with the set threshold FF, if it is less than the threshold FF, the background update is performed as follows: Bg(x, y, tk) = α * Curr(x, y, tk) + (1 - α) * Bg (x, y, tk-1);
(5) Repeat the steps of (2) to (3) above.
In the above background difference method, one frame of the image at the start time can be randomly obtained as an initial background image. In order to make the difference between the images more obvious, the next image is obtained as the current image at intervals of 4 frames, the difference image is obtained by the background difference, and the sum of the gray levels of the difference images is compared with the set threshold FF to determine whether Need to update the current background, the threshold FF is the empirical value, this article takes 20000. The coefficient a in the background update formula reflects the background update speed, and its value range is between [0, 1]. The larger a is, the faster the background update speed is. The smaller a is, the slower the background update speed is.
1.3 Binarization of the difference image The difference image is binarized according to the following formula:

The threshold value TR in the formula is obtained by the Otsu method. In the actual test, it was found that when the differential value binarization was directly processed by the threshold TR obtained by the Otsu method, if there is no object motion, the binarized image is a binarized image of noise, so that the direct processing is obtained. The binarized noise image is difficult to completely eliminate in the subsequent morphological filtering. By analyzing the histogram of the difference image, it is found that when there is no object motion, the histogram of the difference image is mainly distributed between 0 and 10, and the Dajin method is obtained. The threshold value is between 1 and 6. When there is an object moving, the histogram of the difference image is distributed between 0 and 255. At this time, the threshold value obtained by the Dajin method is 20 or more.
Based on the above analysis, this paper adopts an improved method. If the threshold obtained by the Dajin method is less than 10, it means that there is no object motion, otherwise it means that there is object motion. When the threshold is less than 10, the binarization process f is performed according to the following formula ( x, y, tk) = 0 when TR < 10
That is, when there is no object motion, the acquired binarized image should be all black, so that the subsequent morphological processing only needs to process the binarized image when there is object motion. Figure 2 shows the results of direct binarization without object motion and binarization with improved methods. Where a) is the result of the differential image obtained by directly using the threshold value obtained by the Otsu method when there is no object motion, and it can be seen that the figure is full of noise; b) after judging the threshold value obtained by the Otsu method, when there is no object motion As a result of the differential image segmentation, 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, which simplifies the subsequent morphological processing.



2 algorithm implementation of TMS320DM642
2.1 Hardware platform The
hardware platform adopts TMS320DM642 as the CPU, and the chip has a frequency of 600MHz. The video codec chip uses the SAA7115H and SAA7105H. In addition, two SDRAMs (4M×64bi-t) chips are used as storage media for temporary storage of images. At the same time, one FLASH is used for self-starting. The block diagram of the hardware platform is shown in Figure 3.


This hardware platform acquires analog images from the camera and is decoded by SAA7115 to obtain standard. BT. YUV4:2:2 digital image code stream of 656 format, then the code stream is temporarily stored in SDRAM by DM642 EDMA function, and then processed by algorithm, then sent to SAA7105 for decoding by DM642 EDMA function, after CVBS The foot output, so that the processing results of the system can be displayed on the display in real time.
2.2 The DM642 implementation of the algorithm The software of the system 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 adopts three threads tsk_inpu-t, tsk_process, Tsk_output.
The software execution process is as follows:
(1) Initialization of TMS320DM642. Including initializing BIOS, CSL, setting CACKE;
(2) Initialize the RF-5 module. Initialize the CHAN module, ICC module, and SCOM module with CHAN_init, ICC_init, and SCOM_init respectively.
(3) DSP/BIOS executes three threads of tsk_input, tsk_process, and tsk_output according to the scheduling rules of the operating system. The tsk_inpufi calls the FVID_create, FVID_control, and FVID_aUoc functions in order to implement the call to the FVID driver, and opens the input channel to obtain the BT obtained by the SAA7ll5. YUV422 digital video stream in 656 format. Tsk_process is responsible for processing the moving image detection algorithm of the digital image acquired by the tsk_input thread, wherein the algorithm function described in the previous section is called, and after processing, the moving target is segmented. Tsk-output is responsible for calling the FVID_create, FVID_control, and FVID_alloc functions, and opening the output channel to realize the digital video stream that has been divided and processed through the SAA7105 output, and displayed on the display. These three threads run in parallel under the DSP/BIOS schedule, and the data exchange between the three threads is implemented by 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 the Diff_picture() according to the condition. The background is different from the current image. Otsu_binary(): //The threshold is divided by the improved Otsu method and binarized Filter_obitct()://p. The valued image is filtered to obtain a moving object, which is the result of the detection.
......
}
2.3 Software Optimization Application When developing the moving target detection system, TMS320DM6425 is especially important for ensuring efficient and real-time detection of software code. When programming based on TMS320DM642, we optimized the following when writing the algorithm with reference to the characteristics of the chip:
(1) Using pipeline technology. Use the compile options -o2, -o3 to make full use of the software pipeline to improve operational efficiency.
(2) Optimize the register, and use the performance analysis tool Profiler of CCS to rewrite the C language code with high calling frequency in assembly language, and optimize it with the assembly optimizer 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 Conclusions This paper uses TI's special image processing chip TMS320DM642 to build a hardware platform, using background difference method to detect moving objects, using Dajin method to obtain adaptive threshold, and judging whether there is object motion according to the value of the threshold, thus simplifying the follow-up The morphological processing, then the binarization of the difference image, and finally the morphological processing to eliminate the isolated points. After the experiment, the motion detection system of this paper has a strong adaptability, can avoid the background deadlock situation, and can Maximum suppression of smear and voiding.

Ceramic Insulator

Ceramic Insulator,Ceramic Electrical Insulators,Ceramic Standoff Insulators,Ceramic Isolators

Yixing Guangming Special Ceramics Co.,Ltd , https://www.yxgmtc.com