LabVIEW applied to real-time image acquisition and processing system

Publisher:科技创客Latest update time:2011-07-02 Keywords:LabVIEW Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Introduction

LabVIEW, a virtual instrument development platform of National Instruments (NI), uses a graphical programming language, has a friendly interface, is easy to learn, and its matching image processing software package provides a wealth of image processing and analysis algorithm functions, greatly facilitating users and making it easy and flexible to build image processing and analysis systems, with good program portability, thus greatly shortening the system development cycle. On the basis of launching application software, NI has also launched image acquisition cards. For NI's image acquisition cards, you can directly use the acquisition card's built-in driver and the DAQ library in LabVIEW to directly operate the port.

However, due to the high cost of NI's image acquisition card, most users cannot accept it, so the hardware platform often uses a general image acquisition card, and the image processing program in the software is still written in LabVIEW and video processing modules. Based on this purpose, this paper proposes a solution to drive a general image acquisition card in the LabVIEW environment, and completes real-time image acquisition and processing on the platform of the TDS642EVM high-speed DSP video processing board.

In the image processing work, the radiation calibration of CCD photoelectric detector is mainly completed. When the detector acquires images in the natural environment, it will be affected by atmospheric interference, its own dark current, thermal noise, etc., which will cause a difference between the numerical quantization value of the signal output by the CCD pixel and the actual radiation brightness of the detected target. Therefore, in order to obtain an accurate image of the target, the detector must be calibrated for radiation.

2. Image acquisition card introduction

Wenting's TDS642EVM (abbreviated as 642) multi-channel real-time video processing board is an evaluation development board designed based on the DSP TMS320DM642 chip. The computing power can reach 4Gips. The video interface on the board is connected to the video codec chip Philips SAA7115H to realize real-time multi-channel video image acquisition function and support multiple PAL, NTSC and SECAM video standards. This system exchanges data with the host through the PCI interface of 642. PCI supports the "plug and play (PnP)" automatic configuration function, making the configuration of the image acquisition board more convenient. The setting of all its resource requirements is handled by BIOS when the system is first started, without the need for users to perform tedious switch and jumper operations. The massive data throughput of the PCI interface provides a guarantee for its completion of real-time image acquisition and processing.

3. System composition and working principle

Figure 1. Image acquisition and real-time processing system block diagram

The image acquisition process is the process in which the image acquisition board performs analog-to-digital conversion on the standard video signal (PAL format) from the CCD, transmits the quantized data to the computer memory through the PCI bus, and then reads and displays it through the compiled application.

As shown in Figure 1, the video analog signal output by the color CCD camera is converted into a digital signal by the decoder SAA7115 and input into the 642 chip. The 642 outputs the processed real-time digital image signal to the encoder, which converts the digital signal into a standard PAL format YCbCr video signal and outputs it to the LCD. At the same time, the output Y-Cb-Cr format digital video signal is buffered by the internal FIFO of the video port, and then the 642 transmits the data to the off-chip synchronous dynamic memory chip SDRAM through EDMA, including four groups of data, namely Sem_flag variable (8bit); Y: Cb: Cr (4:1:1) image signal: Y (720*574*8bit) array, Cb (360*287*8bit) array, Cr (360*287*8bit) array are stored at 0x80003804, 0x8102E000, 0x81092E80, 0x810AC280 addresses in SDRAM respectively for application use.

The video acquisition application is compiled by LabVIEW. When image acquisition is needed, LabVIEW sends a request to read the YCbCr format image data stored in SDRAM. After 642 receives the request, it starts to acquire images and stores the acquired YCbCr values ​​in the corresponding memory address. After 642 completes the acquisition of a whole frame of images, it sets the flag variable Sem in SDRAM to 0. LabVIEW reads the value of the flag variable in a loop during this process. When it is 0, it obtains image data from SDRAM, that is, the data of the three arrays of Y, Cb, and Cr, and then converts it into the standard RGB format that LabVIEW can display and outputs the image. [page]

4. Image acquisition and image processing

4.1 Calling the dynamic link library to drive the image acquisition card

NI's image acquisition cards come with card drivers and management programs. For ordinary I/O cards, they cannot be directly used by LabVIEW and other methods must be used. LabVIEW provides four ways to call external program codes: direct port operation, calling library function nodes (Call Library Function Node, CLFN) to call DLL (Dynamic Link Library), using CIN (Code Interface Node, external code node), and calling Active X controls. Among them, direct port operation uses PortIn.Vi and PortOut.vi functions. This method is simple to use, but it cannot realize more complex interface functions. With the dynamic link library, appropriate programs can be written according to specific needs, and the various functions of LabVIEW can be flexibly utilized. It has obvious advantages over the other three. Users can call Windows standard dynamic link libraries (DLLs) or call DLLs compiled by users themselves to realize the connection between LabVIEW and hardware.

The files needed to build a DLL are: ①h function declaration file (optional, can be included in the c source file); ②c source file (required); ③def module definition file (if standard calls or function outputs are used, the keyword __declspec (dllexport) function name must be added). The function of the h file is to declare the function prototypes to be implemented by the DLL for use in DLL compilation and application compilation. The c file is the source file that implements the specific file. It has an entry point function that performs some initialization work when the DLL is called for the first time. In general, users do not need to do any initialization work, just keep the entry point function framework. The def file is a special file in the DLL project. It is used to define which functions the DLL project will output. Only the functions listed in this file can be called by the application function. The function names to be output are listed under the EXPORTS keyword in this file.

This system uses the dynamic link library under the LabVIEW platform to realize image data acquisition, which is mainly divided into five steps: 1. Initialize and open the device (DM642 image acquisition card); 2. Read the flag signal bit to see if it is initialized to the default value; 3. Write the flag signal bit to collect image data; 4. Read the image data stored in SDRAM; 5. Close the handle and release the port resources. The main target functions of the dynamic link library sd_pci64.dll are PCI64_Open, PCI64_MemRead32 and PCI64_Close. The function functions are shown in the following table:

The specific parameters of the function are as follows:

①PCI64_API INT32 PCI64_Open ( int BoardNum, PCI64_HANDLE * pHndl );

BoardNum board number (0-3), * pHndl returns an unsigned pointer to the handle. When the return value is 0, it means the port is opened successfully, and when it is non-zero, it means failure.

②PCI64_API INT32 PCI64_MemRead32 (PCI64_HANDLE Hndl, UINT32 Taddr, UINT32 Count, UINT32 * pData);

Get the handle pointer passed by PCI64_Open and read the data stored in the target address. It should be noted that the addressing space of the target address is within 4M, and an unsigned 32-bit array space of the required target data size must be initialized. Similarly, when the return value is 0, it means success, and non-zero means failure.

③PCI64_API INT32 PCI64_Close (PCI64_HANDLE Hndl);

It should be noted that after each call to PCI64_MemRead32 to complete the reading, the port must be closed to release the address space.

The specific calling process is as follows: First, in the Block Diagram of the newly created VI, add the Call Library Function Node control in the Function> Advanced submenu, and then configure it. The configuration dialog box after adding the node is shown in Figure 2:

Figure 2 Calling CLFN configuration block diagram [page]

Set the DLLs file name and storage path, function calling method, name of the target function to be called, number of parameters, type of each parameter, data type and return value type. After setting, click "OK" to return to the LabVIEW design panel (diagram). At this time, Call Library Function has set the input and output ports according to the number and type of parameters just configured. Like other LabVIEW node icons, you only need to connect the corresponding parameters.

The program calls the target functions PCI64_Open, PCI64_MemRead32 and PCI64_Close of sd_pci64.dll to complete the reading of data of the specified address space 0x8102E000 converted to decimal 21*49280, 103320, and finally stores the read data in the unsigned 32-bit pData array.

In LabVIEW, the CLFN node can be used to easily access the dynamic link library (DLL). Since DLL is an external module, it improves the efficiency of program development. When purchasing ordinary data acquisition cards, manufacturers generally provide users with dynamic link libraries (DLL). Therefore, studying the method of driving ordinary image acquisition cards to realize image acquisition by calling dynamic link library functions under the LabVIEW platform has become a method worth promoting and has important significance.

4.2 CCD Image Calibration

To complete the calibration of CCD image data, digital image processing is the key to the calibration process. The image processing module IMAQ Vision provided by NI provides a complete image processing function library for the LabVIEW platform, such as various edge detection operators, automatic threshold processing, various morphological algorithms, filters, FFT, etc. The library contains a large number of theoretical algorithms that have been proven to be successful, allowing users to quickly develop excellent image processing and analysis systems suitable for their profession without professional programming experience.

In this system, the steps for relative radiation calibration of CCD photoelectric detectors are as follows: 10 images are collected under standard light source illumination and ordinary calibration environment respectively, and the influence of factors such as dark current thermal noise is eliminated through automatic threshold processing and binarization. The average of the 10 images obtained after processing is taken as the main standard image and the main reference image. For the gray value of each pixel on the image, the non-uniform response correction of the CCD pixel is completed through comparison and correction, and the respective calibration coefficients are calculated, and the gray histogram is drawn. The front panel of the specific program is shown in Figure 3:


Figure 3 Program front panel

5. Conclusion

This paper uses the TDS642EVM image acquisition card to develop a stable, reliable, economical and flexible real-time image acquisition and processing system on the LabVIEW platform. By calling the dynamic link library, the image acquisition card is driven to complete image acquisition; the powerful image processing function provided by NI-IMAQ Vision is used to complete the radiation calibration of the CCD photoelectric detector through real-time image processing. The openness, high programming flexibility and good interface of LabVIEW make the development of advanced and complex applications simple; the dynamic link library mechanism provides LabVIEW with a universal and feasible way to support general image acquisition cards.

The author's innovation point is to design a system that can complete real-time image acquisition of ordinary image acquisition cards and radiation calibration of photoelectric detectors on the LabVIEW platform.

Keywords:LabVIEW Reference address:LabVIEW applied to real-time image acquisition and processing system

Previous article:Design of resolver/digital conversion system based on virtual instrument
Next article:CSDB Bus Data Test Based on LabVIEW

Recommended ReadingLatest update time:2024-11-17 02:34

Implement the design of integrated chip tester using LabVIEW development platform and microcontroller
introduction In the experimental teaching of electronic majors in colleges and universities, digital integrated circuits are used very frequently. Students need to use a large number of digital integrated chips every year in practical activities such as experiments, course design, and extracurricular innovation to com
[Test Measurement]
Implement the design of integrated chip tester using LabVIEW development platform and microcontroller
LabVIEW Case Structure
When the LabVIEW conditional structure displays 0, 1, 2, 3, if the preceding output is a digital type, then 0 is true (all assumptions are not true), 1 is the first case, 2 is the second, 2^2 (4) is the third, and 2^3 (8) is the fourth.
[Test Measurement]
Storage of test measurement data in LabVIEW (7)
           Finally, I have written about TDMS. It is finally here after much anticipation. Actually, all the previous related articles are the preparation for TDMS. It is precisely because of the various requirements raised by users and the shortcomings of other file formats that TDMS came into being.            1. Lo
[Test Measurement]
Labview tutorial chart how to display data discontinuously
Labview Tutorial: Chart How to Display Data Discontinuously      The internal data structure of the chart is a FIFO buffer with a default length of 1024. It can input single-point data or array-type data, that is, it can display a single curve or multiple curves at the same time. Taking a single curve as an example,
[Test Measurement]
Labview tutorial chart how to display data discontinuously
The Magical Use of Image Drop-down List in LabVIEW
Sometimes, we want to display different states on the front panel, similar to the chess pieces in Go, we need three states: black, white, and no pieces. If we use LEDs to represent them, there can only be two states, which obviously does not meet our requirements, so we need to use a picture drop-down list to express b
[Test Measurement]
Controlling a dual robotic system to provide upper limb therapy to stroke patients
Patient undergoing upper limb therapeutic exercise using the iPAM system challenge: Develop a safe and reliable robotic rehabilitation system to assist patients with arm disability after stroke to assist in the treatment of arm movement, coordination and guidance of the arm. Solution:
[Test Measurement]
Controlling a dual robotic system to provide upper limb therapy to stroke patients
Solution to the problem that the relative path cannot be used after Labview generates an exe executable file
In the process of LabVIEW programming, the "Current VI Path" module is often used. By combining it with the "Create Path" module, you can get any path in the directory where the VI is located. However, after the vi file is packaged into an exe file, because labview will regard the exe as an additional layer of director
[Test Measurement]
Design of ECG signal acquisition and analysis based on LabVIEW
Biomedical electrical signals, such as ECG signals, blood pressure signals, and EEG signals, all represent certain pathological characteristics. Taking ECG as an example, ECG is usually used to record the bioelectric current generated by the heart. Clinicians can use ECG to evaluate the patient's heart condition and
[Industrial Control]
Design of ECG signal acquisition and analysis based on LabVIEW
Latest Test Measurement Articles
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号