Whole-pixel thickness square-ring search method from inside to outside
Through the search method of the entire pixel thickness back shape from the inside to the outside, the normalized correlation coefficient method is used to quickly locate feature points, which solves the problem that traditional methods are difficult to achieve real-time processing of multiple measurement points under high-frequency vibration, and improves measurement accuracy and speed.
Patent Information
- Application Number
- CN202211419550.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-14
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2042-11-14
AI Technical Summary
Traditional image measurement methods are difficult to realize real-time processing of multiple measurement points under high-frequency vibration, resulting in insufficient measurement accuracy and speed, and traditional algorithms are difficult to quickly locate feature points.
The complete pixel thickness back shape is searched from the inside out, and the correlation coefficient between the pixel value in the image to be searched and the marking points in the template image is calculated by normalized correlation coefficient method, and a back shape search is carried out to quickly locate feature points.
The speed and measurement accuracy of feature point search are improved, and the points near the previous frame can be quickly found under high-frequency vibration, shortening the test cycle.
Smart Images

Figure CN115757854B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image measurement, and particularly relates to a method for searching in a whole-pixel-thick and thin back-character shape from the inside out. Background Art
[0002] The positioning and tracking based on image feature markers are the main development directions of computer vision at present, and they have wide applications in aspects such as automotive autonomous driving, engineering surveying, and robot tracking. The time history relationships of the deformation, velocity, acceleration, etc. of a structure under seismic action are very important for studying the seismic performance of the structure. Traditional measurement methods mainly use accelerometers. The accelerometers obtain displacements through double integration. Due to the drift and noise of the accelerometers, the results will deviate from the true data after double integration. Therefore, new algorithms need to be developed to correct the calculation.
[0003] The digital image method can directly measure displacements, and its measurement results do not need to be processed, so its measurement accuracy is high and reliable. Digital image measurement mainly depends on image acquisition and the positioning and tracking algorithms of feature points. There are quite a lot of existing positioning and tracking algorithms, but for the real-time acquisition and processing of images under high-frequency vibrations, traditional algorithms cannot achieve the ability to process multiple measuring points in real time. The huge amount of data depends on post-processing, which makes the test cycle longer. Establishing a faster positioning and tracking algorithm is extremely important. Summary of the Invention
[0004] The purpose of the present invention is to provide a method for searching in a whole-pixel-thick and thin back-character shape from the inside out in view of the deficiencies of the above technologies, which can well improve the calculation efficiency and calculation performance.
[0005] To achieve the above purpose, the method for searching in a whole-pixel-thick and thin back-character shape from the inside out designed by the present invention includes the following steps:
[0006] A) Search preparation: For the template image and the image to be searched, take the black and white alternating marker points as the object to be measured, and use the normalized correlation coefficient method to calculate the correlation coefficient C between the pixel value of a certain pixel point in the image to be searched and the pixel value of the marker point in the template image. The calculation formula is as follows:
[0007]
[0008] In the formula, T is the pixel value of the marker point in the template image, I is the pixel value of a certain pixel point in the image to be searched, the matching size of the template image is (N + 1)×(N + 1), N is the number of pixel points from the center point of the template image to the boundary, i and j are the distances of the pixel points in the template image from the center point along the row and column respectively, i1 and j1 are the relative positions of the pixel points in the template image to the center point, T mis the average pixel value of the (N + 1)×(N + 1) area in the template image, I m is the average pixel value of the (N + 1)×(N + 1) area in the image to be searched, and the calculation formula is as follows:
[0009]
[0010]
[0011] B) Coarse cross-shaped search: In the image to be searched, with the position of the landmark point in the template image as the center point, perform a cross-shaped search in the order of horizontal search to the right, vertical search upward, horizontal search to the left, and vertical search downward. In the first cross-shaped search, the step size of the first search is d1 pixel values, d1 > 1. Every time two searches are performed, the step size of the next two searches increases by d1 pixel values, and so on. The step sizes of the four searches in the i-th cross-shaped search are (2i - 1)d1 pixel values, (2i - 1)d1 pixel values, 2id1 pixel values, and 2id1 pixel values respectively. During the search, calculate the correlation coefficient C between the pixel value of the currently searched pixel point in the image to be searched and the pixel value of the landmark point in the template image. If the correlation coefficient C is greater than the coarse cross-shaped search threshold, it is determined that the vicinity of the landmark point is searched in the image to be searched;
[0012] C) Fine cross-shaped search: In the image to be searched, with the vicinity of the landmark point searched in the coarse cross-shaped search as the center point, perform a cross-shaped search in the order of horizontal search to the right, vertical search upward, horizontal search to the left, and vertical search downward. In the first cross-shaped search, the step size of the first search is d2 pixel values, d2 < d1. Every time two searches are performed, the step size of the next two searches increases by d2 pixel values, and so on. The step sizes of the four searches in the j-th cross-shaped search are (2j - 1)d2 pixel values, (2j - 1)d2 pixel values, 2jd2 pixel values, and 2jd2 pixel values respectively. During the search, calculate the correlation coefficient C between the pixel value of the currently searched pixel point in the image to be searched and the pixel value of the landmark point in the template image. If the correlation coefficient C is greater than the fine cross-shaped search threshold, it is determined that the landmark point is searched in the image to be searched.
[0013] Preferably, in the step B), when in the i-th cross-shaped search, a certain search reaches the boundary, the directions of the subsequent searches perpendicular to the direction of this search are all reversed.
[0014] Preferably, in the step B), when the i-th cross-shaped search reaches the right boundary, then starting from this search, horizontally search to the right by (2i - 2)d1 pixel values, vertically search downward by d1 pixel values, horizontally search to the left by (2i - 1)d1 pixel values, and vertically search upward by 2id1 pixel values, and so on.
[0015] Preferably, if the vertical upward search reaches the upper boundary after searching 2id1 pixel values, then starting from this search, adjust to vertically search upward for (2i - 1)d1 pixel values, then horizontally search left for d1 pixel values, and so on.
[0016] Preferably, in step B), when the i-th square search reaches the left boundary, then starting from this search, horizontally search left for (2i - 2)d1 pixel values, vertically search upward for d1 pixel values, horizontally search right for (2i - 1)d1 pixel values, vertically search downward for 2id1 pixel values, and so on.
[0017] Preferably, if the vertical downward search reaches the lower boundary after searching 2id1 pixel values, then starting from this search, adjust to vertically search downward for (2i - 1)d1 pixel values, then horizontally search right for d1 pixel values, and so on.
[0018] Preferably, in step C), when the j-th square search reaches the right boundary, then starting from this search, horizontally search right for (2j - 2)d2 pixel values, vertically search downward for d2 pixel values, horizontally search left for (2j - 1)d2 pixel values, vertically search upward for 2jd2 pixel values, and so on.
[0019] Preferably, if the vertical upward search reaches the upper boundary after searching 2jd2 pixel values, then starting from this search, adjust to vertically search upward for (2j - 1)d2 pixel values, then horizontally search left for d2 pixel values, and so on.
[0020] Preferably, in step C), when the j-th square search reaches the left boundary, then starting from this search, horizontally search left for (2j - 2)d2 pixel values, vertically search upward for d2 pixel values, horizontally search right for (2j - 1)d2 pixel values, vertically search downward for 2jd2 pixel values, and so on.
[0021] Preferably, if the vertical downward search reaches the lower boundary after searching 2jd2 pixel values, then starting from this search, adjust to vertically search downward for (2j - 1)d2 pixel values, then horizontally search right for d2 pixel values, and so on.
[0022] Compared with the prior art, the present invention has the following advantages: For high-frequency measurement, due to the high vibration frequency, the displacement of its vibration is small, generally near the previous frame. And it is time-consuming and laborious to search the whole image through the traditional method. When multiple measurement points need to be measured, the measurement accuracy and speed are slow. While the square search can quickly find the points near the previous frame. Therefore, the rough square search can improve the speed of feature point search, and then calculate the integer pixel positioning through the fine square search. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 Schematic diagram of the coarse and fine loop searches of the whole-pixel thick and thin loop search algorithm from the inside out for the present invention;
[0024] Figure 2 Schematic diagram when at the right or upper boundary during the coarse loop search;
[0025] Figure 3 Schematic diagram when at the left or lower boundary during the coarse loop search. Detailed implementation manners
[0026] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0027] A whole-pixel thick and thin loop search algorithm from the inside out includes the following steps:
[0028] A) Search preparation: For the template image and the image to be searched, take the black and white alternating marked points as the objects to be measured, and use the normalized correlation coefficient method to calculate the correlation coefficient C between the pixel value of a certain pixel point in the image to be searched and the pixel value of the marked point in the template image. The calculation formula is as follows:
[0029]
[0030] In the formula, T is the pixel value of the marked point in the template image, I is the pixel value of a certain pixel point in the image to be searched. The matching size of the template image is (N + 1) × (N + 1), N is the number of pixel points from the center point of the template image to the boundary, i and j are the distances of the pixel points in the template image from the center point along the row and column respectively, i1 and j1 are the relative positions of the pixel points in the template image to the center point, T m is the average pixel value of the area of size (N + 1) × (N + 1) in the template image, I m is the average pixel value of the area of size (N + 1) × (N + 1) in the image to be searched. The calculation formula is as follows:
[0031]
[0032]
[0033] B) Coarse loop search: As Figure 1As shown in the figure, in the image to be searched, taking the position of the fiducial point in the template image as the center point, perform a zigzag search in the order of horizontal search to the right, vertical search upward, horizontal search to the left, and vertical search downward. In the first zigzag search, the step size of the first search is d1 pixel values, where d1 > 1. Every two searches, the step size of the next two searches increases by d1 pixel values, and so on. In the i-th zigzag search, the step sizes of the four searches are (2i - 1)d1 pixel values, (2i - 1)d1 pixel values, 2id1 pixel values, and 2id1 pixel values respectively. When searching, calculate the correlation coefficient C between the pixel value of the currently searched pixel point in the image to be searched and the pixel value of the fiducial point in the template image. If the correlation coefficient C is greater than the rough zigzag search threshold, it is determined that the vicinity of the fiducial point is searched in the image to be searched;
[0034] C) Fine zigzag search: In the image to be searched, taking the vicinity of the fiducial point searched in the rough zigzag search as the center point, perform a zigzag search in the order of horizontal search to the right, vertical search upward, horizontal search to the left, and vertical search downward. In the first zigzag search, the step size of the first search is d2 pixel values, where d2 < d1. Every two searches, the step size of the next two searches increases by d2 pixel values, and so on. In the j-th zigzag search, the step sizes of the four searches are (2j - 1)d2 pixel values, (2j - 1)d2 pixel values, 2jd2 pixel values, and 2jd2 pixel values respectively. When searching, calculate the correlation coefficient C between the pixel value of the currently searched pixel point in the image to be searched and the pixel value of the fiducial point in the template image. If the correlation coefficient C is greater than the fine zigzag search threshold, it is determined that the fiducial point is searched in the image to be searched.
[0035] Among them, when in the i-th zigzag search, if a certain search reaches the boundary, the directions of the subsequent searches perpendicular to the direction of this search are all reversed.
[0036] Specifically as follows:
[0037] In step B), as Figure 2 shown, when the i-th zigzag search reaches the right boundary, then starting from this search, horizontally search to the right by (2i - 2)d1 pixel values, vertically search downward by d1 pixel values, horizontally search to the left by (2i - 1)d1 pixel values, and vertically search upward by 2id1 pixel values, and so on.
[0038] In addition, if vertically searching upward by 2id1 pixel values reaches the upper boundary, then starting from this search, adjust to vertically search upward by (2i - 1)d1 pixel values, and then horizontally search to the left by d1 pixel values, and so on.
[0039] In step B), as Figure 3As shown, when the i-th square search reaches the left boundary, starting from this search, horizontally search leftward for (2i - 2)d1 pixel values, vertically search upward for d1 pixel values, horizontally search rightward for (2i - 1)d1 pixel values, and vertically search downward for 2id1 pixel values, and so on.
[0040] In addition, if vertically searching downward for 2id1 pixel values reaches the lower boundary, starting from this search, adjust to vertically search downward for (2i - 1)d1 pixel values, then horizontally search rightward for d1 pixel values, and so on.
[0041] In this embodiment, in step C), when the j-th square search reaches the right boundary, starting from this search, horizontally search rightward for (2j - 2)d2 pixel values, vertically search downward for d2 pixel values, horizontally search leftward for (2j - 1)d2 pixel values, and vertically search upward for 2jd2 pixel values, and so on.
[0042] In addition, if vertically searching upward for 2jd2 pixel values reaches the upper boundary, starting from this search, adjust to vertically search upward for (2j - 1)d2 pixel values, then horizontally search leftward for d2 pixel values, and so on.
[0043] In this embodiment, in step C), when the j-th square search reaches the left boundary, starting from this search, horizontally search leftward for (2j - 2)d2 pixel values, vertically search upward for d2 pixel values, horizontally search rightward for (2j - 1)d2 pixel values, and vertically search downward for 2jd2 pixel values, and so on.
[0044] In addition, if vertically searching downward for 2jd2 pixel values reaches the lower boundary, starting from this search, adjust to vertically search downward for (2j - 1)d2 pixel values, then horizontally search rightward for d2 pixel values, and so on.
[0045] The whole-pixel thickness square search algorithm from the inside out of the present invention. For high-frequency measurement, due to the high vibration frequency, the displacement amount of its vibration is small, generally near the previous frame. And it takes time and effort to search the whole image through the traditional method. When there are multiple measurement points to be measured, the measurement accuracy and speed are slow. While through the square shape, the points near the previous frame can be quickly found. Therefore, the thick square can improve the speed of feature point search, and then calculate the whole-pixel positioning through the thin square search.
Claims
1. An integer-pixel-thick inward-outward search algorithm for a square-within-a-square pattern, characterized in that: Including the following steps: A) Search preparation: For the template image and the image to be searched, take the black-and-white alternating landmark points as the objects to be measured, and use the normalized correlation coefficient method to calculate the correlation coefficient C between the pixel value of a certain pixel point in the image to be searched and the pixel value of the landmark point in the template image. The calculation formula is as follows: Wherein, T is the pixel value of the fiducial point in the template image, I is the pixel value of a certain pixel point in the image to be searched, the size of the template image matching is (N + 1) × (N + 1), N is the number of pixel points of the center point of the template image from the boundary, i and j are the distances of the pixel points in the template image from the center point along the row and column respectively, i1 and j1 are the relative positions of the pixel points in the template image with respect to the center point, T m is the average pixel value of the area of size (N + 1) × (N + 1) in the template image, I m is the average pixel value of the area of size (N + 1) × (N + 1) in the image to be searched, and the calculation formula is as follows: B) Coarse cross-shaped search: In the image to be searched, with the position of the landmark point in the template image as the center point, perform a cross-shaped search in the order of horizontal right search, vertical up search, horizontal left search, and vertical down search. In the first cross-shaped search, the step size of the first search is d1 pixel values, where d1 > 1. Every two searches, the step size of the next two searches increases by d1 pixel values, and so on. The step sizes of the four searches in the i-th cross-shaped search are (2i - 1)d1 pixel values, (2i - 1)d1 pixel values, 2id1 pixel values, and 2id1 pixel values respectively. During the search, calculate the correlation coefficient C between the pixel value of the currently searched pixel point in the image to be searched and the pixel value of the landmark point in the template image. If the correlation coefficient C is greater than the coarse cross-shaped search threshold, it is determined that the vicinity position of the landmark point is searched in the image to be searched; C) Fine cross-shaped search: In the image to be searched, with the vicinity position of the landmark point searched in the coarse cross-shaped search as the center point, perform a cross-shaped search in the order of horizontal right search, vertical up search, horizontal left search, and vertical down search. In the first cross-shaped search, the step size of the first search is d2 pixel values, where d2 < d1. Every two searches, the step size of the next two searches increases by d2 pixel values, and so on. The step sizes of the four searches in the j-th cross-shaped search are (2j - 1)d2 pixel values, (2j - 1)d2 pixel values, 2jd2 pixel values, and 2jd2 pixel values respectively. During the search, calculate the correlation coefficient C between the pixel value of the currently searched pixel point in the image to be searched and the pixel value of the landmark point in the template image. If the correlation coefficient C is greater than the fine cross-shaped search threshold, it is determined that the landmark point is searched in the image to be searched.
2. The whole-pixel thickness inward-outward search algorithm as described in claim 1, characterized in that: In the step B), when in the i-th cross-shaped search, if a certain search reaches the boundary, the directions of the subsequent searches perpendicular to the direction of this search are all reversed.
3. The whole-pixel thickness inward-outward search algorithm according to claim 2, wherein: In the step B), when the i-th cross-shaped search reaches the right boundary, then starting from this search, horizontally search to the right by (2i - 2)d1 pixel values, vertically search down by d1 pixel values, horizontally search to the left by (2i - 1)d1 pixel values, and vertically search up by 2id1 pixel values, and so on.
4. The whole-pixel thickness loop-shaped search algorithm according to claim 3, characterized in that: If vertically searching up by 2id1 pixel values reaches the upper boundary, then starting from this search, adjust to vertically search up by (2i - 1)d1 pixel values, and then horizontally search to the left by d1 pixel values, and so on.
5. The whole-pixel thickness inward-outward search algorithm according to claim 2, wherein: In the step B), when the i-th cross-shaped search reaches the left boundary, then starting from this search, horizontally search to the left by (2i - 2)d1 pixel values, vertically search up by d1 pixel values, horizontally search to the right by (2i - 1)d1 pixel values, and vertically search down by 2id1 pixel values, and so on.
6. The whole-pixel thickness inward-outward search algorithm as described in claim 5, characterized in that: If the vertical downward search reaches the lower boundary after searching 2id1 pixel values, then starting from this search, adjust it to vertically search downward for (2i - 1)d1 pixel values, and then horizontally search rightward for d1 pixel values, and so on.
7. The whole-pixel thickness inward-outward search algorithm according to claim 2, characterized in that: In the step C), when the j-th spiral search reaches the right boundary, then starting from this search, horizontally search rightward for (2j - 2)d2 pixel values, vertically search downward for d2 pixel values, horizontally search leftward for (2j - 1)d2 pixel values, vertically search upward for 2jd2 pixel values, and so on.
8. The whole-pixel thickness inward-outward search algorithm as described in claim 7, characterized in that: If the vertical upward search reaches the upper boundary after searching 2jd2 pixel values, then starting from this search, adjust it to vertically search upward for (2j - 1)d2 pixel values, and then horizontally search leftward for d2 pixel values, and so on.
9. The whole-pixel thickness inward-outward search algorithm as described in claim 2, characterized in that: In the step C), when the j-th spiral search reaches the left boundary, then starting from this search, horizontally search leftward for (2j - 2)d2 pixel values, vertically search upward for d2 pixel values, horizontally search rightward for (2j - 1)d2 pixel values, vertically search downward for 2jd2 pixel values, and so on.
10. The whole-pixel thickness inward-outward search algorithm as described in claim 7, wherein: If the vertical downward search reaches the lower boundary after searching 2jd2 pixel values, then starting from this search, adjust it to vertically search downward for (2j - 1)d2 pixel values, and then horizontally search rightward for d2 pixel values, and so on.
Citation Information
Patent Citations
Method for detecting corner points of outermost frames of symbols in symbol images
CN101667287A
Method for rendering a spline for scan conversion of a glyph
US5790126A