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.
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
- Popular Resources
- Popular amplifiers
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Arduino Nano collects temperature and humidity data through LabVIEW and DHT11
- Modern Testing Technology and System Integration (Liu Junhua)
- Computer Control System Analysis, Design and Implementation Technology (Edited by Li Dongsheng, Zhu Wenxing, Gao Rui)
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- Single Voltage Reference vs. Dual Voltage Reference - III
- How to prevent excessive current when controlling multiple uln2003-driven stepper motors?
- DSP28335 Hardware Overview and Registers
- EEWORLD University Hall -- Experts teach you how to DIY a pocket PC
- Chapter 6 Application of SPI - OLED Display
- PCB circuit board questions
- STMicroelectronics SiC products and industrial application guide live data collection
- MSP430 capture device is simple and practical
- Colorful wallet programmed with CircuitPython
- The storage and downloading of time values sent by customers require sum verification or CRC verification