Debugging method of camera
Debugging method of camera
In the embedded system of image processing, because of the processing and analysis involving machine vision, it becomes more troublesome to debug the camera of the image generation tool.
Visual introduction
Machine vision is to use machines instead of human eyes to perceive the external environment and make measurements and judgments. The captured target is converted into an image signal through an imaging device (ie, image capture device, divided into CMOS and CCD), which is transmitted to a dedicated image processing system, and converted into a digital signal according to the pixel distribution, brightness, color and other information; image system Perform various operations on these signals to extract the characteristics of the target, and then control the actions of the equipment on the spot according to the results of the discrimination. In some systems that require high real-time actions of the system, human response speed and information processing capabilities cannot meet the requirements, and machine vision is easy to achieve information integration, and the combination of computer control systems can improve the automation of the system.
Debug purpose
The purpose of camera debugging in embedded systems is to enable the mechanical and electrical parameters of the camera to produce the highest quality image data under the system requirements. For an imaging system involving hardware and software, the quality of imaging is often affected by many factors from outside interference and its own limitations. These effects will produce noise and uneven imaging. Factors from the software level are often algorithmic problems. Problems at this level can be solved by theoretical analysis and mathematical calculations. Factors from the hardware level need to be debugged with instruments and can be solved through experimental measurement and analysis. Because the bottom layer of the hardware processing system, Therefore, the quality of the hardware will directly affect the quality of the software, thereby affecting the final image quality. Debugging the camera is to eliminate interference as much as possible from the hardware level.
Debugging method
Since the embedded system is a relatively broad concept, this article uses the HCS12 as the main control chip to debug the camera group trolley as an example to introduce the debugging method.
(1) Connect the external circuit to the CRT display
Lead out the three leads of power, ground, and signal from the analog camera to supply power to the camera, and then connect the video signal line to the video input interface of the TV box. The VGA-OUT of the TV box is connected to the CRT display, so that the CRT can display the digitized camera vision. This method is a complete hardware-level display, providing a display effect exactly the same as human vision, which is of great help to the installation of the camera and the correction of its own physical parameters.
(2) Extend LCD liquid crystal outside the chip
The HCS12 series MCU contains a serial peripheral interface SPI (Serial Peripheral Interface), which can realize data transmission between MCUs, and its speed is faster than through serial asynchronous communication (SCI). The SPI module also supports two-way, synchronous, and serial communication between the MCU and peripheral devices, and realizes the peripheral expansion of the MCU.
1. When the system is running, the displayed characters will prompt the relevant operating parameters of the system in character form. Each character occupies 8*6 points and requires 6 bytes of data. To complete the character display, you only need to write the corresponding data to the specified position in the programming. Since the liquid crystal module itself does not have a font library, the liquid crystal display dot matrix data of ASCⅡ table characters must be defined at the beginning of the program, that is, a two-dimensional array with a size of N*6 bytes.
2. Display the picture After the video signal collected by the analog camera is digitalized by the A/D of the MCU, the information is stored in a 40*70 two-dimensional array, and then the array is binarized, and it can be displayed in a 48*84 resolution LCD module , Enabling developers to observe the camera machine vision in real time.
This method is a display method that combines hardware and software, which can track and display camera-related information in real time without interrupting the system operation process during display.
(3) Self-written serial communication host computer software
The SCI module of the MCU is used to send the picture data to the PC, and the upper computer uses the MSCOMM control programming to read the communication data. After reading the data, you can use the powerful data processing capabilities and picture display capabilities of the windows program to process the picture data, such as: redrawing the picture according to the data, filtering the array and displaying the filtering effect, and exporting the receiving array as a file Provide data sources for computer simulation.
This method is a complete software display method, only to receive the data from the MCU, a series of processing can be realized on the PC, and it has advantages that other methods can't compare to the inspection of graphics transformation effects, the pros and cons of filtering analysis, and the idea of data simulation. .
Comparison of advantages and disadvantages
1. CRT modulation method. By connecting to the camera video signal, CRT can display machine vision with high fidelity. But it can only be limited to the camera parameter test and the camera mechanical position adjustment, and there is nothing to do with the digital signal of the advanced point.
2. LCD debugging method. It is directly connected to the SPI port of the single-chip microcomputer for data transmission, which can refresh the display picture in real time. This module can be directly mounted on the system to display system related information in real time. However, due to the limitation of the module's resolution, only black and white binary values can be displayed, resulting in distortion of digital pictures.
3. Serial debugging method. It can make full use of the powerful data processing and picture display functions of the PC, can realize the high-precision pixel display of digital pictures, and export the gray scale value table to provide field data for VC and MATLAB simulation. However, the data transmission speed between PC and MCU is too slow, lacks real-time performance, and lacks the advantages of dynamic tracking.
In the embedded system of image processing, because of the processing and analysis involving machine vision, it becomes more troublesome to debug the camera of the image generation tool.
Visual introduction
Machine vision is to use machines instead of human eyes to perceive the external environment and make measurements and judgments. The captured target is converted into an image signal through an imaging device (ie, image capture device, divided into CMOS and CCD), which is transmitted to a dedicated image processing system, and converted into a digital signal according to the pixel distribution, brightness, color and other information; image system Perform various operations on these signals to extract the characteristics of the target, and then control the actions of the equipment on the spot according to the results of the discrimination. In some systems that require high real-time actions of the system, human response speed and information processing capabilities cannot meet the requirements, and machine vision is easy to achieve information integration, and the combination of computer control systems can improve the automation of the system.
Debug purpose
The purpose of camera debugging in embedded systems is to enable the mechanical and electrical parameters of the camera to produce the highest quality image data under the system requirements. For an imaging system involving hardware and software, the quality of imaging is often affected by many factors from outside interference and its own limitations. These effects will produce noise and uneven imaging. Factors from the software level are often algorithmic problems. Problems at this level can be solved by theoretical analysis and mathematical calculations. Factors from the hardware level need to be debugged with instruments and can be solved through experimental measurement and analysis. Because the bottom layer of the hardware processing system, Therefore, the quality of the hardware will directly affect the quality of the software, thereby affecting the final image quality. Debugging the camera is to eliminate interference as much as possible from the hardware level.
Debugging method
Since the embedded system is a relatively broad concept, this article uses the HCS12 as the main control chip to debug the camera group trolley as an example to introduce the debugging method.
(1) Connect the external circuit to the CRT display
Lead out the three leads of power, ground, and signal from the analog camera to supply power to the camera, and then connect the video signal line to the video input interface of the TV box. The VGA-OUT of the TV box is connected to the CRT display, so that the CRT can display the digitized camera vision. This method is a complete hardware-level display, providing a display effect exactly the same as human vision, which is of great help to the installation of the camera and the correction of its own physical parameters.
(2) Extend LCD liquid crystal outside the chip
The HCS12 series MCU contains a serial peripheral interface SPI (Serial Peripheral Interface), which can realize data transmission between MCUs, and its speed is faster than through serial asynchronous communication (SCI). The SPI module also supports two-way, synchronous, and serial communication between the MCU and peripheral devices, and realizes the peripheral expansion of the MCU.
1. When the system is running, the displayed characters will prompt the relevant operating parameters of the system in character form. Each character occupies 8*6 points and requires 6 bytes of data. To complete the character display, you only need to write the corresponding data to the specified position in the programming. Since the liquid crystal module itself does not have a font library, the liquid crystal display dot matrix data of ASCⅡ table characters must be defined at the beginning of the program, that is, a two-dimensional array with a size of N*6 bytes.
2. Display the picture After the video signal collected by the analog camera is digitalized by the A/D of the MCU, the information is stored in a 40*70 two-dimensional array, and then the array is binarized, and it can be displayed in a 48*84 resolution LCD module , Enabling developers to observe the camera machine vision in real time.
This method is a display method that combines hardware and software, which can track and display camera-related information in real time without interrupting the system operation process during display.
(3) Self-written serial communication host computer software
The SCI module of the MCU is used to send the picture data to the PC, and the upper computer uses the MSCOMM control programming to read the communication data. After reading the data, you can use the powerful data processing capabilities and picture display capabilities of the windows program to process the picture data, such as: redrawing the picture according to the data, filtering the array and displaying the filtering effect, and exporting the receiving array as a file Provide data sources for computer simulation.
This method is a complete software display method, only to receive the data from the MCU, a series of processing can be realized on the PC, and it has advantages that other methods can't compare to the inspection of graphics transformation effects, the pros and cons of filtering analysis, and the idea of data simulation. .
Comparison of advantages and disadvantages
1. CRT modulation method. By connecting to the camera video signal, CRT can display machine vision with high fidelity. But it can only be limited to the camera parameter test and the camera mechanical position adjustment, and there is nothing to do with the digital signal of the advanced point.
2. LCD debugging method. It is directly connected to the SPI port of the single-chip microcomputer for data transmission, which can refresh the display picture in real time. This module can be directly mounted on the system to display system related information in real time. However, due to the limitation of the module's resolution, only black and white binary values can be displayed, resulting in distortion of digital pictures.
3. Serial debugging method. It can make full use of the powerful data processing and picture display functions of the PC, can realize the high-precision pixel display of digital pictures, and export the gray scale value table to provide field data for VC and MATLAB simulation. However, the data transmission speed between PC and MCU is too slow, lacks real-time performance, and lacks the advantages of dynamic tracking.