Image matching methods, systems, devices and media
By detecting motion vectors in image matching and correcting them when conditions are met, the problem of motion vector errors in the prior art is solved, thus improving the tracking accuracy of the device.
Patent Information
- Application Number
- CN202310573362.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-22
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-05-22
AI Technical Summary
Existing image matching methods do not detect and correct the obtained motion vectors, which may lead to errors in the output motion vectors and affect the tracking accuracy of the device.
During image matching, the similarity value between the optimal target block and the reference block is calculated. If the correction condition is met, the correction process is performed, and the corrected motion vector is output. This includes calculating the number and ratio of similar pixel pairs, or using the average value and direction of historical motion vectors for correction.
It improves the accuracy of image matching, ensures the tracking accuracy of the device, and avoids outputting incorrect motion vectors.
Smart Images

Figure CN116758308B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and in particular to an image matching method, system, device, and medium. Background Technology
[0002] Optical and photoelectric navigation technology is a rapidly developing and widely applied high-tech field with potential applications in various sectors and scenarios, such as optical mice, drones, aircraft, and medical surgery. Optical and photoelectric navigation typically involves image matching. Currently, a common image matching method involves using one image frame as a reference frame and another as a target frame. The method involves finding the target block in the target frame that is most relevant to the reference block in the reference frame. Finally, based on the position of this target block, a motion vector is output, thus obtaining the motion trajectory of the optical and photoelectric navigation device.
[0003] The shortcomings of existing matching methods are that they do not detect the obtained motion vectors or further correct them, meaning that the final output motion vectors may be incorrect. Summary of the Invention
[0004] The purpose of this invention is to provide an image matching method, system, device, and medium that can detect the obtained motion vectors during image matching and perform correction processing when correction conditions are met, thereby improving the tracking accuracy of the device.
[0005] To achieve the above object, the present invention provides the following solutions:
[0006] An image matching method, comprising:
[0007] The overlapping area of the target frame and the reference frame is estimated as the search area; wherein, both the target frame and the reference frame are acquired by the photoelectric navigation device, and the target frame is the image acquired by the photoelectric navigation device at the current moment;
[0008] A reference block is determined within the search area of the reference frame;
[0009] The optimal target block is determined within the search area of the target frame; among the multiple target blocks within the search area of the target frame, the optimal target block is the target block that is most relevant to the reference block.
[0010] The motion vector is obtained based on the position of the optimal target block;
[0011] The similarity between the optimal target block and the reference block is analyzed to obtain a similarity value;
[0012] When the similarity value does not meet the correction condition, the motion vector is directly output as the final motion vector;
[0013] When the similarity value meets the correction condition, the correction process is performed, and the corrected motion vector is output as the final motion vector.
[0014] The final motion vector is used to characterize the movement trajectory of the photoelectric navigation device; the correction conditions include at least one of the following: the similarity value is less than or equal to a preset value, and the ratio of the similarity value to the total number of pixels in the optimal target block is less than or equal to a set value.
[0015] Optionally, the similarity between the optimal target block and the reference block is analyzed to obtain a similarity value, specifically including:
[0016] If a pixel in the optimal target block is positioned opposite to a pixel in the reference block, and the two pixels have the same features, the two pixels are determined to be similar; two similar pixels are a pair of similar pixels; the features include: the relationship with neighboring pixels, and at least one of the value range to which the pixel value belongs;
[0017] Calculate the number of all similar pixel pairs to obtain the similarity value.
[0018] Optionally, the correction process specifically includes:
[0019] Calculate the average magnitude of the motion vectors from multiple historical outputs to obtain the average magnitude;
[0020] The average amplitude and the direction of the motion vector output at the previous moment are used as the amplitude and direction of the corrected motion vector, respectively.
[0021] Optionally, the correction process specifically includes:
[0022] The motion vector output at the previous moment is determined as the corrected motion vector.
[0023] Optionally, the correction process specifically includes:
[0024] Obtain the target motion vector; the magnitude of the target motion vector is the magnitude of the motion vector output at the previous moment, or the average of the magnitudes of multiple historically output motion vectors; the direction of the target motion vector is the direction of the motion vector output at the previous moment.
[0025] The step size is determined based on the magnitude of the target motion vector;
[0026] A synthetic motion vector is obtained based on the target motion vector and the step size, and the synthetic motion vector is used as the corrected motion vector.
[0027] Optionally, obtaining the synthesized motion vector based on the target motion vector and the step size includes:
[0028] The direction of the target motion vector is taken as the direction of the composite motion vector;
[0029] The amplitude obtained by subtracting the step size from the amplitude of the target motion vector is used as the amplitude of the synthesized motion vector.
[0030] The present invention also provides an image matching system, specifically comprising:
[0031] The estimation unit is used to estimate the overlapping area of the target frame and the reference frame as the search area; wherein, both the target frame and the reference frame are acquired by the photoelectric navigation device, and the target frame is the image acquired by the photoelectric navigation device at the current moment;
[0032] Image processing unit, used for:
[0033] A reference block is determined within the search area of the reference frame;
[0034] The optimal target block is determined within the search area of the target frame; among the multiple target blocks within the search area of the target frame, the optimal target block is the target block that is most relevant to the reference block.
[0035] Output unit, used for:
[0036] The motion vector is obtained based on the position of the optimal target block;
[0037] The similarity between the optimal target block and the reference block is analyzed to obtain a similarity value;
[0038] When the similarity value does not meet the correction condition, the motion vector is directly output as the final motion vector;
[0039] When the similarity value meets the correction condition, the correction process is performed, and the corrected motion vector is output as the final motion vector.
[0040] The correction condition is that the similarity value is less than or equal to a preset value, or the ratio of the similarity value to the total number of pixels in the optimal target block is less than or equal to a set value; the final motion vector is used to characterize the movement trajectory of the photoelectric navigation device.
[0041] Optionally, the similarity between the optimal target block and the reference block is analyzed to obtain a similarity value, specifically including:
[0042] Based on the optimal target block and the reference block, obtain the corresponding first feature vector and second feature vector respectively;
[0043] Based on the first feature vector and the second feature vector, a similarity analysis is performed between the optimal target block and the reference block to obtain the similarity value.
[0044] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the image matching method when executing the computer program.
[0045] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the image matching method.
[0046] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0047] Compared with the prior art that directly outputs the obtained motion vector as the matching result, the embodiment of the present invention adds a similarity value calculation process and uses the similarity value to detect the obtained motion vector: if the similarity value meets the correction condition, the correction process is performed, and the corrected motion vector is output to avoid outputting erroneous motion vectors, thereby improving the matching accuracy and ensuring the tracking accuracy of the device. Attached Figure Description
[0048] Figure 1 This is a schematic flowchart of the image matching method provided in an embodiment of the present invention;
[0049] Figure 2 This is a reference for similarity value calculation in an embodiment of the present invention;
[0050] Figure 3 This is a reference figure for detection and correction in an embodiment of the present invention;
[0051] Figure 4 This is a schematic diagram of the modules of the image matching system provided in an embodiment of the present invention.
[0052] Symbol explanation:
[0053] Prediction unit-1, image processing unit-2, output unit-3. Detailed Implementation
[0054] The embodiments of the present invention will now be described with reference to the accompanying drawings.
[0055] The purpose of this invention is to provide an image matching method that can detect the obtained motion vectors and perform correction processing when correction conditions are met, thereby improving the tracking accuracy of the device.
[0056] like Figure 1 As shown, the above image matching method specifically includes the following steps:
[0057] Step S01: Estimate the overlapping area of the target frame and the reference frame as the search area.
[0058] Both the target frame and the reference frame are acquired by the optoelectronic navigation device. The target frame is the image acquired by the optoelectronic navigation device at the current moment. The reference frame is either the target image at the initial moment or the target image at the previous moment.
[0059] Regarding the selection of the reference frame, the target image acquired at the initial moment can be used as the reference frame first. Then, when the estimated search area is smaller than the preset range, the target image at the previous moment can be selected as the reference frame, or the target image at the previous moment can be selected in real time as the current reference frame.
[0060] Those skilled in the art can set a preset range according to actual needs, for example, the preset range can be set to 1 / 4 of the target frame area.
[0061] Step S02: Determine the reference block within the search area of the reference frame.
[0062] For example, the ratio of the area of the reference block to the area of the search region is greater than or equal to 1 / 2.
[0063] Step S03: Determine the optimal target block within the search area of the target frame.
[0064] Among the multiple target blocks within the search area of the target frame, the optimal target block is the one most relevant to the reference block.
[0065] Specifically, the sum of absolute differences (SAD) algorithm can be used to find the optimal target block: subtract the reference block and the target block from each other point by point in the search area, take the absolute value, and finally sum all the absolute values to obtain the SAD value of the two matching blocks. Among them, the two matching blocks with the smallest SAD value are the most relevant.
[0066] It should be noted that the number of SAD values is the same as the number of target blocks. For example, if there are 9 target blocks in the search area of the target frame, the absolute values of each block can be summed with the reference block to obtain 9 SAD values. The target block corresponding to the minimum value among these 9 SAD values is the optimal target block.
[0067] Alternatively, we can count the number of point-to-point similarities between two matching blocks, and the block with the largest number of similarities has the best correlation. That is, the target block with the largest number of point-to-point similarities to the reference block is the optimal target block.
[0068] Step S04: Obtain the motion vector based on the position of the optimal target block.
[0069] Based on the positions of the optimal target block and the reference block, the motion vector (including the direction and distance of movement) of the optimal target block relative to the reference block can be obtained. This vector is then used as the motion vector of the target frame relative to the reference frame, thereby enabling the tracking of the trajectory of the photoelectric navigation device.
[0070] It should be noted that the position here can refer to the coordinates of pixels with the same index (number) in the same image coordinate system.
[0071] For example, suppose the reference block is 5*5 pixels in size, with a total of 25 pixels. Each pixel is assigned an index / number in a certain order (e.g., from left to right and from top to bottom), let's say from 1 to 25. Each target block (including the optimal target block) is also 5*5 pixels in size, with a total of 25 pixels. Each pixel is also assigned an index / number in the same order (e.g., from left to right and from top to bottom), also from 1 to 25.
[0072] An index can be chosen from 1 to 25. Assuming index 1 is chosen, the position of the optimal target block can be the position of the pixel corresponding to index 1. Similarly, the position of the reference block is the position of the pixel corresponding to index 1.
[0073] Furthermore, in practice, the obtained motion vectors may be inaccurate for the following reasons:
[0074] On the one hand, the estimated search area may be inaccurate and may not be the actual overlapping area of the reference frame and the target frame. Consequently, the two most relevant matching blocks (reference block and target block) obtained within the search range may only be the most relevant within a specific area.
[0075] On the other hand, when the device moves on a flat surface (such as a desktop or A4 paper), the captured image is relatively flat and has low contrast. The correlation coefficient obtained when performing image matching has little distinguishability. Therefore, even within the estimated search area, the optimal target block obtained by the correlation algorithm may not be the most accurate, even if the actual overlap area between the reference frame and the target frame is within the estimated search area.
[0076] Therefore, the motion vector obtained based on the position of the optimal target block may be incorrect, and multiple consecutive errors will make it impossible to effectively track the movement trajectory of the photoelectric navigation device. Based on this, the embodiments of the present invention provide the following steps to improve the tracking accuracy of the device, as follows:
[0077] Step S05: Analyze the similarity between the optimal target block and the reference block to obtain the similarity value.
[0078] In one example, the specific steps to obtain similarity values are as follows:
[0079] Step S051: If a pixel in the optimal target block is positioned opposite to a pixel in the reference block, and the features of the two pixels are consistent, then the two pixels are determined to be similar.
[0080] The above positions are relative, specifically referring to the same pixel index / number. For a description of the index / number, please refer to the previous record, which will not be repeated here.
[0081] Among them, two similar pixels constitute a similar pixel pair; the above features include: the relationship with neighboring pixels, and at least one of the value ranges to which the pixel value belongs.
[0082] Specifically, in one example, the characteristics of two pixels can be determined based on their relationship with their neighboring pixels.
[0083] For example, when the pixel values of two pixels are both greater than or both less than the pixel values of their eight neighboring pixels, the two pixels are considered to have similar features.
[0084] Of course, other conditions can also be used to determine whether the features of two pixels are consistent. For example, when the pixel values of these two pixels are both greater than or both less than the pixel values of the surrounding N (N is a positive integer less than 8) neighboring pixels, the features of these two pixels are determined to be similar.
[0085] Alternatively, it can be considered similar to the pixel values of two pixels, not limited to both being greater than or both being less than, as long as the pixel values of the two pixels are similar to the pixel values of their neighboring pixels. For example, assuming the two pixels mentioned above are represented as S1 and S2, and assuming 0 represents less than and 1 represents greater than or equal to, if the pixel value relationship between S1 and its 8 neighboring pixels can be represented by vector 1: (00101110), and the pixel value relationship between S1 and its 8 neighboring pixels can be represented by vector 2: (00101110), then the two pixels can also be considered similar.
[0086] Of course, the similarity between vector 1 and vector 2 can also be calculated. If the similarity exceeds or is less than a threshold, the two pixels can be considered similar. The similarity between vectors can be represented in various ways, such as cosine similarity (the threshold can be a value between 0 and 1, such as 0, 0.1, 0.3, etc., and values less than or equal to the threshold can be considered similar), or using the sum of the absolute values of the element-wise differences between the vectors as the similarity (the threshold can be a positive integer less than 8, such as 1, 2, etc., and values less than or equal to the threshold can be considered similar), etc., which will not be elaborated here.
[0087] In another example, pixel values can be divided into multiple value ranges. When the pixel values of the two pixels mentioned above belong to the same value range, the two pixels are considered to have similar features.
[0088] Taking a grayscale image as an example, the pixel values from 0 to 255 can be divided into 16 blocks (value ranges): 0-15, 16-31, 32-47, 48-63, 64-79, ..., 240-255. If the pixel values of two pixels are 60 and 73 respectively, both of which fall within the value range of 64-79, then the two pixels are considered to have similar features.
[0089] In other examples, when determining whether two pixels are similar in features, the relationship between the two pixels and their neighboring pixels, as well as the value space in which the pixel values of the two pixels are located, can be considered simultaneously.
[0090] like Figure 2 As shown, the pixel values from 0 to 255 are divided into 16 intervals. The pixel values of the first pixel of the reference block and the first pixel of the optimal target block are both greater than the three surrounding pixels and both fall within the pixel interval of 128-143. In this case, the two pixels are considered to have similar features.
[0091] Step S052: Calculate the number of all similar pixel pairs to obtain the similarity value.
[0092] In addition to the specific examples mentioned above, the following methods can also be used to analyze the similarity between the optimal target block and the reference block:
[0093] Method 1:
[0094] Similarity is calculated based on the texture features of the optimal target block and the texture features of the reference block to obtain a similarity value.
[0095] How to extract texture features can be done using existing methods or future extraction methods, which will not be elaborated here.
[0096] Method 2:
[0097] Based on the underlying visual features of the optimal target block and the reference block, the first feature vector and the second feature vector are established respectively.
[0098] Calculate the similarity between the first and second feature vectors to perform similarity matching between the optimal target block and the reference block, and obtain the similarity value.
[0099] Among them, the underlying visual features include, but are not limited to, one or more of the following examples: color, shape, texture, and edges.
[0100] In one example, the distance between the first and second eigenvectors can be calculated as a similarity value; specifically, the distance can be calculated as at least one of cosine distance, Euclidean distance, and absolute distance.
[0101] In another example, the cosine of the angle between the first and second eigenvectors can be calculated as the similarity value.
[0102] The calculation of cosine distance, Euclidean distance, absolute distance, and cosine value can refer to existing calculation methods and will not be elaborated here. Of course, this example can also adopt new methods proposed in the future for calculating cosine distance, Euclidean distance, absolute distance, and cosine value.
[0103] Method 3:
[0104] Obtain the histograms of the optimal target block and the reference block respectively;
[0105] Based on the histogram of the optimal target block and the histogram of the reference block, the similarity between the optimal target block and the reference block is calculated to obtain the similarity value.
[0106] Those skilled in the art can flexibly select the above methods to obtain similarity values. Furthermore, the obtained motion vectors can be detected based on the similarity values, as shown below:
[0107] Step S06: When the similarity value does not meet the correction condition, directly output the motion vector as the final motion vector.
[0108] The correction conditions include at least one of the following: the similarity value is less than or equal to a preset value, and the ratio of the similarity value to the total number of pixels in the optimal target block is less than or equal to a set value. For example, when the number of similar pixel pairs Cnt is greater than a preset value Th, the optimal target block determined in step S03 can be considered to be the target block most relevant to the reference block. Furthermore, if the motion vector obtained in step S04 is correct, it can be directly output as the final motion vector.
[0109] The range of preset values can be, for example, 15, 16 or 17, and the range of set values can be, for example, 60% to 70%.
[0110] The final motion vector is used to characterize the movement trajectory of the optoelectronic navigation device. Based on the obtained final motion vector, the device's trajectory can be tracked, specifically in scenarios such as cursor navigation in an optical mouse and flight guidance for an aircraft.
[0111] Step S07: When the similarity value meets the correction condition, perform the correction process and output the corrected motion vector as the final motion vector.
[0112] Specifically, the following specific correction methods can be used as a reference when performing correction processing:
[0113] Example 1:
[0114] Calculate the average magnitude of the motion vectors from multiple historical outputs to obtain the average magnitude;
[0115] The average amplitude and the direction of the motion vector output at the previous moment are used as the amplitude and direction of the corrected motion vector, respectively.
[0116] When selecting multiple historical output motion vectors (hereinafter referred to as historical outputs), for example, multiple consecutive historical outputs (such as 3, 5, or 7 times) from the current time or the previous time can be selected; or, multiple historical outputs can be selected at intervals from the current time or the previous time; in addition, motion vectors that have been previously processed can be excluded, and the most recent direct historical outputs can be selected; the specific selection method and the number of selections can be flexibly adjusted according to the actual situation.
[0117] Example 2:
[0118] The motion vector output at the previous moment is determined as the corrected motion vector.
[0119] Example 3:
[0120] Step 1: Obtain the target motion vector.
[0121] The magnitude of the target motion vector is the magnitude of the motion vector output at the previous moment, or the average of the magnitudes of multiple historically output motion vectors; the direction of the target motion vector is the direction of the motion vector output at the previous moment.
[0122] When obtaining the target motion vector, the selection of multiple historical output motion vectors can be referred to Example 1 above, and will not be repeated here.
[0123] Step 2: Determine the step size based on the magnitude of the target motion vector.
[0124] For example, 1 / 4 of the magnitude of the target motion vector can be selected as the step size mentioned above.
[0125] Step 3: Obtain the synthesized motion vector based on the target motion vector and step size, and use the synthesized motion vector as the corrected motion vector.
[0126] For example, the direction of the target motion vector can be used as the direction of the synthesized motion vector; the magnitude of the target motion vector can be obtained by adding or subtracting the step size, and then used as the magnitude of the synthesized motion vector.
[0127] Further details can be found at [link to relevant document]. Figure 3Taking a preset value Th of 15 or a set value of 60% as an example, after determining the reference block, the SAD algorithm is used to find the optimal target block in the search area corresponding to the target frame (the shaded area in the upper right corner of the figure); when calculating the similarity value, as mentioned above, the pixel value 0 to 255 can be divided into 16 intervals on average. When the pixel values of two corresponding pixels belong to the same value interval, it is determined that the two pixels are similar in features. Then, the number of similar point pairs Cnt is calculated to be 4. Alternatively, normalization is performed, and the number of similar point pairs is divided by the total number of pixels in the optimal target block (25) to obtain a similarity of 16%; obviously, the motion vector obtained from the optimal target block is wrong. At this time, any one of the above three correction methods can be used to perform the correction process, and finally the corrected motion vector is output.
[0128] This invention also provides an image matching system. Figure 4 An exemplary structure of the system is shown, including: a prediction unit 1, an image processing unit 2, and an output unit 3.
[0129] The estimation unit 1 is used to estimate the overlapping area of the target frame and the reference frame as the search area; wherein, both the target frame and the reference frame are acquired by the photoelectric navigation device, and the target frame is the image acquired by the photoelectric navigation device at the current moment.
[0130] The estimation unit 1 can be used to perform step S01 in all the above embodiments. For related descriptions, please refer to the previous descriptions, which will not be repeated here.
[0131] Image processing unit 2, used for:
[0132] Determine the reference block within the search area of the reference frame;
[0133] The optimal target block is determined within the search area of the target frame; among multiple target blocks within the search area of the target frame, the optimal target block is the target block that is most relevant to the reference block.
[0134] The estimation unit 2 can be used to execute steps S02-S03 in all the above embodiments. For related descriptions, please refer to the previous text, which will not be repeated here.
[0135] Output unit 3 is used for:
[0136] The motion vector is obtained based on the position of the optimal target block;
[0137] Analyze the similarity between the optimal target block and the reference block to obtain the similarity value;
[0138] When the similarity value does not meet the correction condition, the motion vector is directly output as the final motion vector;
[0139] When the similarity value meets the correction condition, the correction process is performed, and the corrected motion vector is output as the final motion vector.
[0140] The correction condition is that the similarity value is less than or equal to a preset value, or the ratio of the similarity value to the total number of pixels in the optimal target block is less than or equal to a set value; the final motion vector is used to characterize the movement trajectory of the photoelectric navigation device.
[0141] Output unit 3 can be used to execute steps S04-S07 in all the above embodiments. For related descriptions, please refer to the previous text, which will not be repeated here.
[0142] This invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the image matching method described above.
[0143] Furthermore, when the computer program in the aforementioned memory is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
[0144] In this embodiment of the invention, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the above-described image matching method.
[0145] In summary, the image matching method, system, device, and medium provided in the embodiments of the present invention can detect and correct the obtained motion vectors, avoid outputting erroneous motion vectors, thereby improving matching accuracy and ensuring the tracking accuracy of the device.
[0146] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0147] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. An image matching method, characterized in that, include: The overlapping area of the target frame and the reference frame is estimated as the search area; wherein, both the target frame and the reference frame are acquired by the photoelectric navigation device, and the target frame is the image acquired by the photoelectric navigation device at the current moment; A reference block is determined within the search area of the reference frame; The optimal target block is determined within the search area of the target frame; among the multiple target blocks within the search area of the target frame, the optimal target block is the target block that is most relevant to the reference block. The motion vector is obtained based on the position of the optimal target block; Analyzing the similarity between the optimal target block and the reference block to obtain a similarity value specifically includes: If a pixel in the optimal target block is positioned opposite to a pixel in the reference block, and the two pixels have the same features, the two pixels are determined to be similar; two similar pixels are a pair of similar pixels; the features of the two pixels include: their relationship with neighboring pixels, and at least one of the value ranges to which the pixel value belongs; Calculate the number of all similar pixel pairs to obtain the similarity value; When the similarity value does not meet the correction condition, the motion vector is directly output as the final motion vector; When the similarity value meets the correction condition, the correction process is performed, and the corrected motion vector is output as the final motion vector. The final motion vector is used to characterize the movement trajectory of the photoelectric navigation device; the correction conditions include at least one of the following: the similarity value is less than or equal to a preset value, and the ratio of the similarity value to the total number of pixels in the optimal target block is less than or equal to a set value.
2. The image matching method according to claim 1, characterized in that, The aforementioned correction process specifically includes: Calculate the average magnitude of the motion vectors from multiple historical outputs to obtain the average magnitude; The average amplitude and the direction of the motion vector output at the previous moment are used as the amplitude and direction of the corrected motion vector, respectively.
3. The image matching method according to claim 1, characterized in that, The aforementioned correction process specifically includes: The motion vector output at the previous moment is determined as the corrected motion vector.
4. The image matching method according to claim 1, characterized in that, The aforementioned correction process specifically includes: Obtain the target motion vector; the magnitude of the target motion vector is the magnitude of the motion vector output at the previous moment, or the average of the magnitudes of multiple historically output motion vectors; the direction of the target motion vector is the direction of the motion vector output at the previous moment. The step size is determined based on the magnitude of the target motion vector; A synthetic motion vector is obtained based on the target motion vector and the step size, and the synthetic motion vector is used as the corrected motion vector.
5. The image matching method according to claim 4, characterized in that, The synthesized motion vector obtained based on the target motion vector and step size includes: The direction of the target motion vector is taken as the direction of the composite motion vector; The amplitude obtained by subtracting the step size from the amplitude of the target motion vector is used as the amplitude of the synthesized motion vector.
6. The image matching method according to claim 1, characterized in that, Analyzing the similarity between the optimal target block and the reference block to obtain a similarity value specifically includes: Based on the optimal target block and the reference block, obtain the corresponding first feature vector and second feature vector respectively; Based on the first feature vector and the second feature vector, a similarity analysis is performed between the optimal target block and the reference block to obtain the similarity value.
7. An image matching system, characterized in that, include: The estimation unit is used to estimate the overlapping area of the target frame and the reference frame as the search area; wherein, both the target frame and the reference frame are acquired by the photoelectric navigation device, and the target frame is the image acquired by the photoelectric navigation device at the current moment; Image processing unit, used for: A reference block is determined within the search area of the reference frame; The optimal target block is determined within the search area of the target frame; among the multiple target blocks within the search area of the target frame, the optimal target block is the target block that is most relevant to the reference block. Output unit, used for: The motion vector is obtained based on the position of the optimal target block; Analyzing the similarity between the optimal target block and the reference block to obtain a similarity value specifically includes: If a pixel in the optimal target block is positioned opposite to a pixel in the reference block, and the two pixels have the same features, the two pixels are determined to be similar; two similar pixels are a pair of similar pixels; the features of the two pixels include: their relationship with neighboring pixels, and at least one of the value ranges to which the pixel value belongs; Calculate the number of all similar pixel pairs to obtain the similarity value; When the similarity value does not meet the correction condition, the motion vector is directly output as the final motion vector; When the similarity value meets the correction condition, the correction process is performed, and the corrected motion vector is output as the final motion vector. The correction condition is that the similarity value is less than or equal to a preset value, or the ratio of the similarity value to the total number of pixels in the optimal target block is less than or equal to a set value; the final motion vector is used to characterize the movement trajectory of the photoelectric navigation device.
8. An electronic device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the method as claimed in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, It stores a computer program thereon, which, when executed, implements the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for determining relative motion of optical mouse
CN100367165C