“Before we introduced the real-time image acquisition method of the MV-EM130M industrial camera, this article combined with the image processing function of labview to give a simple image processing VI. The image processing here includes sampling the image to find the same image as the sampling point. In order to find the sampling points placed at an angle, the image is flipped 360° while searching, so that the same points on the image can be found.
Before we introduced the real-time image acquisition method of the MV-EM130M industrial camera, this article combined with the image processing function of labview to give a simple image processing VI. The image processing here includes sampling the image to find the same image as the sampling point. In order to find the sampling points placed at an angle, the image is flipped 360° while searching, so that the same points on the image can be found.
As the software runs more complex, the data collection is real-time, and the processing speed is required to be relatively fast, so it must be designed as a whole, and the call and execution sequence of the controls should be reasonably arranged. A large loop is used in this program to keep the program running continuously. A sequence structure is called internally to control the execution sequence of the program, so as to ensure that the program proceeds according to the programmer’s idea.
Image acquisition & flow chart of the entire program
After the image data is read, the pixels to be searched must be set. This is achieved by a cursor selection function. First use the function IMAQ Setup Learn Pattern 2 to set the items that need to be recorded, and then use the IMAQ Extract function to set the cursor. In this way, the image data of the cursor area is recorded.
Set lookup pixel
Here a condition structure is used to control whether to enter the program for recording pixels, that is, when the pixel to be recorded is selected, the branch program is entered. In this branch program, a sequence structure is used, which improves the efficiency of program operation.
Reset record button
After setting the pixel to be searched above, you can search for this pixel in the image you need. In order to find useful pixels, after selecting “Start Search”, the pixels marked above must be read first, and then the search is performed. In the design of the program here, a condition structure is also run first, and then a sequence structure is run, and the program is executed in sequence.
Read selected pixels
After reading the pixels, use the sequential structure to continue searching in the second frame of the image. A loop is placed in this frame, and the number of loops is limited to 4. At this point, first use an IMAQ Rotate to flip the image, flipping 90° each time. In this way, it is possible to flip one circle in the loop 4 times to search for the pixels of each angle on the image. Then send the image to the IMAQ Match Pattern 2 function to search for it. Directly output the array of the pixel information found through this function. In order to process the information found, a For loop is used to split the data and clusters.
After the program is written, it is necessary to carry out on-line debugging of the system’s software and hardware. Here, connect the MV-EM130M industrial camera of Weishi Imaging to the computer with a network cable, and install the driver on the computer. The specific operations are as follows:
(1) Run this program, place a circuit board under the camera, and set the focal length and brightness to it. Click the “Start Collection” button to collect it and Display the real-time collected images.
(2) After collecting once, you can see the clear collection result on the interface. At this time, we use the cursor to draw an area where we need to identify. At this time, the cursor turns green, indicating that the pixel to be recorded has been selected with the cursor. Then click the “study mark” button, the cursor disappears, indicating that the recording (learning) has been completed. Here is the letter C on the circuit board, let the program learn the record, and find all the letters C on the interface.
Set up a learning area
(3) After the record learning is completed, you can search for points with the same pixel. After clicking the “Start Search” button, the program starts to search for the recorded pixels on this map, and compares them with this pixel as the standard to find the same points. In the process of searching, the coordinates and numbers of each point are marked. Here, set the label type to “A”, search by Shift Invariant, set the precision to 700, and set the maximum number to 40. In this way, all the same elements can be found.
As can be seen from the figure, during the search process, the program found all the letters C, and marked their coordinates and labels. Some of the labels here are not correct, mainly because when the picture is flipped and searched, it is directly marked after being found at the corresponding angle. For example, the meaning of label A43 (70, 471) is as follows: The letter A is the label type set before searching the program. 4 means that this picture is flipped to the 4th found, that is, the 4th angle. 3 means the third point under this angle. (70,471) represents the center coordinates of the pixel currently found, that is, X=70, Y=471 of this target, and the coordinate values are calculated from the upper left corner of the image starting from the interface. At the same time, you can see that the bottom of the interface shows the attributes of the picture, such as picture size, number of bits, etc. Finally, you can see a box of “Total Numbers Found”, where 8 targets are displayed. This is the same as the one marked on the figure, and it also corresponds to the actual situation.
It can be seen from the above routine that it is more convenient and efficient to use an industrial camera that is directly compatible with labview driver to do image processing in labview.
The Links: LTM150XI-A01 LB084S02-TD02