WO2020173194A1 - 图像特征点的跟踪方法、匹配方法和坐标获取方法、装置 - Google Patents
图像特征点的跟踪方法、匹配方法和坐标获取方法、装置 Download PDFInfo
- Publication number
- WO2020173194A1 WO2020173194A1 PCT/CN2019/126816 CN2019126816W WO2020173194A1 WO 2020173194 A1 WO2020173194 A1 WO 2020173194A1 CN 2019126816 W CN2019126816 W CN 2019126816W WO 2020173194 A1 WO2020173194 A1 WO 2020173194A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- image
- point
- feature point
- target feature
- tracking
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/20—Analysis of motion
- G06T7/246—Analysis of motion using feature-based methods, e.g. the tracking of corners or segments
Definitions
- This application relates to the field of image processing technology, such as a tracking method for image feature points, a tracking device for image feature points, a matching method for image feature points, a matching device for image feature points, a method for obtaining three-dimensional coordinates of a target, and a target obtaining Three-dimensional coordinate devices, computer equipment and computer-readable storage media.
- the binocular vision system is the principle of stereo vision imaging that simulates the biological.
- the left camera and the right camera simultaneously shoot the same object, obtain images of the object in two perspectives, and then use matching algorithms to find two in the captured images.
- the matching relationship between the feature points of the image so as to obtain the three-dimensional space coordinates of the feature points through the principle of triangulation.
- accurate tracking of image feature points in multiple images is the key to accurately obtaining their spatial coordinates and other location information. If the image feature points cannot be accurately tracked, it will cause errors in the calculation of spatial coordinates and affect the performance of the binocular vision system. .
- This application provides an image feature point tracking method, an image feature point tracking device, an image feature point matching method, an image feature point matching device, a method for obtaining three-dimensional coordinates of a target, a device for obtaining three-dimensional coordinates of a target, and a computer Equipment and computer-readable storage medium to solve the technical problem of low accuracy of tracking image feature points with traditional technology.
- An image feature point tracking method including the steps:
- the matching point is a point on the second image that matches the target feature point.
- An image feature point tracking method including the steps:
- a method for matching image feature points including the steps:
- a method for obtaining three-dimensional coordinates of a target including the steps:
- a matching point that matches the target feature point of the first image is determined in the second image
- a tracking device for image feature points including:
- the horizontal line determining module is used to determine the horizontal line corresponding to the target feature point in the second image; wherein, the target feature point is the feature point of the first image; the first image and the second image are relative to the first perspective The image obtained after correction of the image and the second-view image;
- the first acquiring module is configured to acquire the first gray value of the starting tracking point located on the horizontal line;
- the second acquisition module is used to acquire the second gray value and gray gradient value of the target feature point
- the feature point tracking module is used to track the matching point in the direction of the horizontal line according to the first gray value of the starting tracking point and the second gray value and gray gradient value of the target feature point.
- the position in the second image; the matching point is a point on the second image that matches the target feature point.
- a tracking device for image feature points including:
- An image pyramid building module used to build image pyramids for the first image and the second image respectively; wherein, the image pyramid includes multiple layers of images;
- the feature point position determination module is configured to perform step a. Determine the location of the target feature point in the current layer image of the first image; wherein the current layer image is the current layer image in the image pyramid;
- the tracking point acquisition module is configured to perform step b. Use the above-mentioned image feature point tracking method to track the target feature point according to the position of the target feature point, and obtain the target feature point in the second image. Matching points in the layer image that match the target feature points;
- a tracking point setting module configured to perform step c, setting the matching point as the starting tracking point of the next layer of the image of the second image;
- the tracking point determination module is configured to repeat the above steps a to c until the matching point is a matching point on the bottom image of the second image.
- An image feature point matching device including:
- the first matching point acquisition module is configured to track the target feature point according to the above-mentioned image feature point tracking method, and obtain the first matching point that matches the target feature point in the second image;
- a second matching point obtaining module configured to obtain a second matching point that matches the first matching point in the first image based on the above-mentioned image feature point tracking method
- the matching point determination module is configured to determine that the first matching point matches the target feature point if the second matching point and the target feature point are the same point.
- a device for obtaining three-dimensional coordinates of a target including:
- a perspective image acquisition module for acquiring a first perspective image and a second perspective image obtained by shooting a target object; the target object is an object in a three-dimensional space;
- a viewing angle image correction module configured to correct the first viewing angle image and the second viewing angle image to obtain a first image and a second image
- a feature point setting module configured to set a point projected by the target object on the first image as a target feature point
- a matching point determination module configured to determine, in the second image, a matching point that matches the target feature point of the first image according to the above-mentioned image feature point tracking method or image feature point matching method;
- a two-dimensional coordinate acquisition module configured to acquire the two-dimensional coordinates of the target feature point in the first image, and acquire the two-dimensional coordinates of the matching point in the second image;
- a projection matrix acquisition module configured to acquire a first projection matrix of the first image and a second projection matrix of the second image
- a three-dimensional coordinate acquisition module for acquiring the target according to the two-dimensional coordinates of the target feature point in the first image, the two-dimensional coordinates of the matching point in the second image, the first projection matrix and the second projection matrix The three-dimensional coordinates of the object in three-dimensional space.
- a computer device includes a processor and a memory, and a computer program is stored on the memory.
- the processor implements the above-mentioned image feature point tracking method, image feature point matching method, or three-dimensional acquisition of a target object when the processor executes the computer program. Coordinate method steps.
- a computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned image feature point tracking method, image feature point matching method, or three-dimensional coordinate acquisition method of a target are realized.
- the above-mentioned image feature point tracking method, matching method, method, device, computer equipment, and storage medium for obtaining three-dimensional coordinates of the target object are combined with the second gray value, gray gradient value of the target feature point, and the first tracking point A gray value, tracking and matching the target feature points in the direction of a horizontal line of the second image, which can increase the number of feature points successfully tracked and matched to the target feature points, and improve the robustness of tracking the target feature points And stability, the tracking range of the feature points is also limited to a horizontal line of the second image, which simplifies the tracking operation of the feature points, speeds up the calculation speed, and shortens the target feature points under the premise of ensuring stability.
- the tracking time improves the tracking efficiency and helps provide more effective data support for the binocular vision system.
- FIG. 1 is an application environment diagram of an image feature point tracking method in an embodiment
- FIG. 2 is a schematic flowchart of a method for tracking image feature points in an embodiment
- FIG. 3 is a schematic diagram of the relationship between the first image and the second image in an embodiment
- Figure 4 is a schematic diagram of feature values of image feature points in an embodiment
- FIG. 5(a) is a schematic diagram of a type of image feature points in an embodiment
- FIG. 5(b) is a schematic diagram of another type of image feature points in an embodiment
- Figure 5(c) is a schematic diagram of another type of image feature points in an embodiment
- FIG. 6 is a schematic flowchart of a method for tracking image feature points in another embodiment
- Figure 7 is a schematic diagram of an image pyramid in an embodiment
- FIG. 8 is an effect comparison diagram of a method for tracking image feature points in an embodiment
- FIG. 9 is a schematic flowchart of a method for matching image feature points in an embodiment
- FIG. 10 is a schematic diagram of the matching relationship of image feature points in an embodiment
- FIG. 11 is a schematic flowchart of a method for obtaining three-dimensional coordinates of a target in an embodiment
- FIG. 12 is a schematic structural diagram of an image feature point tracking device in an embodiment
- FIG. 13 is a schematic structural diagram of an image feature point tracking device in another embodiment
- FIG. 14 is a schematic structural diagram of an image feature point matching device in an embodiment
- 15 is a schematic structural diagram of an apparatus for obtaining three-dimensional coordinates of a target in an embodiment
- Fig. 16 is an internal structure diagram of a computer device in an embodiment.
- first ⁇ second involved in the embodiments of the present application only distinguishes similar objects, and does not represent a specific order for objects. Understandably, “first ⁇ second” is permitted The following can be interchanged in a specific order or sequence. It should be understood that the objects distinguished by “first ⁇ second” can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein.
- FIG. 1 is an application environment diagram of the method for tracking image feature points in an embodiment.
- the target 10 is photographed, so that images of the target 10 at different perspectives can be obtained.
- the binocular camera system includes a left camera and a right camera.
- the left camera and the right camera are used to capture the target in the three-dimensional space.
- the object 10 is photographed, and the images of the target object 10 in the left and right eye angles can be obtained.
- the first angle image 100a is the image obtained by the left camera and the first angle image 100b is the right camera and the right eye angle.
- the first-perspective image 100a and the first-perspective image 100b are all photographed with the feature point A of the target, and the first-perspective image 100a and the first-perspective image 100b are transmitted to a computer with data processing capabilities such as a personal computer
- the computer device can correct the first view image 100a and the first view image 100b to obtain the first image and the second image, so as to eliminate the image distortion of the first view image 100a and the first view image 100b and make the binocular
- the images taken by the left and right cameras of the camera system are aligned, that is, the two images are strictly aligned in the horizontal direction, so that any point on one image and its matching point on the other image must be on the same line.
- the first image It is the image obtained after the correction processing of the first angle of view image 100a
- the second image is the image obtained after the correction processing of the second angle of view image 100b
- the horizontal line where the feature point A in the first image is located can be determined in the second image
- obtain the first gray value of the initial tracking point located on the horizontal line obtain the second gray value and gray gradient value of the feature point A in the first image, according to the first gray value of the initial tracking point Value and the second gray value and gray gradient value of the feature point A, track the position of the feature point A in the second image along the horizontal line in the second image.
- FIG. 2 is a schematic flow chart of the method for tracking image feature points in an embodiment.
- the method uses a personal computer or other computer capable of data processing.
- the method for tracking image feature points may include the following steps:
- Step S101 Determine a horizontal line corresponding to the target feature point in the second image.
- the target feature point is a feature point of the first image
- the target feature point is generally a key pixel point used to identify image features, and can be feature points such as corner points and edge points in the image.
- the first image and the second image are the images obtained by correcting the first angle of view image and the second angle of view image, where the first image corresponds to the first angle of view image and is the image obtained after correcting the first angle of view image , And the second image corresponds to the second perspective image, and is an image obtained after correction processing is performed on the second perspective image.
- the main purpose of correcting the first-view image and the second-view image is to eliminate the distortion of the two images and to align the two images so that the two images are strictly aligned in the horizontal direction, while the first image and the second image It is an image that is distorted and aligned in the horizontal direction.
- the first perspective image and the second perspective image may be corrected.
- the specific steps may include: acquiring the first perspective image and the second perspective image, Then, the image distortion existing in the first view image and the second view image is eliminated, and then the first view image and the second view image after the image distortion are eliminated can be aligned to obtain the first image and the second image.
- the matching point of any pixel on the first image or the second image on the corresponding other image will inevitably be on the same horizontal line. In this way, select the target feature point that needs to be tracked and matched in the first image Later, the horizontal line corresponding to the target feature point can be determined in the second image.
- Figure 3 is a schematic diagram of the relationship between the first image and the second image in an embodiment.
- the binocular camera of the binocular camera system can be calibrated first to obtain the binocular camera system.
- the images of the first perspective image 100a and the second perspective image 100b are distorted, and the first perspective image 100a and the second perspective image 100b are aligned to obtain the first image 300a and the second image 300b as shown in FIG.
- the first image 300a and the second image 300b are strictly aligned in the horizontal direction, so that any point on the first image 300a and the matching point of the point on the second image 300b must be on the same line, that is, if the first image 300a
- the feature point A above is on the first horizontal line 310a of the first image 300a
- the second horizontal line 310b is the horizontal line of the second image 300b that is at the same horizontal line as the first horizontal line 310a
- the matching feature point A on the second image 300b It must be located on the second horizontal line 310b, that is, the matching feature point A on the second image 300b and the feature point A of the first image 300a have the same vertical coordinate value, so select the target feature that needs to be tracked and matched in the first image 310a
- the horizontal line 310b corresponding to the target feature point A can be determined in the second image 310b.
- Step S102 Obtain the first gray value of the starting tracking point on the horizontal line.
- This step is mainly to obtain the gray value of the starting tracking point located on the horizontal line in the second image as the first gray value, and the starting tracking point is mainly used as the starting point to the first gray value in the second image.
- the target feature points of the image are tracked and matched, where the starting tracking point can be randomly selected from each pixel point on the horizontal line, or the target feature point can be found in the second image according to the position of the target feature point in the first image.
- the pixel with the same position is used as the starting tracking point.
- the first gray value of the initial tracking point can be extracted from the pixel feature information of each pixel of the second image stored in advance.
- Step S103 Obtain the second gray value and gray gradient value of the target feature point.
- the gray value of the target feature point can be obtained from the first image as the second gray value, and the target feature point can be calculated based on the second gray value in various directions on the image plane where the first image is located.
- the grayscale change value of, that is, the grayscale gradient value, for example, the grayscale gradient value of the target feature point in the horizontal and longitudinal directions of the first image can be calculated according to the gray value of the target feature point.
- Step S104 according to the first gray value of the starting tracking point and the second gray value and gray gradient value of the target feature point, track the position of the matching point in the second image along the horizontal line; the matching point is The point on the second image that matches the target feature point.
- this step can set the pixel point A 0 on the horizontal line as the starting tracking point, according to the first gray value of the starting tracking point and the second gray value of the target feature point A in the first image 300a.
- the degree value and the gray gradient value are tracked along the horizontal line 310b in the second image 300b to track the position of the target feature point A to determine the location of the matched feature point A in the second image 300b.
- the above-mentioned image feature point tracking method combines the second gray value, gray gradient value of the target feature point, and the first gray value of the starting tracking point in the direction of a horizontal line of the second image, and the target feature point Tracking and matching can increase the number of feature points that are successfully tracked and matched to the target feature point, improve the robustness and stability of tracking the target feature point, and limit the tracking range of the feature point to a horizontal line of the second image
- the step of determining the horizontal line corresponding to the target feature point in the second image may include:
- This embodiment mainly determines the horizontal line where the target feature point is located in the second image based on the position of the target feature point in the first image and the horizontal line correspondence between the first image and the second image.
- the position of the target feature point in the first image may be the ordinate of the target feature point
- the horizontal line correspondence refers to the correspondence between each horizontal line in the first image and each horizontal line in the second image, as shown in Figure 3.
- the corresponding relationship between the first horizontal line 310a and the second horizontal line 310b is the two horizontal lines on the same horizontal line, and the first image and the second image are horizontally aligned images.
- the target According to the ordinate of the target feature point, the target can be clearly defined. On which horizontal line of the first image the feature point is located, the horizontal line corresponding to the target feature point can be accurately found in the second image through the correspondence of the horizontal line.
- the step of matching the position of the point in the second image along the horizontal line according to the first gray value of the starting tracking point and the second gray value and gray gradient value of the target feature point may include :
- Step S201 Calculate the position deviation of the starting tracking point in the direction of the horizontal line according to the second gray value, the gray gradient value of the target feature point of the first image, and the first gray value of the starting tracking point.
- This step is mainly to determine the starting tracking point according to the second gray value and gray gradient value of the target feature point of the first image, and the first gray value of the starting tracking point located on the above-mentioned horizontal line of the second image
- the position deviation in the horizontal direction, the position deviation is mainly used to reflect the position deviation of the starting tracking point and the matching point in the second image, such as the distance between the starting tracking point and the matching point Etc., where the matching point refers to a point in the second image that matches the target feature point of the first image.
- Step S202 Determine the position of the initial tracking point on the horizontal line.
- position information such as the two-dimensional coordinates of the starting tracking point in the second image can be obtained, and the position of the starting tracking point on the horizontal line of the second image can be determined by the two-dimensional coordinates.
- Step S203 Determine the position of the matching point in the second image according to the position of the initial tracking point on the horizontal line and the position deviation in the direction of the horizontal line.
- This step determines the matching point in the second image that matches the target feature point according to the position of the starting tracking point on the horizontal line of the second image and the position deviation of the starting tracking point in the direction of the horizontal line. Location.
- the above embodiment determines the position of the target feature point in the second image based on the position deviation of the initial tracking point in the direction of the horizontal line and the position information of the initial tracking point, which can accurately reflect the position of the target feature point in the second image
- the tracking process and compared with the traditional template matching-based algorithm that requires exhaustive search, the solution of this embodiment only needs to perform a limited number of iterations from the starting tracking point to determine the target feature point matching
- the location of the matching point, and the method for calculating the position of the target feature point in the second image is flexible and changeable, and the position deviation can be calculated by setting multiple iterations to obtain a higher precision position deviation Therefore, the position of the matching point that matches the target feature point in the second image can be accurately tracked.
- the position deviation of the initial tracking point in the direction of the horizontal line is calculated according to the second gray value, the gray gradient value of the target feature point of the first image, and the first gray value of the initial tracking point. Steps can include:
- step S301 the difference between the second gray value of the target feature point and the first gray value of the initial tracking point is performed to obtain the gray deviation value of the target feature point and the initial tracking point.
- This step is mainly to perform the difference operation between the second gray value of the target feature point in the first image and the first gray value of the starting tracking point in the second image to obtain the difference between the target feature point and the starting tracking point.
- Grayscale deviation which refers to the amount of deviation between the first grayscale value and the second grayscale value.
- Step S302 Calculate the gray gradient value of the target feature point in the direction of the horizontal line according to the gray gradient value of the target feature point.
- the gray gradient value of the target feature point in the horizontal and vertical directions of the first image can be calculated first, and then the gray gradient value is projected on the unit direction vector of the horizontal line on the second image to obtain the target feature point in the horizontal line direction.
- the horizontal gray gradient value of the target feature point in the first image is I x
- the vertical gray gradient value in the first image is I y
- the gray level of the target feature point in the direction of the horizontal line The gradient value can be expressed as [I x I y ]n, where n represents the unit direction vector of the horizontal line.
- Step S303 Obtain the position deviation of the starting tracking point in the direction of the horizontal line according to the gray deviation value and the gray gradient value of the target feature point in the direction of the horizontal line.
- the first gray value of the target feature point of the first image and the second gray value of the initial tracking point are subjected to a difference operation to obtain the gray deviation value between the target feature point and the initial tracking point
- the grayscale deviation value can be used to reflect the grayscale difference between the target feature point and the starting tracking point
- the grayscale deviation value and the grayscale gradient value of the target feature point in the direction of the horizontal line can be used Calculate the position deviation of the initial tracking point in the second image in the direction of the horizontal line, combining the gray difference between the target feature point and the initial tracking point and the gray gradient value of the target feature point in the direction of the horizontal line.
- the aspect feature information calculates the position deviation of the starting tracking point in the second image, so that the position deviation is reflected by the gray difference between the target feature point and the starting tracking point, combined with the direction of the target feature point in the horizontal line
- the gray gradient value above is beneficial to accurately and quickly track the position of the matching point that matches the target tracking point in the second image based on the starting tracking point.
- the step of obtaining the position deviation of the starting tracking point in the direction of the horizontal line according to the gray deviation value and the gray gradient value of the target feature point in the direction of the horizontal line may include:
- the gray gradient value of the target feature point in the direction of the horizontal line is squared to obtain the spatial gradient value of the target feature point in the direction of the horizontal line; according to the gray gradient value and gray deviation of the target feature point in the direction of the horizontal line
- the product of the values to obtain the image deviation value calculate the ratio of the image deviation value to the spatial gradient value of the target feature point in the direction of the horizontal line; determine the initial tracking point in the direction of the horizontal line according to the ratio and the unit direction vector of the horizontal line Position deviation.
- a rectangular pixel window W can be created in the first image with the target feature point as the center, and then the gray gradient value of the target feature point in the direction of the horizontal line can be calculated.
- the gray gradient value in the direction can be expressed as:
- p x represents the abscissa of the target feature point on the first image
- p y represents the ordinate of the target feature point on the first image
- u and v represent the pixel points in the matrix pixel window relative to the target feature point
- n represents the unit direction vector of the horizontal line, which can be used to indicate the direction of the horizontal line.
- the matrix pixel window W has a length of w and a height of h
- the range of u is from -w/2 to w /2
- v ranges from -h/2 to h/2
- S(u,v) represents the gray gradient value of the target feature point in the direction of the horizontal line
- the gray gradient value is squared
- the spatial gradient value of the target feature point in the direction of the horizontal line can be obtained, and the spatial gradient value can be calculated using the following formula: Among them, m represents the spatial gradient value of the target feature point in the direction of the horizontal line.
- the image deviation value of the first image and the second image can be calculated by the following formula:
- b represents the image deviation value
- [I(p x +u,p y +v)-J(q x ,q y )] is the gray level deviation value
- I(p x +u,p y +v) represents The gray value of the point (p x + u, p y + v) in the first image
- J(q x , q y ) represents the gray value of the point (q x , q y ) in the second image
- the deviation value is mainly used to indicate the image deviation information between the target feature point of the first image and the starting tracking point of the second image, including grayscale deviation information.
- the ratio of the image deviation value and the spatial gradient value of the target feature point in the direction of the horizontal line can be calculated The product of the unit direction vector n of the horizontal line As the position deviation of the starting tracking point in the direction of the horizontal line.
- the foregoing embodiment calculates the spatial gradient value of the target feature point in the direction of the horizontal line and the image deviation value between the target feature point and the initial tracking point, and determines the initial tracking point based on the ratio of the image deviation value to the spatial gradient value.
- the position deviation in the direction of the horizontal line further refines the calculation method of the position deviation, and fully considers the image deviation between the target feature point and the starting tracking point. For example, when the image deviation value is zero, the obtained starting The position deviation of the tracking point in the direction of the horizontal line is also zero, and the position of the target feature point in the second image can be further accurately tracked with the help of information such as grayscale deviation.
- the step of calculating the gray gradient value of the target feature point in the direction of the horizontal line according to the gray gradient value of the target feature point may include:
- the gray gradient values of the target feature points in the horizontal and vertical directions of the first image construct the gray gradient matrix of the target feature points; obtain the unit direction vector of the horizontal line; multiply the gray gradient matrix and the unit direction vector Set as the gray gradient value of the target feature point in the direction of the horizontal line.
- the gray gradient value of the target feature point in the lateral direction of the first image can reflect the gray change trend of the target feature point in the lateral direction
- the gray gradient value in the longitudinal direction can reflect the gray scale change trend of the target feature point in the lateral direction
- the gray change trend in the longitudinal direction, the gray gradient value of the target feature point in the horizontal and vertical directions of the first image can be calculated based on the gray value of the target feature point in the first image, and the gray gradient matrix is carried at the same time
- a matrix of the gray gradient value of the target feature point in the lateral direction of the first image and the gray gradient value in the longitudinal direction, the unit direction vector of the horizontal line may be based on the ordinate corresponding to the horizontal line in the second image
- multiply the gray gradient matrix with the unit direction vector of the horizontal line to obtain the gray gradient value of the target feature point in the direction of the horizontal line on the second image, which can be used to reflect the target feature point in the horizontal line
- the changing trend of gray in the direction is based on the gray value of the target feature point in the first image, and the gray gradient matrix is carried at the same time
- the horizontal and vertical directions refer to the directions of two coordinate axes that are perpendicular to each other in the first image.
- An XY rectangular coordinate system can be established in the first image, and the horizontal and vertical directions correspond to the directions of the X axis and the Y axis, respectively.
- the gray gradient value I x (x, y) of the pixel in the X-axis direction and the Y-axis direction can be calculated.
- the gray-scale gradient value I y (x,y) on the above, the gray-scale value distribution of the pixels in the first image can be regarded as a two-dimensional discrete function, and the gray-scale gradient value of each pixel in the first image can correspond to this
- the derivative of a two-dimensional discrete function There are many ways to calculate the derivative of a two-dimensional discrete function. For the sake of simplicity, the following formula can be used to calculate the gray gradient value of the target feature point in the X-axis and Y-axis directions:
- I x (x,y) [I(x+1,y)-I(x-1,y)]/2
- I(x+1,y) represents the gray value of the next pixel of the target feature point in the X-axis direction
- I(x-1,y) represents the gray value of the previous pixel of the target feature point in the X-axis direction
- I(x,y+1) represents the gray value of the next pixel of the target feature point in the Y-axis direction
- I(x,y-1) represents the previous pixel of the target feature point in the Y-axis direction
- I x (x, y) represents the gray gradient value of the target feature point in the X-axis direction
- I y (x, y) represents the gray gradient value of the target feature point in the Y-axis direction.
- the following matrix can be used as the gray gradient matrix of the target feature point:
- t (x, y) represents the gray gradient matrix of the target feature point
- the matrix includes the gray gradient value I x (x, y) of the target feature point in the X axis direction and the gray gradient value in the Y axis direction I y (x,y).
- the gray gradient value of the target feature point in the direction of the horizontal line can be expressed by the following formula:
- s(x,y) represents the gray gradient value of the target feature point in the direction of the horizontal line.
- the foregoing embodiment obtains the gray gradient value of the target feature point in the direction of the horizontal line according to the gray value change value of the target feature point of the first image in the horizontal and vertical directions and the unit direction vector of the horizontal line, which simplifies the calculation of the target feature
- the step of determining the gray gradient value of the point in the direction of the horizontal line accurately reflects the gray change value of the target feature point in the direction of the horizontal line, which is beneficial to improve the accuracy of tracking the target feature point in the second image And efficiency.
- Step S401 Create a rectangular pixel window centered on the target feature point in the first image.
- a rectangular pixel window W can be generated with the target feature point as the geometric center in the first image.
- the length of the rectangular pixel window W is w and the height is h.
- the relative position coordinates of each pixel in the rectangular pixel window W The value range is such that the value range of the abscissa u can be from -w/2 to w/2, and the value range of the ordinate v can be from -h/2 to h/2.
- Step S402 Obtain the gray value of each pixel in the rectangular pixel window; calculate the gray gradient value of the target feature point in the horizontal and vertical directions of the rectangular pixel window according to the gray value.
- the gray gradient value of the target feature point in the lateral direction of the rectangular pixel window can be expressed as I x (x, y), and the gray gradient value in the longitudinal direction can be expressed as I y (x, y) ,
- I x x (x, y)
- I y x, y
- I x (x,y) [I(x+1,y)-I(x-1,y)]/2
- I(x+1,y) represents the gray value of the pixel point behind the target feature point in the X-axis direction
- I(x-1,y) represents the gray value of the pixel point before the target feature point in the X-axis direction
- I(x,y+1) represents the gray value of the next pixel of the target feature point in the Y-axis direction
- I(x,y-1) represents the previous pixel of the target feature point in the Y-axis direction
- Step S403 Calculate the spatial gradient matrix of the target feature point in the rectangular pixel window according to the gray gradient value, and calculate the feature value of the spatial gradient matrix.
- the following matrix can be used as the spatial gradient matrix of the target feature point:
- M(x,y) represents the spatial gradient matrix of the target feature point in the matrix pixel window W
- the intermediate variable I x (x,y) 2 I x ⁇ I x
- I y (x,y) 2 I y ⁇ I y
- I xy (x,y) I x ⁇ I y
- g(u,v) represents the Gaussian weighting function.
- Step S404 Determine the type of the target feature point according to the feature value.
- This step is mainly to determine the type of the target feature point based on the eigenvalues ⁇ 1 and ⁇ 2 of the spatial gradient matrix M(x, y) obtained in step S403.
- the type of the target feature point may include corner points and/or edge points, etc. .
- FIG 4 is a schematic diagram of the feature values of the image feature points in an embodiment.
- the arrow indicated by 330a in Figure 4 indicates the direction in which ⁇ 1 increases
- the arrow indicated by 330b indicates the direction in which ⁇ 2 increases
- 330c ⁇ 1 and ⁇ 2 are both very small.
- 330d and 330f indicate areas where edge points are located.
- ⁇ 1 is much smaller than ⁇ 2 in the area indicated by 330d
- ⁇ 2 is much smaller than 330f.
- ⁇ 1 and the area indicated by 330e is a corner area, ⁇ 1 and ⁇ 2 are both larger, and ⁇ 1 ⁇ 2 .
- the type of the target feature point can be determined.
- FIG. 5(a) As shown in Fig. 5(a) to Fig. 5(c), the images in Fig. 5(a) to Fig. 5(c) all have a shaded area 350, Fig. 5(a) has a first feature point 351, and Fig. 5(a) has The second feature point 352, FIG. 5(c) has a third feature point 353, in which the first feature point 351 does not change significantly in gray value in the directions indicated by the arrows in FIG. 5(a), which is similar to that in FIG.
- the plane area of 330c in the middle corresponds to the second feature point 352.
- the gray value of the second feature point 352 does not change significantly in the direction shown by the arrow 352a in FIG.
- the corner areas of 330d and 330f correspond to the corner areas of 330d and 330f.
- the third feature point 353 has obvious gray value changes in the directions indicated by the arrows in FIG. 5(c), which may correspond to the corner area of 330e in FIG.
- the corner points of the image are generally selected as the key points, because technicians usually think that the corner points have good characteristics: it does not change with large image deformation, and it is not sensitive to small image deformation.
- the stable corners that can be extracted from the image are very limited. If there are too few corners as key points, there will be fewer corners that can be successfully tracked, which will greatly affect follow-up work.
- edge points in the image such as straight edge points can also be used as key points. This solution has the advantage of the number of extractables to increase the number of key points in the first image, which can improve tracking The stability and robustness.
- the eigenvalue ⁇ 1 of the spatial gradient matrix M (x, y) of each pixel of the first image is less than ⁇ 2 , for satisfying ⁇ 2 (x, y) greater than ⁇ Max( ⁇ 2 ) and ⁇ 1 (x, y) are smaller than ⁇ ⁇ Max ( ⁇ 1 ) condition point (x, y), can be regarded as the edge point in the first image.
- ⁇ and ⁇ are preset thresholds. Generally, 0 ⁇ , ⁇ 1, Max( ⁇ 1 ) represents the largest value of ⁇ 1 in the first image, Max( ⁇ 2 ) represents the largest value in the first image The ⁇ 2 value.
- a minimum distance d between edge points may be set, and a plurality of the obtained edge points may be filtered to obtain an edge point set of the first image.
- FIG. 6 is a schematic flowchart of a method for tracking image feature points in another embodiment.
- the method for tracking image feature points may include the following steps :
- step S601 an image pyramid is established for the first image and the second image respectively.
- the image pyramid may include multiple layers of images, L m represents the given number of pyramid levels, generally 3, as shown in Figure 7, which is a schematic diagram of the image pyramid in an embodiment.
- the target feature points can be tracked from the top layer, a rough result is obtained first, and then the result is used as the initial point of the next layer and then tracked, and iteratively until reaching the 0th layer, which is the bottom image, as a kind of from coarse to fine Analysis strategy.
- Step S602 that is, step a, determine the position of the target feature point in the image of the first image layer.
- the current layer image is the current layer image in the image pyramid, which refers to the image layer currently used to track the target feature points. Assuming that the target feature points are currently tracked in the third layer, the current layer image is the third layer image .
- This step is mainly to confirm the position of the target feature point in the image of this layer.
- the position of the target feature point, such as the edge point u, on the L-th layer map IL of the first image I can be set as Among them, p x and p y can represent the coordinates of the edge point u.
- Step S603 that is, step b.
- Step S603 Use the image feature point tracking method as described in any of the above embodiments to track the target feature point according to the location of the target feature point, and obtain the target feature point in the second image in the current layer image. The matching point that matches the target feature point.
- u and v represent the position coordinates of each pixel in the matrix pixel window W relative to the target feature point. If the matrix pixel window W has a length of w and a height of h, the value range of u is from -w/2 To w/2, the value range of v is from -h/2 to h/2, I x (x,y) represents the gray of the pixel in the X-axis direction of the first image I L at the position (x,y) Degree gradient value, I y (x,y) represents the gray gradient value in the Y axis direction, n represents the unit direction vector of the horizontal line, S(u,v) represents the gray of the target feature point in the direction of the horizontal line Degree gradient value, and calculate the spatial gradient value of the target feature point in the Lth layer according to the gray gradient value
- Step S604, c Set the matching point as the starting tracking point of the next layer of the image of the second image.
- Step S605 Repeat the above steps a to c until the obtained matching point is the matching point on the bottom image of the second image.
- Figure 8 is an effect comparison diagram of the image feature point tracking method in an embodiment.
- Figure 8 shows the effect diagram of the two methods for tracking image feature points.
- the ordinate represents the matching rate of the feature points, and the horizontal
- the coordinates are the matching time. The higher the matching rate, the better the tracking effect on image feature points.
- Figure 8 shows the tracking method of image feature points provided by the embodiment of this application and the traditional algorithm based on absolute error and template matching (SAD) The matching success rate on a certain test data set at time, where the solid line in FIG. 8 represents the data curve of the image feature point tracking method provided by the embodiment of the application, and the dotted line in FIG.
- SAD absolute error and template matching
- the image feature point tracking method provided by the embodiment of the application has obvious advantages in the matching success rate, which is simpler and stronger than the traditional method. It can greatly increase the number of key points for successful matching, which is beneficial to provide more effective data support for the binocular vision system, and the image pyramid is combined with the image feature point tracking method of any one of the above embodiments. Tracking feature points further improves the stability and robustness of tracking image feature points between different images.
- FIG. 9 is a schematic flowchart of the method for matching image feature points in an embodiment.
- the method for matching image feature points may include the following steps:
- step S701 the target feature point is tracked according to the image feature point tracking method as described in any of the above embodiments, and a first matching point that matches the target feature point is acquired in the second image.
- FIG. 10 is a schematic diagram of the matching relationship of image feature points in an embodiment.
- the tracking method of image feature points as described in any of the above embodiments can be used to track the target feature point K of the first image 400a.
- the matching mentioned here refers to preliminary matching, and the first matching point K1 is not necessarily a point that actually matches the target feature point K , This is because in some scenes, the texture at the location of the target feature point K may appear repeatedly in the first image 400a and the second image 400b, resulting in the first matching point K1 that is not true to the target feature point K.
- Matching points, and these points that are not really matched are unstable, and the matching result is reliable.
- Step S702 Acquire a second matching point that matches the first matching point in the first image based on the image feature point tracking method described in any of the above embodiments.
- the first matching point is used as the new target feature point, and in a reverse manner, the image feature point tracking method described in any of the above embodiments is used to find the first matching point in the first image 400a.
- a matching point matches a second matching point.
- the first matching point K1 is used as the new target feature point
- the second image 400b is used as the new first image
- the first image 400a is used as the new
- the second image uses the image feature point tracking method as described in any of the above embodiments to obtain a second matching point K2 that matches the first matching point K1 in the first image 400a.
- Step S703 If the second matching point and the target feature point are the same point, it is determined that the first matching point matches the target feature point.
- the second matching point is compared with the target feature point. If it is determined that the second matching point and the target feature point belong to the same point in the first image, then the first matching point can be considered as the AND in the second image. The point where the target feature point is really matched. If the second matching point and the target feature point are not the same point, it means that the texture of the target feature point K is not unique in the scene, and the feature point can be removed.
- the first matching point that is initially matched with the target feature point is obtained through the image feature point tracking method as described in any of the previous embodiments, and then the same tracking method is used to reversely obtain the first matching point in the first image.
- the first matching point matches the second matching point, so that the original target feature point and the second matching point are compared to determine whether the first matching point is a point that actually matches the target feature point, which further improves the performance of the feature point. Robustness and stability of tracking matching.
- FIG. 11 is a schematic flowchart of a method for obtaining three-dimensional coordinates of a target in an embodiment. The method may include the following steps:
- Step S801 Obtain a first view image and a second view image obtained by shooting a target object; the target object is an object in a three-dimensional space.
- the binocular camera may be used to shoot the target in the three-dimensional space at the first and second angles of view, to obtain the first angle of view image and the second angle of view image.
- Step S802 correcting the first view angle image and the second view angle image to obtain the first image and the second image.
- This step is mainly to correct the first view image and the second view image, eliminate the image distortion of the first view image and the second view image, and align the two images so that the two images are strictly aligned in the horizontal direction.
- the first image and the second image thus obtained are images that are distorted and aligned in the horizontal direction.
- Step S803 Set the projected point of the target on the first image as the target feature point.
- the three-dimensional points on the target will be projected as two-dimensional points on the image.
- multiple two-dimensional pixels projected by the target on the first image can be set as targets Feature points, and then calculate the three-dimensional coordinates of the target object by calculating the two-dimensional coordinates of these pixels.
- Step S804 according to the method for tracking image feature points or the method for matching image feature points as described in any of the above embodiments, a matching point that matches the target feature point of the first image is determined in the second image.
- This step is mainly based on the image feature point tracking method or the image feature point matching method as described in any of the above embodiments, and the matching point matching the target feature point is tracked in the second image.
- Step S805 Obtain the two-dimensional coordinates of the target feature point in the first image, and obtain the two-dimensional coordinates of the matching point in the second image.
- the two-dimensional coordinates of the matching point in the second image can be obtained, and the two-dimensional coordinates of the target feature point in the first image can be obtained.
- Step S806 Obtain a first projection matrix of the first image, and acquire a second projection matrix of the second image.
- This step is mainly to obtain the projection matrix of the first image and the second image respectively.
- a camera device such as a binocular camera
- the target will be projected onto the captured photo, and after the binocular camera is calibrated, the corresponding projection matrix can be obtained
- the projection matrix can be used to determine the positional projection relationship between the three-dimensional target and the two-dimensional image.
- Step S807 Obtain the three-dimensional coordinates of the target object in the three-dimensional space according to the two-dimensional coordinates of the target feature point in the first image, the two-dimensional coordinates of the matching point in the second image, the first projection matrix and the second projection matrix.
- the positional relationship between the target object in the shot three-dimensional space and the first image and the second image can be determined, so this step can be based on the two-dimensional target feature point in the first image.
- the coordinates and the two-dimensional coordinates of the matching point in the second image are combined with the first projection matrix and the second projection matrix to calculate the three-dimensional coordinates of the target in the three-dimensional space.
- the singular value decomposition of matrix D can be performed to obtain the singular value decomposition result;
- the matrix D can be expressed as:
- U and V represent the abscissa and ordinate of the target feature point in the first image
- U′ and V′ represent the abscissa and ordinate of the matching point in the second image
- (P 1 ) T , ( P 2 ) T and (P 3 ) T respectively correspond to the first row, second row and third row in the first projection matrix
- (P 1 ′) T , (P 2 ′) T and (P 3 ′) T respectively corresponds to the first row, the second row and the third row in the second projection matrix; then, according to the singular value decomposition result, the three-dimensional coordinates of the target object in the three-dimensional space can be obtained.
- the projection matrix of the images taken by the left camera and the right camera can be obtained.
- the projection matrix corresponding to the left camera be the first projection matrix P
- the three-dimensional point in the three-dimensional space can be projected into the images of the left camera and the right camera to obtain
- the two-dimensional coordinates x and x′ on the image, and the first projection matrix P and the second projection matrix P′ can be expressed as:
- (P i ) T represents the i-th row in the first projection matrix P.
- (P i ′) T represents the i-th row in the first projection matrix P′, and i can be 1, 2, or 3.
- the tracking method or matching method for image feature points provided in the embodiments of the present application is used to track the target feature points, and obtain the target feature points and their matching points in the first image and the second image
- the two-dimensional coordinates are based on the projection matrix of the first image and the second image, so that the three-dimensional coordinates of the target in the three-dimensional space can be obtained more accurately, and it also has the characteristics of fast calculation speed and good robustness.
- FIG. 12 is a schematic structural diagram of the device for tracking image feature points in an embodiment.
- the device for tracking image feature points may include:
- the horizontal line determining module 101 is configured to determine a horizontal line corresponding to the target feature point in the second image; wherein the target feature point is the feature point of the first image; the first image and the second image are the opposite of the first image An image obtained after correction of the perspective image and the second perspective image;
- the first obtaining module 102 is configured to obtain the first gray value of the starting tracking point located on the horizontal line;
- the second acquiring module 103 is configured to acquire the second gray value and gray gradient value of the target feature point
- the feature point tracking module 104 is configured to track the matching point in the direction of the horizontal line according to the first gray value of the starting tracking point and the second gray value and gray gradient value of the target feature point.
- the position in the second image; the matching point is a point on the second image that matches the target feature point.
- the horizontal line determination module 101 is further used for:
- the feature point tracking module 104 may include:
- the position deviation calculation unit is used to calculate the position deviation of the starting tracking point in the direction of the horizontal line according to the second gray value, the gray gradient value of the target feature point of the first image, and the first gray value of the starting tracking point ;
- the initial tracking point position determining unit is used to determine the position of the initial tracking point on the horizontal line;
- the target feature point position determining unit is configured to determine the position of the matching point in the second image according to the position of the initial tracking point on the horizontal line and the position deviation in the direction of the horizontal line;
- the position deviation calculation unit is further used for:
- Difference between the second gray value of the target feature point and the first gray value of the initial tracking point to obtain the gray deviation value of the target feature point and the initial tracking point calculate according to the gray gradient value of the target feature point
- the position deviation of the starting tracking point in the direction of the horizontal line is obtained according to the gray deviation value and the gray gradient value of the target feature point in the direction of the horizontal line.
- the position deviation calculation unit is further used for:
- the gray gradient value of the target feature point in the direction of the horizontal line is squared to obtain the spatial gradient value of the target feature point in the direction of the horizontal line; according to the gray gradient value and gray deviation of the target feature point in the direction of the horizontal line
- the product of the values to obtain the image deviation value calculate the ratio of the image deviation value to the spatial gradient value of the target feature point in the direction of the horizontal line; determine the initial tracking point in the direction of the horizontal line according to the ratio and the unit direction vector of the horizontal line Position deviation.
- the position deviation calculation unit is further used for:
- the gray gradient values of the target feature points in the horizontal and vertical directions of the first image construct the gray gradient matrix of the target feature points; obtain the unit direction vector of the horizontal line; multiply the gray gradient matrix and the unit direction vector Set as the gray gradient value of the target feature point in the direction of the horizontal line.
- it may further include:
- a window creating unit for creating a rectangular pixel window centered on the target feature point in the first image
- Grayscale gradient value calculation unit used to obtain the grayscale value of each pixel in the rectangular pixel window; calculate the grayscale gradient value of the target feature point in the horizontal and vertical directions of the rectangular pixel window according to the gray value;
- the eigenvalue calculation unit is configured to calculate the spatial gradient matrix of the target feature point in the rectangular pixel window according to the gray gradient value, and calculate the eigenvalue of the spatial gradient matrix.
- the feature point type determining unit is used to determine the type of the target feature point according to the feature value.
- it may further include:
- the image correction unit is used to eliminate the image distortion of the first view image and the second view image; align the first view image and the second view image after the image distortion is eliminated, to obtain the first image and the second image.
- an image feature point tracking device is also provided.
- FIG. 13 is a schematic structural diagram of an image feature point tracking device in another embodiment.
- the image feature point tracking device may include:
- the image pyramid building module 601 is used to build image pyramids for the first image and the second image respectively; wherein, the image pyramid includes multiple layers of images;
- the feature point position determination module 602 is configured to perform step a, determine the location of the target feature point in the current layer image of the first image; wherein the current layer image is the current layer image in the image pyramid;
- the tracking point acquisition module 603 is configured to perform step b. Use the above-mentioned image feature point tracking method to track the target feature point according to the position of the target feature point, and obtain the target feature point in the second image and the target feature point. Matching point;
- the tracking point setting module 604 is configured to perform step c and set the matching point as the starting tracking point of the next layer of the image of the second image;
- the tracking point determination module 605 is configured to repeat the above steps a to c until the matching point is a matching point on the bottom image of the second image.
- the image feature point tracking device of this application corresponds to the image feature point tracking method of this application one-to-one.
- the image feature point tracking device please refer to the above definition of the image feature point tracking method.
- the technical features and beneficial effects described in the embodiment of the feature point tracking method are all applicable to the embodiment of the image feature point tracking device, and will not be repeated here.
- Each module in the device for tracking image feature points described above can be implemented in whole or in part by software, hardware, and a combination thereof.
- the above modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
- FIG. 14 is a schematic structural diagram of the device for matching image feature points in an embodiment.
- the device for matching image feature points may include:
- the first matching point obtaining module 701 is configured to track the target feature point according to the above-mentioned image feature point tracking method, and obtain the first matching point that matches the target feature point in the second image;
- the second matching point obtaining module 702 is configured to obtain a second matching point that matches the first matching point in the first image based on the above-mentioned image feature point tracking method;
- the matching point determination module 703 is configured to determine that the first matching point matches the target feature point if the second matching point and the target feature point are the same point.
- the image feature point matching device of this application corresponds to the image feature point matching method of this application one-to-one.
- the image feature point matching device please refer to the above definition of the image feature point matching method.
- the technical features and beneficial effects described in the embodiment of the feature point matching method are all applicable to the embodiment of the image feature point matching device, and will not be repeated here.
- Each module in the above image feature point matching device can be implemented in whole or in part by software, hardware and a combination thereof.
- the above modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
- FIG. 15 is a schematic structural diagram of a device for obtaining three-dimensional coordinates of a target in an embodiment.
- the device may include:
- the perspective image acquisition module 801 is used to acquire a first perspective image and a second perspective image obtained by shooting a target object; the target object is an object in a three-dimensional space;
- the viewing angle image correction module 802 is configured to correct the first viewing angle image and the second viewing angle image to obtain the first image and the second image;
- the feature point setting module 803 is configured to set the point projected by the target object on the first image as the target feature point;
- the matching point determination module 804 is configured to determine a matching point in the second image that matches the target feature point of the first image according to the above-mentioned image feature point tracking method or image feature point matching method;
- the two-dimensional coordinate acquisition module 805 is configured to acquire the two-dimensional coordinates of the target feature point in the first image, and acquire the two-dimensional coordinates of the matching point in the second image;
- the projection matrix acquisition module 806 is configured to acquire the first projection matrix of the first image and acquire the second projection matrix of the second image;
- the three-dimensional coordinate calculation module 807 is used to calculate the target object in the three-dimensional space according to the two-dimensional coordinates of the target feature point in the first image, the two-dimensional coordinates of the matching point in the second image, the first projection matrix and the second projection matrix The three-dimensional coordinates.
- the three-dimensional coordinate calculation module 807 is also used to:
- U and V represent the abscissa and ordinate of the target feature point in the first image
- U′ and V′ represent the abscissa and ordinate of the matching point in the second image
- (P 1 ) T , ( P 2 ) T and (P 3 ) T respectively correspond to the first row, second row and third row in the first projection matrix
- (P 1 ′) T , (P 2 ′) T and (P 3 ′) T respectively corresponds to the first row, the second row and the third row in the second projection matrix
- the three-dimensional coordinates of the target in the three-dimensional space are obtained according to the singular value decomposition result.
- the device for obtaining three-dimensional coordinates of a target in this application corresponds to the method for obtaining three-dimensional coordinates of a target in this application.
- the device for obtaining three-dimensional coordinates of a target please refer to the above definition of the method for obtaining three-dimensional coordinates of the target.
- the technical features and beneficial effects described in the above embodiments of the method for obtaining three-dimensional coordinates of a target are applicable to the embodiments of the device for obtaining three-dimensional coordinates of a target, and will not be repeated here.
- Each module in the above-mentioned device for acquiring three-dimensional coordinates of a target object can be implemented in whole or in part by software, hardware, and a combination thereof.
- the above modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
- a computer device is provided.
- the computer device may be a terminal.
- the internal structure diagram of the computer device may be as shown in FIG. 16, which is an internal structure diagram of the computer device in an embodiment.
- the computer equipment includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide calculation and control capabilities.
- the memory of the computer device includes a non-volatile storage medium and an internal memory.
- the non-volatile storage medium stores an operating system and a computer program.
- the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
- the network interface of the computer device is used to communicate with an external terminal through a network connection.
- the computer program is executed by the processor to realize a method for tracking image feature points, a method for matching image feature points, and a method for obtaining three-dimensional coordinates of a target.
- the display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen
- the input device of the computer equipment can be a touch layer covered on the display screen, or it can be a button, a trackball or a touchpad set on the computer equipment shell , It can also be an external keyboard, touchpad, or mouse.
- FIG. 16 is only a block diagram of part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
- the specific computer device may Including more or fewer parts than shown in the figure, or combining some parts, or having a different arrangement of parts.
- a computer device including a processor and a memory, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
- the processor further implements the following steps when executing the computer program:
- the processor further implements the following steps when executing the computer program:
- the processor further implements the following steps when executing the computer program:
- Difference between the second gray value of the target feature point and the first gray value of the initial tracking point to obtain the gray deviation value of the target feature point and the initial tracking point calculate according to the gray gradient value of the target feature point
- the position deviation of the starting tracking point in the direction of the horizontal line is obtained according to the gray deviation value and the gray gradient value of the target feature point in the direction of the horizontal line.
- the processor further implements the following steps when executing the computer program:
- the gray gradient value of the target feature point in the direction of the horizontal line is squared to obtain the spatial gradient value of the target feature point in the direction of the horizontal line; according to the gray gradient value and gray deviation of the target feature point in the direction of the horizontal line
- the product of the values to obtain the image deviation value calculate the ratio of the image deviation value to the spatial gradient value of the target feature point in the direction of the horizontal line; determine the initial tracking point in the direction of the horizontal line according to the ratio and the unit direction vector of the horizontal line Position deviation.
- the processor further implements the following steps when executing the computer program:
- the gray gradient values of the target feature points in the horizontal and vertical directions of the first image construct the gray gradient matrix of the target feature points; obtain the unit direction vector of the horizontal line; multiply the gray gradient matrix and the unit direction vector Set as the gray gradient value of the target feature point in the direction of the horizontal line.
- the processor further implements the following steps when executing the computer program:
- the processor further implements the following steps when executing the computer program:
- Eliminate the image distortion of the first view image and the second view image align the first view image and the second view image after the image distortion is eliminated, to obtain the first image and the second image.
- a computer device including a processor and a memory, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
- a computer device including a processor and a memory, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
- the tracking method of image feature points obtains the second matching point that matches the first matching point in the first image; if the second matching point and the target feature point are the same point, then the first matching point and the target feature point are judged Match.
- a computer device including a processor and a memory, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
- the target is an object in a three-dimensional space; the first-view image and the second-view image are corrected to obtain the first image and the second image;
- the point projected on the first image is set as the target feature point; according to the image feature point tracking method or the image feature point matching method described in any of the above embodiments, the target of the first image is determined in the second image
- the matching point matching the feature point obtaining the two-dimensional coordinates of the target feature point in the first image, obtaining the two-dimensional coordinates of the matching point in the second image; obtaining the first projection matrix of the first image, and obtaining the second image
- the second projection matrix obtain the three-dimensional coordinates of the target in the three-dimensional space according to the two-dimensional coordinates of the target feature point in the first image, the two-dimensional coordinates of the matching point in the second image, the first projection matrix and the second projection matrix .
- the processor further implements the following steps when executing the computer program:
- U and V represent the abscissa and ordinate of the target feature point in the first image
- U′ and V′ represent the abscissa and ordinate of the matching point in the second image
- (P 1 ) T , (P 2 ) T and (P 3 ) T respectively correspond to the first row, the second row and the third row in the first projection matrix
- (P 3 ′) T respectively correspond to the first row, the second row and the third row in the second projection matrix
- the three-dimensional coordinates of the target in the three-dimensional space are obtained according to the singular value decomposition result.
- the above-mentioned computer equipment through the computer program running on the processor, can increase the number of feature points that successfully track and match the target feature point, improve the robustness and stability of tracking the target feature point, and improve the
- the tracking range is limited to a horizontal line of the second image, which simplifies the tracking operation of feature points, speeds up the calculation, and under the premise of ensuring stability, shortens the tracking time of target feature points and improves tracking efficiency , Which helps to provide more effective data support for the binocular vision system.
- a person of ordinary skill in the art can understand that all or part of the processes in the method for tracking image feature points, the method for matching image feature points, and the method for obtaining three-dimensional coordinates of a target as described in any of the above embodiments can be implemented through a computer program.
- the computer program may be stored in a non-volatile computer readable storage medium by instructing relevant hardware.
- any reference to memory, storage, database, or other media used in the embodiments provided in this application may include non-volatile and/or volatile memory.
- Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
- Volatile memory may include random access memory (RAM) or external cache memory.
- RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
- a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
- the computer program further implements the following steps when being executed by the processor:
- the computer program further implements the following steps when being executed by the processor:
- the computer program further implements the following steps when being executed by the processor:
- Difference between the second gray value of the target feature point and the first gray value of the initial tracking point to obtain the gray deviation value of the target feature point and the initial tracking point calculate according to the gray gradient value of the target feature point
- the position deviation of the starting tracking point in the direction of the horizontal line is obtained according to the gray deviation value and the gray gradient value of the target feature point in the direction of the horizontal line.
- the computer program further implements the following steps when being executed by the processor:
- the gray gradient value of the target feature point in the direction of the horizontal line is squared to obtain the spatial gradient value of the target feature point in the direction of the horizontal line; according to the gray gradient value and gray deviation of the target feature point in the direction of the horizontal line
- the product of the values to obtain the image deviation value calculate the ratio of the image deviation value to the spatial gradient value of the target feature point in the direction of the horizontal line; determine the initial tracking point in the direction of the horizontal line according to the ratio and the unit direction vector of the horizontal line Position deviation.
- the computer program further implements the following steps when being executed by the processor:
- the gray gradient values of the target feature points in the horizontal and vertical directions of the first image construct the gray gradient matrix of the target feature points; obtain the unit direction vector of the horizontal line; multiply the gray gradient matrix and the unit direction vector Set as the gray gradient value of the target feature point in the direction of the horizontal line.
- the computer program further implements the following steps when being executed by the processor:
- the computer program further implements the following steps when being executed by the processor:
- Eliminate the image distortion of the first view image and the second view image align the first view image and the second view image after the image distortion is eliminated, to obtain the first image and the second image.
- a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
- a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
- the tracking method of image feature points obtains the second matching point that matches the first matching point in the first image; if the second matching point and the target feature point are the same point, then the first matching point and the target feature point are judged Match.
- a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
- the target is an object in a three-dimensional space; the first-view image and the second-view image are corrected to obtain the first image and the second image;
- the point projected on the first image is set as the target feature point; according to the image feature point tracking method or the image feature point matching method described in any of the above embodiments, the target of the first image is determined in the second image
- the matching point matching the feature point obtaining the two-dimensional coordinates of the target feature point in the first image, obtaining the two-dimensional coordinates of the matching point in the second image; obtaining the first projection matrix of the first image, and obtaining the second image
- the second projection matrix obtain the three-dimensional coordinates of the target in the three-dimensional space according to the two-dimensional coordinates of the target feature point in the first image, the two-dimensional coordinates of the matching point in the second image, the first projection matrix and the second projection matrix .
- the computer program further implements the following steps when being executed by the processor:
- U and V represent the abscissa and ordinate of the target feature point in the first image
- U′ and V′ represent the abscissa and ordinate of the matching point in the second image
- (P 1 ) T , ( P 2 ) T and (P 3 ) T respectively correspond to the first row, second row and third row in the first projection matrix
- (P 1 ′) T , (P 2 ′) T and (P 3 ′) T respectively corresponds to the first row, the second row and the third row in the second projection matrix
- the three-dimensional coordinates of the target in the three-dimensional space are obtained according to the singular value decomposition result.
- the above-mentioned computer-readable storage medium through the computer program stored therein, can increase the number of feature points that successfully track and match the target feature point, improve the robustness and stability of tracking the target feature point, and improve the tracking of the feature point.
- the scope is limited to a horizontal line of the second image, which simplifies the tracking operation of feature points, speeds up the calculation speed, and reduces the time to track the target feature points on the premise of ensuring stability, and improves the tracking efficiency. It is helpful to provide more effective data support for the binocular vision system.
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Analysis (AREA)
Abstract
一种图像特征点的跟踪方法、匹配方法、空间坐标获取方法、装置、计算机设备和存储介质,该跟踪方法包括步骤:在第二图像中确定与目标特征点相对应的水平线(S101),获取位于所述水平线上的起始跟踪点的第一灰度值(S102),获取所述目标特征点的第二灰度值和灰度梯度值(S103),根据所述起始跟踪点的第一灰度值以及所述目标特征点的第二灰度值和灰度梯度值,沿所述水平线的方向跟踪匹配点在所述第二图像中的位置(S104),结合了目标特征点的第二灰度值、灰度梯度值以及起始跟踪点的第一灰度值在第二图像的一水平线上进行跟踪匹配。
Description
本公开要求在2019年02月25日提交中国专利局、申请号为201910136888.4的中国专利申请的优先权,以上申请的全部内容通过引用结合在本公开中。
本申请涉及图像处理技术领域,例如涉及一种图像特征点的跟踪方法、图像特征点的跟踪装置、图像特征点的匹配方法、图像特征点的匹配装置、获取目标物三维坐标的方法、获取目标物三维坐标的装置、计算机设备和计算机可读存储介质。
在对物体进行拍摄成像的过程当中,通常会拍摄该物体在不同视角下的图像,而根据这些不同视角下的图像,能够进一步得知该物体的空间位置信息。例如,双目视觉系统是模拟生物的立体视觉成像原理,通过左摄像头和右摄像头同时拍摄同一个物体,获得该物体在两个视角下的图像,然后在拍摄的图像中通过匹配算法找出两张图像的特征点之间的匹配关系,从而通过三角测量原理来获得特征点的三维空间坐标。其中,在多张图像中对图像特征点进行准确跟踪是准确获取其空间坐标等位置信息的关键,如果无法对图像特征点进行准确跟踪,会导致空间坐标计算错误,影响双目视觉系统的性能。
传统技术通常采用绝对误差和算法(SAD)、归一化积相关算法(NCC)和误差平方和算法(SSD)等模版匹配算法来获得匹配像素,但这些算法一方面运算量大,另一方面对噪声非常敏感,对特征点的跟踪准确度较低,难以满足一些对精度要求高的场景。
发明内容
本申请提供一种图像特征点的跟踪方法、图像特征点的跟踪装置、图像特征点的匹配方法、图像特征点的匹配装置、获取目标物三维坐标的方法、获取目标物三维坐标的装置、计算机设备和计算机可读存储介质,以解决传统技术对图像特征点的跟踪准确度低的技术问题。
一种图像特征点的跟踪方法,包括步骤:
在第二图像中确定与目标特征点相对应的水平线;其中,所述目标特征点为第一图像的特征点;所述第一图像和第二图像是对第一视角图像和第二视角图像进行校正后得到的图像;
获取位于所述水平线上的起始跟踪点的第一灰度值;
获取所述目标特征点的第二灰度值和灰度梯度值;
根据所述起始跟踪点的第一灰度值以及所述目标特征点的第二灰度值和灰度梯度值,沿所述水平线的方向跟踪匹配点在所述第二图像中的位置;所述匹配点为所述第二图像上与所述目标特征点相匹配的点。
一种图像特征点的跟踪方法,包括步骤:
对第一图像和第二图像分别建立图像金字塔;其中,所述图像金字塔包括多层图像;
a、在所述第一图像的本层图像中确定所述目标特征点的位置;其中,所述本层图像为图像金字塔中的本层图像;
b、根据所述目标特征点的位置利用上述图像特征点的跟踪方法对所述目标特征点进行跟踪,获取所述目标特征点在所述第二图像的本层图像中与所述目标特征点相匹配的匹配点;
c、将所述匹配点设置为所述第二图像的本层图像的下一层图像的起始跟踪点;
重复上述步骤a至c,直到匹配点为所述第二图像的底层图像上的匹配点。
一种图像特征点的匹配方法,包括步骤:
根据上述图像特征点的跟踪方法对目标特征点进行跟踪,在所述第二图像中获取与所述目标特征点相匹配的第一匹配点;
基于上述图像特征点的跟踪方法在所述第一图像中获取与所述第一匹配点相匹配的第二匹配点;
若所述第二匹配点与目标特征点为相同的点,则判断所述第一匹配点与所述目标特征点相匹配。
一种获取目标物三维坐标的方法,包括步骤:
获取对目标物拍摄得到的第一视角图像和第二视角图像;所述目标物为三维空间中的物体;
对所述第一视角图像和第二视角图像进行校正得到第一图像和第二图像;
将所述目标物在所述第一图像上投影的点设为目标特征点;
根据上述图像特征点的跟踪方法或图像特征点的匹配方法,在所述第二图像中确定与第一图像的目标特征点相匹配的匹配点;
获取所述目标特征点在所述第一图像中的二维坐标,获取所述匹配点在第二图像中的二维坐标;
获取所述第一图像的第一投影矩阵,获取所述第二图像的第二投影矩阵;
根据所述目标特征点在所述第一图像中的二维坐标、匹配点在第二图像中的二维坐标、第一投影矩阵和第二投影矩阵获取所述目标物在三维空间中的三维坐标。
一种图像特征点的跟踪装置,包括:
水平线确定模块,用于在第二图像中确定与目标特征点相对应的水平线;其中,所述目标特征点为第一图像的特征点;所述第一图像和第二图像是对第一视角图像和第二视角图像进行校正后得到的图像;
第一获取模块,用于获取位于所述水平线上的起始跟踪点的第一灰度值;
第二获取模块,用于获取所述目标特征点的第二灰度值和灰度梯度值;
特征点跟踪模块,用于根据所述起始跟踪点的第一灰度值以及所述目标特征点的第二灰度值和灰度梯度值,沿所述水平线的方向跟踪匹配点在所述第二图像中的位置;所述匹配点为所述第二图像上与所述目标特征点相匹配的点。
一种图像特征点的跟踪装置,包括:
图像金字塔建立模块,用于对第一图像和第二图像分别建立图像金字塔;其中,所述图像金字塔包括多层图像;
特征点位置确定模块,用于执行步骤a、在所述第一图像的本层图像中确定所述目标特征点的位置;其中,所述本层图像为图像金字塔中的本层图像;
跟踪点获取模块,用于执行步骤b、根据所述目标特征点的位置利用上述图像特征点的跟踪方法对所述目标特征点进行跟踪,获取所述目标特征点在所述第二图像的本层图像中与所述目标特征点相匹配的匹配点;
跟踪点设置模块,用于执行步骤c、将所述匹配点设置为所述第二图像的本层图像的下一层图像的起始跟踪点;
跟踪点确定模块,用于重复上述步骤a至c,直到所述匹配点为所述第二图像的底层图像上的匹配点。
一种图像特征点的匹配装置,包括:
第一匹配点获取模块,用于根据上述图像特征点的跟踪方法对目标特征点进行跟踪,在所述第二图像中获取与所述目标特征点相匹配的第一匹配点;
第二匹配点获取模块,用于基于上述图像特征点的跟踪方法在所述第一图像中获取与所述第一匹配点相匹配的第二匹配点;
匹配点判断模块,用于若所述第二匹配点与目标特征点为相同的点,则判断所述第一匹配点与所述目标特征点相匹配。
一种获取目标物三维坐标的装置,包括:
视角图像获取模块,用于获取对目标物拍摄得到的第一视角图像和第二视角图像;所述目标物为三维空间中的物体;
视角图像校正模块,用于对所述第一视角图像和第二视角图像进行校正得到第一图像和第二图像;
特征点设置模块,用于将所述目标物在所述第一图像上投影的点设为目标特征点;
匹配点确定模块,用于根据上述图像特征点的跟踪方法或图像特征点的匹配方法,在所述第二图像中确定与第一图像的目标特征点相匹配的匹配点;
二维坐标获取模块,用于获取所述目标特征点在所述第一图像中的二维坐标,获取所述匹配点在第二图像中的二维坐标;
投影矩阵获取模块,用于获取所述第一图像的第一投影矩阵,获取所述第二图像的第二投影矩阵;
三维坐标获取模块,用于根据所述目标特征点在所述第一图像中的二维坐标、匹配点在第二图像中的二维坐标、第一投影矩阵和第二投影矩阵获取所述目标物在三维空间中的三维坐标。
一种计算机设备,包括处理器和存储器,所述存储器上存储有计算机程序,所述处理器执行所述计算机程序时实现上述图像特征点的跟踪方法、图像特征点的匹配方法或获取目标物三维坐标的方法的步骤。
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述图像特征点的跟踪方法、图像特征点的匹配方法或获取目标物三维坐标的方法的步骤。
上述图像特征点的跟踪方法、匹配方法、获取目标物三维坐标的方法、装置、计算机设备和存储介质,结合了目标特征点的第二灰度值、灰度梯度值以及起始跟踪点的第一灰度值,在第二图像的一水平线的方向上,对目标特征点进行跟踪匹配,能够增加对目标特征点成功跟踪匹配的特征点数目,提高了对目标特征点进行跟踪的鲁棒性和稳定性,还将特征点的跟踪范围限缩至第二图像的一水平线上,使得特征点的跟踪操作得到简化,加快了运算速度,在保证稳定性的前提下,缩短了对目标特征点进行跟踪的时间,提高了跟踪效率,有利于为双目视觉系统提供更有效的数据支持。
图1为一个实施例中图像特征点的跟踪方法的应用环境图;
图2为一个实施例中图像特征点的跟踪方法的流程示意图;
图3为一个实施例中第一图像和第二图像的关系示意图;
图4为一个实施例中图像特征点的特征值示意图;
图5(a)为一个实施例中一种图像特征点的类型示意图;
图5(b)为一个实施例中另一种图像特征点的类型示意图;
图5(c)为一个实施例中又一种图像特征点的类型示意图;
图6为另一个实施例中图像特征点的跟踪方法的流程示意图;
图7为一个实施例中图像金字塔的示意图;
图8为一个实施例中图像特征点的跟踪方法的效果对比图;
图9为一个实施例中图像特征点的匹配方法的流程示意图;
图10为一个实施例中图像特征点的匹配关系示意图;
图11为一个实施例中获取目标物三维坐标的方法的流程示意图;
图12为一个实施例中图像特征点的跟踪装置的结构示意图;
图13为另一个实施例中图像特征点的跟踪装置的结构示意图;
图14为一个实施例中图像特征点的匹配装置的结构示意图;
图15为一个实施例中获取目标物三维坐标的装置的结构示意图;
图16为一个实施例中计算机设备的内部结构图。
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
需要说明的是,本申请实施例所涉及的术语“第一\第二”仅仅是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二”在允许的情况下可以互换特定的顺序或先后次序。应该理解“第一\第二”区分的对象在适当情况下可以互换,以使这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。
本申请提供的图像特征点的跟踪方法,可以应用于如图1所示的应用环境中,图1为一个实施例中图像特征点的跟踪方法的应用环境图,通过摄像设备在不同视角下对目标物10进行拍摄,从而可以得到目标物10在不同视角下的图像,以双目摄像系统为例,双目摄像系统包括左摄像头和右摄像头,通过左摄像头和右摄像头对三维空间中的目标物10进行拍摄,可以获取目标物10在左右目视角下的图像,如图1中第一视角图像100a为左摄像头以左目视角拍摄得到图像,第一视角图像100b为右摄像头以右目视角拍摄得到图像,第一视角图像100a和第一视角图像100b中都拍摄有该目标物的特征点A,在将第一视角图像100a和第一视角图像100b传输到如个人计算机等具有数据处理能力的计算机设备后,计算机设备可以将该第一视角图像100a和第一视角图像100b进行校正得到第一图像和第二图像,以消除第一视角图像100a和第一视角图像100b的图像畸变以及使得双目摄像系统的左右摄像头拍摄的图像进行对齐,即两张图像在水平方向严格对齐,这样一幅图像上任意一点与其在另一幅图像上的匹配点就必然在同一行上,其中,第一图像是对第一视角图像100a校正处理后得到的图像,第二图像是对第二视角图像100b校正处理后得到的图像,然后可以在第二图像中确定第一图像中的特征点A所在的水平线,接着获取位于该水平线上的起始跟踪点的第一灰度值,获取特征点A在第一图像中的第二灰度值和灰度梯度值,根据起始跟踪点的第一灰度值以及特征点A的第二灰度值和灰度梯度值,沿第二图像中的水平线方向跟踪特征点A在该第二图像中的位置。
在一个实施例中,提供了一种图像特征点的跟踪方法,参考图2,图2为一个实施例中图像特征点的跟踪方法的流程示意图,该方法通过个人计算机等具备数据处理能力的计算机设备实现,该图像特征点的跟踪方法可以包括以下步骤:
步骤S101,在第二图像中确定与目标特征点相对应的水平线。
本步骤中,目标特征点是第一图像的特征点,该目标特征点一般是用于标识图像特征的关键像素点,可以是图像中的角点和边缘点等特征点。第一图像和第二图像是对第一视角图像和第二视角图像进行校正后得到的图像,其中,第一图像对应于第一视角图像,是对第一视角图像进行校正处理后得到的图像,而第二图像对应于第二视角图像,是对第二视角图像进行校正处理后得到的图像。
对第一视角图像和第二视角图像进行校正的主要目的是消除两张图像的畸变,以及将两张图像进行对齐,使得两张图像在水平方向上严格对齐,而第一图像和第二图像就是消除畸变的并且在水平方向上对齐的图像。
可以在第二图像中确定与目标特征点相对应的水平线的步骤之前,先对第一视角图像和第二视角图像进行校正处理,具体步骤可以包括:获取第一视角图像和第二视角图像,然后消除该第一视角图像和第二视角图像中存在的图像畸变,接着就可以将消除图像畸变后的第一视角图像和第二视角图像进行对齐,从而得到第一图像和第二图像。经过如上校正处理,第一图像或第二图像上的任意像素点在对应的另一张图像上的匹配点必然会处于同一水平线上,这样,在第一图像中选择需要跟踪匹配的目标特征点后,能够在 第二图像中确定与该目标特征点相对应的水平线。
参考图3,图3为一个实施例中第一图像和第二图像的关系示意图,以双目摄像系统为例对本步骤进行说明,可以先对双目摄像系统的双目摄像头进行标定,得到双目摄像头的内参、畸变系数和外参等参数,然后利用标定得到的内参、畸变系数和外参等参数对如图1所示的第一视角图像100a和第二视角图像100b进行校正处理,消除第一视角图像100a和第二视角图像100b的图像畸变,并对第一视角图像100a和第二视角图像100b进行对齐操作,得到如图3所示的第一图像300a和第二图像300b,该第一图像300a和第二图像300b在水平方向上为严格对齐,使得第一图像300a上任意一点与该点在第二图像300b上的匹配点就必然在同一行上,即如果第一图像300a上的特征点A在第一图像300a的第一水平线310a上,而第二水平线310b为第二图像300b的与第一水平线310a处于同一水平线的水平线,则第二图像300b上匹配的特征点A必然位于该第二水平线310b上,即第二图像300b上匹配的特征点A与第一图像300a的特征点A具有相同的垂直坐标值,所以在第一图像310a中选择需要跟踪匹配的目标特征点A后,能够在第二图像310b中确定与该目标特征点A相对应的水平线310b。
步骤S102,获取位于该水平线上的起始跟踪点的第一灰度值。
本步骤主要是在第二图像中获取位于该水平线上的起始跟踪点的灰度值作为该第一灰度值,该起始跟踪点主要用于在第二图像中作为起始点对第一图像的目标特征点进行跟踪匹配,其中,该起始跟踪点可以从该水平线上的各个像素点中随机选取,也可以根据目标特征点在第一图像中的位置,在第二图像中找到与该位置一致的像素点作为该起始跟踪点。而为了提高目标特征点的跟踪效率,可以从预存的第二图像的各个像素点的像素特征信息中提取该起始跟踪点的第一灰度值。
步骤S103,获取目标特征点的第二灰度值和灰度梯度值。
本步骤可以从第一图像中获取该目标特征点的灰度值作为该第二灰度值,并可以基于该第二灰度值计算目标特征点在第一图像所在图像平面上的各个方向上的灰度变化值,即灰度梯度值,例如可以根据目标特征点的灰度值计算该目标特征点在第一图像的横向和纵向方向上的灰度梯度值。
步骤S104,根据起始跟踪点的第一灰度值以及目标特征点的第二灰度值和灰度梯度值,沿该水平线的方向跟踪匹配点在第二图像中的位置;该匹配点为第二图像上与目标特征点相匹配的点。
其中,第二图像的水平线的方向是指该水平线向两端延伸的方向。参考图3,本步骤可以将水平线上的像素点A
0设为起始跟踪点,根据该起始跟踪点的第一灰度值,以及第一图像300a中的目标特征点A的第二灰度值和灰度梯度值,在第二图像300b中沿着水平线310b的方向,对目标特征点A的位置进行跟踪,进而确定匹配的特征点A在第二图像300b中的位置。
上述图像特征点的跟踪方法,结合了目标特征点的第二灰度值、灰度梯度值以及起始跟踪点的第一灰度值在第二图像的一水平线的方向上,对目标特征点进行跟踪匹配,能够增加对目标特征点成功跟踪匹配的特征点数目,提高了对目标特征点进行跟踪的鲁棒性和稳定性,还将特征点的跟踪范围限缩至第二图像的一水平线上,使得特征点的跟踪操作得到简化,加快了运算速度,在保证稳定性的前提下,缩短了对目标特征点进行跟踪的时间,提高了跟踪效率,有利于为双目视觉系统提供更有效的数据支持。
在一个实施例中,在第二图像中确定与目标特征点相对应的水平线的步骤可以包括:
获取目标特征点在第一图像中的位置;确定第一图像与第二图像的水平线对应关系;根据目标特征点在第一图像中的位置和水平线对应关系确定第二图像中的所述水平线。
本实施例主要是根据目标特征点在第一图像中的位置以及第一图像和第二图像的水平线对应关系,从而在第二图像中确定目标特征点所在的水平线。其中,目标特征点在第一图像中的位置可以是该目标特征点的纵坐标,水平线对应关系是指第一图像中的各水平线与第二图像中的各水平线的对应关系,如图3所 示,第一水平线310a与第二水平线310b的对应关系即为处于同一水平线的两条水平线,而第一图像和第二图像是经过水平对齐的图像,根据目标特征点的纵坐标可以明确该目标特征点在第一图像的哪条水平线上,然后通过水平线的对应关系能够准确地在第二图像中找到与该目标特征点相对应的水平线。
在一个实施例中,根据起始跟踪点的第一灰度值以及目标特征点的第二灰度值和灰度梯度值,沿水平线的方向匹配点在第二图像中的位置的步骤可以包括:
步骤S201,根据第一图像的目标特征点的第二灰度值、灰度梯度值以及起始跟踪点的第一灰度值计算起始跟踪点在水平线的方向上的位置偏差。
本步骤主要是根据第一图像的目标特征点的第二灰度值和灰度梯度值,以及位于第二图像的上述水平线上的起始跟踪点的第一灰度值确定该起始跟踪点在该水平线方向上的位置偏差量,该位置偏差量主要用于反映第二图像中的起始跟踪点与匹配点的位置偏差情况,如起始跟踪点与匹配点之间偏移了多少距离等,其中,匹配点是指在第二图像中与第一图像的目标特征点相匹配的点。
步骤S202,确定起始跟踪点在水平线上的位置。
本步骤可以获取起始跟踪点在第二图像中的二维坐标等位置信息,通过二维坐标确定该起始跟踪点在第二图像的所述水平线上的位置。
步骤S203,根据起始跟踪点在水平线上的位置以及在水平线的方向上的位置偏差确定匹配点在第二图像中的位置。
本步骤根据起始跟踪点在第二图像的所述水平线上的位置以及该起始跟踪点在所述水平线的方向上的位置偏差量确定第二图像中的与目标特征点相匹配的匹配点所在的位置。
上述实施例通过起始跟踪点在水平线的方向上的位置偏差和起始跟踪点的位置信息确定目标特征点在第二图像中的位置,能够准确反映处目标特征点在第二图像中的位置跟踪过程,而且相比于传统的基于模版匹配的算法需要进行穷举搜索的方式,本实施例的方案只需要从起始跟踪点开始进行有限次迭代操作即可确定与目标特征点相匹配的匹配点所在的位置,而且该方案对目标特征点在第二图像中的位置的计算方式灵活多变,还可以通过设置多次迭代的方式计算所述位置偏差量以获取更高精度的位置偏差量,从而准确跟踪到与目标特征点相匹配的匹配点在第二图像中的位置。
在一个实施例中,根据第一图像的目标特征点的第二灰度值、灰度梯度值以及起始跟踪点的第一灰度值计算起始跟踪点在水平线的方向上的位置偏差的步骤可以包括:
步骤S301,将目标特征点的第二灰度值与起始跟踪点的第一灰度值进行作差,得到目标特征点与起始跟踪点的灰度偏差值。
本步骤主要是将第一图像中的目标特征点的第二灰度值与第二图像中的起始跟踪点的第一灰度值进行作差运算,获取目标特征点与起始跟踪点的灰度偏差,该灰度偏差是指第一灰度值和第二灰度值的偏差量。
步骤S302,根据目标特征点的灰度梯度值计算目标特征点在水平线的方向上的灰度梯度值。
可以先计算目标特征点在第一图像的横向和纵向上的灰度梯度值,再将该灰度梯度值在第二图像上的所述水平线的单位方向向量投影得到目标特征点在该水平线方向上的灰度梯度值。
具体来说,假设目标特征点在第一图像的横向灰度梯度值为I
x,在第一图像的纵向灰度梯度值为I
y,则目标特征点在所述水平线的方向上的灰度梯度值可以表示为[I
x I
y]n,其中,n表示该水平线的单位方向向量。
步骤S303,根据灰度偏差值和目标特征点在水平线的方向上的灰度梯度值获取起始跟踪点在水平线的 方向上的位置偏差。
本实施例,将第一图像的目标特征点的第一灰度值与起始跟踪点的第二灰度值进行作差运算,得到目标特征点与起始跟踪点之间的灰度偏差值,该灰度偏差值可以用于反映目标特征点与起始跟踪点之间的灰度差异情况,利用该灰度偏差值以及该目标特征点在所述水平线的方向上的灰度梯度值可以计算出第二图像中起始跟踪点在该水平线的方向上的位置偏差,结合了目标特征点与起始跟踪点的灰度差异情况以及目标特征点在水平线的方向上的灰度梯度值两方面特征信息对第二图像中起始跟踪点的所述位置偏差进行计算,使得该位置偏差通过目标特征点与起始跟踪点的灰度差异情况进行体现,还结合目标特征点在水平线的方向上的灰度梯度值,有利于基于起始跟踪点准确而且快速地在第二图像中跟踪到与目标跟踪点相匹配的匹配点的位置。
在一个实施例中,根据灰度偏差值和目标特征点在水平线的方向上的灰度梯度值获取起始跟踪点在水平线的方向上的位置偏差的步骤可以包括:
将目标特征点在水平线的方向上的灰度梯度值进行平方运算,得到目标特征点在水平线的方向上的空间梯度值;根据目标特征点在水平线的方向上的灰度梯度值与灰度偏差值的乘积获取图像偏差值;计算图像偏差值与目标特征点在水平线的方向上的空间梯度值的比值;根据该比值和水平线的单位方向向量确定起始跟踪点在所述水平线的方向上的位置偏差。
在本实施例中,可以在第一图像中以目标特征点为中心创建一矩形像素窗口W,进而计算目标特征点在所述水平线的方向上的灰度梯度值,目标特征点在该水平线的方向上的灰度梯度值可以表示为:
S(u,v)=[I
x(p
x+u,p
y+v)I
y(p
x+u,p
y+v)]n
其中,p
x表示目标特征点在第一图像上的横坐标,p
y表示目标特征点在第一图像上的纵坐标,u和v表示矩阵像素窗口中的各个像素点的相对于目标特征点的位置坐标,n表示所述水平线的单位方向向量,可以用于指示该水平线的方向,如果矩阵像素窗口W长为w,高为h,则u的取值范围是从-w/2到w/2,v的取值范围是从-h/2到h/2,S(u,v)表示目标特征点在该水平线的方向上的灰度梯度值,将该灰度梯度值进行平方运算可以得到目标特征点在该水平线的方向上的空间梯度值,可以采用如下公式计算所述空间梯度值:
其中,m表示目标特征点在该水平线的方向上的空间梯度值。
可以通过如下公式计算第一图像和第二图像的图像偏差值:
其中,b表示图像偏差值,[I(p
x+u,p
y+v)-J(q
x,q
y)]为灰度偏差值,I(p
x+u,p
y+v)表示第一图像中的点(p
x+u,p
y+v)的灰度值,J(q
x,q
y)表示第二图像中的点(q
x,q
y)的灰度值,图像偏差值主要用于表示第一图像的目标特征点与第二图像的起始跟踪点的图像偏差信息,包括灰度偏差信息等。
上述实施例通过计算目标特征点在所述水平线的方向上的空间梯度值,以及目标特征点与起始跟踪点的图像偏差值,根据图像偏差值与空间梯度值的比值确定起始跟踪点在该水平线的方向上的位置偏差,进一步细化了对位置偏差进行计算的方式,全面考虑了目标特征点与起始跟踪点的图像偏差情况,在例如图像偏差值为零时,得到的起始跟踪点在所述水平线的方向上的位置偏差也为零,能够借助灰度偏差等信息进一步准确跟踪到目标特征点在第二图像中的位置。
在一个实施例中,根据目标特征点的灰度梯度值计算目标特征点在水平线的方向上的灰度梯度值的步骤可以包括:
根据目标特征点在第一图像的横向和纵向方向上的灰度梯度值,构建目标特征点的灰度梯度矩阵;获取所述水平线的单位方向向量;将灰度梯度矩阵与单位方向向量的乘积设为目标特征点在该水平线的方向上的灰度梯度值。
本实施例中,目标特征点在第一图像的横向方向上的灰度梯度值可以反映目标特征点在横向方向上的灰度变化趋势,纵向方向上的灰度梯度值可以反映目标特征点在纵向方向上的灰度变化趋势,目标特征点在第一图像的横向和纵向上的灰度梯度值可以基于目标特征点在第一图像中的灰度值进行计算,灰度梯度矩阵为同时携带了目标特征点在第一图像的横向方向上的灰度梯度值以及在纵向方向上的灰度梯度值的矩阵,所述水平线的单位方向向量可以基于该水平线在第二图像中对应的纵坐标进行确定,将灰度梯度矩阵与水平线的单位方向向量进行相乘可以得到目标特征点在第二图像上的该水平线的方向上的灰度梯度值,可以用于反映该目标特征点在水平线的方向上的灰度变化趋势。
具体来说,横向和纵向是指在第一图像中相互垂直的两坐标轴所在方向,可以在第一图像中建立X-Y直角坐标系,横向和纵向分别对应X轴和Y轴的方向。基于第一图像中的每一个像素点的灰度值I(x,y),可以计算该像素点在X轴方向上的灰度梯度值I
x(x,y),以及在Y轴的方向上的灰度梯度值I
y(x,y),可以把第一图像中像素点的灰度值分布看作二维离散函数,第一图像的各个像素点的灰度梯度值可以对应于该二维离散函数的导数,计算导数的方式有很多种,为了计算简便,可以采取如下公式对目标特征点在X轴和Y轴方向上的灰度梯度值进行计算:
I
x(x,y)=[I(x+1,y)-I(x-1,y)]/2
I
y(x,y)=[I(x,y+1)-I(x,y-1)]/2
其中,I(x+1,y)表示目标特征点在X轴方向上后一个像素点的灰度值、I(x-1,y)表示目标特征点在X轴方向上前像素点的灰度值,I(x,y+1)表示目标特征点在Y轴方向上后一个像素点的灰度值,I(x,y-1)表示目标特征点在Y轴方向上前一个像素点的灰度值,I
x(x,y)表示目标特征点在X轴方向的灰度梯度值,I
y(x,y)表示目标特征点在Y轴方向的灰度梯度值。
可以采用如下矩阵作为目标特征点的灰度梯度矩阵:
t(x,y)=[I
x(x,y) I
y(x,y)]
其中,t(x,y)表示目标特征点的灰度梯度矩阵,该矩阵包括目标特征点在X轴方向的灰度梯度值I
x(x,y)和Y轴方向上的灰度梯度值I
y(x,y)。
假设所述水平线的单位方向向量为n,则目标特征点在该水平线的方向上的灰度梯度值可以采用如下公式进行表达:
s(x,y)=[I
x(x,y) I
y(x,y)]n
其中,s(x,y)表示所述目标特征点在所述水平线的方向上的灰度梯度值。
上述实施例根据第一图像的目标特征点分别在横纵方向上的灰度值变化值以及水平线的单位方向向量获取目标特征点在该水平线的方向上的灰度梯度值,简化了计算目标特征点在所述水平线的方向上的灰度梯度值的步骤,准确反映目标特征点在该水平线的方向上的灰度变化值,有利于提高在第二图像中对目标特征点进行跟踪的准确性和效率。
在一个实施例中,还可以包括如下步骤:
步骤S401,在第一图像中创建以目标特征点为中心的矩形像素窗口。
本步骤可以在第一图像中以目标特征点为几何中心,生成一矩形像素窗口W,该矩形像素窗口W的长为w,高为h,该矩形像素窗口W中各个像素点的相对位置坐标取值范围为如横坐标u的取值范围可以从-w/2到w/2,纵坐标v的取值范围可以从-h/2到h/2。
步骤S402,获取矩形像素窗口内各个像素点的灰度值;根据灰度值计算目标特征点在矩形像素窗口的横向和纵向方向上的灰度梯度值。
此步骤中,目标特征点在该矩形像素窗口的横向方向的灰度梯度值可以表示为I
x(x,y),在纵向方向上的灰度梯度值可以表示为I
y(x,y),其中,对于该矩形像素窗口中的每一个像素点的灰度值I(x,y),为了计算简便,可以采取如下公式对目标特征点在该矩形像素窗口的X轴和Y轴方向上的灰度梯度值进行计算:
I
x(x,y)=[I(x+1,y)-I(x-1,y)]/2
I
y(x,y)=[I(x,y+1)-I(x,y-1)]/2
其中,I(x+1,y)表示目标特征点在X轴方向后一个像素点的灰度值、I(x-1,y)表示目标特征点在X轴方向前像素点的灰度值,I(x,y+1)表示目标特征点在Y轴方向上的后一个像素点的灰度值,I(x,y-1)表示目标特征点在Y轴方向上的前一个像素点的灰度值。
步骤S403,根据灰度梯度值计算目标特征点在矩形像素窗口中的空间梯度矩阵,计算空间梯度矩阵的特征值。
本步骤可以采用如下矩阵作为目标特征点的空间梯度矩阵:
其中,M(x,y)表示目标特征点在矩阵像素窗口W内的空间梯度矩阵,中间变量I
x(x,y)
2=I
x·I
x,I
y(x,y)
2=I
y·I
y和I
xy(x,y)=I
x·I
y,g(u,v)表示高斯加权函数,在空间梯度矩阵中采用高斯加权函数能够提高抵抗图像噪点的能力,高斯加权函数的表达式为:
然后可以求解出上述空间梯度矩阵M(x,y)的特征值λ
1和λ
2。
步骤S404,根据特征值确定目标特征点的类型。
本步骤主要是根据步骤S403求解得到的空间梯度矩阵M(x,y)的特征值λ
1和λ
2确定目标特征点的类型,该目标特征点的类型可以包括角点和/或边缘点等。
参考图4,图4为一个实施例中图像特征点的特征值示意图,图4中330a所指示的箭头表示λ
1增大的方向,330b所指示的箭头表示λ
2增大的方向,而330c表示的是平面区域,λ
1和λ
2均很小,330d和330f表示的都是边缘点所在区域,在330d所指示区域中λ
1远小于λ
2,在330f所指示区域中λ
2远小于λ
1,而330e所指示的区域为角点区域,λ
1和λ
2均较大,并且λ
1≈λ
2。根据该特征值可以确定目标特征点的类型。
如图5(a)至图5(c),图5(a)至图5(c)的图像均具有阴影区域350,图5(a)有第一特征点351,图5(a)有第二特征点352,图5(c)有第三特征点353,其中,第一特征点351在图5(a)的各个箭头所示方向上灰度值变化均不明显,即与图4中330c的平面区域对应,第二特征点352在图5(b)的箭头352a所示方向上灰度值变化不明显而在箭头352b所示方向上灰度值变化较为明显,可以与图4中的330d和330f的角点区域对应,第三特征点353在图5(c)的各个箭头所示方向上灰度值变化均较为明显,可以与图4中的330e的角点区域对应。
在传统方式中,一般会选取图像的角点作为关键点,因为技术人员通常会认为角点具有很好的特性:它不随图像大的变形而改变,也对于图像小的变形不敏感。然而,实际上在实际使用中,图像中能够提取的稳定的角点是十分有限的,如果作为关键点的角点过少,那能成功跟踪的角点就更少了,这样会极大地影响后续的工作。为了在图像中增加关键点的数目,可以将图像中的边缘点如直线边缘点也作为关键点,该方案具有在可提取的数目上的优势以增加第一图像关键点的数量,可以提高跟踪的稳定性和鲁棒性。
基于此,为了方便描述可以假设第一图像的各个像素点的空间梯度矩阵M(x,y)的特征值λ
1均小于λ
2,对于满足λ
2(x,y)大于α×Max(λ
2)和λ
1(x,y)小于β×Max(λ
1)条件的点(x,y),即可作为第一图像中的边缘点。其中,α和β为预先设定的阈值,一般的,0<α,β<1,Max(λ
1)表示第一图像中最大的λ
1值,Max(λ
2)表示第一图像中最大的λ
2值。可选的,可以设置一边缘点间最小距离d,对得到的多个所述边缘点进行筛选,获得第一图像的边缘点集。
在一个实施例中,提供了一种图像特征点的跟踪方法,参考图6,图6为另一个实施例中图像特征点的跟踪方法的流程示意图,该图像特征点的跟踪方法可以包括如下步骤:
步骤S601,对第一图像和第二图像分别建立图像金字塔。
本步骤主要是分别对第一图像I和第二图像J建立图像金字塔{I
L}
L=0...Lm和{J
L}
L=0...Lm,图像金字塔可以包括多层图像,L
m表示给定的金字塔层数,一般为3,如图7所示,图7为一个实施例中图像金字塔的示意图,图像金字塔化一般包括两个步骤:首先对第一图像进行一次低通滤波进行平滑,然后对第一图像的像素点在横纵两个方向上进行1/2抽样处理,从而得到一系列尺度缩小的图像。当L=0时,为第一图像的原图,又称底层图像,当向金字塔的上层移动时,尺寸和分辨率降低,伴随的细节就越少。可以从顶层开始对目标特征点进行跟踪,先获得一个粗糙的结果,然后将结果作为下一层的初始点再进行跟踪,不断迭代直到到达第0层即底层图像,作为一种由粗到细分析策略。
步骤S602,即步骤a、在所述第一图像的本层图像中确定目标特征点的位置。
其中,本层图像为图像金字塔中的本层图像,是指当前用于对目标特征点进行跟踪的图像层,假设当前在第3层对目标特征点进行跟踪则本层图像为第3层图像。
步骤S603,即步骤b、根据目标特征点的位置利用如上任一项实施例所述的图像特征点的跟踪方法对目标特征点进行跟踪,获取目标特征点在第二图像的本层图像中与目标特征点相匹配的匹配点。
在本步骤中,可以在矩阵像素窗口W中计算目标特征点在所述水平线的方向上的灰度梯度值:S(u,v)=[I
x(p
x+u,p
y+v) I
y(p
x+u,p
y+v)]n;
其中,u和v表示矩阵像素窗口W中的各个像素点的相对于目标特征点的位置坐标,如果矩阵像素窗口W长为w,高为h,则u的取值范围是从-w/2到w/2,v的取值范围是从-h/2到h/2,I
x(x,y)表示第一图像I
L在(x,y)位置的像素点在X轴方向的灰度梯度值,I
y(x,y)表示在Y轴方向上的灰度梯度值,n表示该水平线的单位方向向量,S(u,v)表示目标特征点在该水平线的方向上的灰度梯度值,并根据灰度梯度值计算目标特征点在第L层的空间梯度值
本步骤可以初始化位置迭代参数γ
0=[0 0]
T,用于在图像J
L中进行迭代处理。
步骤S604,c、将所述匹配点设置为第二图像的本层图像的下一层图像的起始跟踪点。
本步骤初始化在第二图像中的本层图像的下一层金字塔图像的跟踪偏移位置g
L-1=2(g
L+d
L)。
步骤S605,重复上述步骤a至c,直到得到的匹配点为第二图像的底层图像上的匹配点。
本步骤可以使L=L-1重复上述步骤a至c,直到得到的匹配点为第二图像的图像金字塔的底层图像上的匹配点,则目标特征点如边缘点u在第二图像J中的匹配点v的位置为v=u+g
0+d
0。
参考图8,图8为一个实施例中图像特征点的跟踪方法的效果对比图,图8示出了两种方法对图像特征点进行跟踪的效果图,纵坐标表示特征点的匹配率,横坐标为匹配时间,匹配率越高说明对图像特征点的跟踪效果越好,该图8表示了本申请实施例提供的图像特征点的跟踪方法与传统的基于绝对误差和模版匹配算法(SAD)时的在某个测试数据集上的匹配成功率,其中,图8中的实线表示本申请实施例提供的图像特征点的跟踪方法的数据曲线,图8中的虚线表示传统的基于绝对误差和模版匹配算法(SAD)的数据曲线,可以看出,本申请实施例提供的图像特征点的跟踪方法在匹配成功率上具有明显的优势,比传统的方法更简单,鲁棒性更强,能够极大地增加成功匹配的关键点数目,有利于为双目视觉系统提供更有效的数据支持,而且采用图像金字塔和上述任一项实施例的图像特征点的跟踪方法相结合的方式对图像的特征点进行跟踪,进一步提高了在不同图像之间对图像特征点进行跟踪的稳定性和鲁棒性。
在一个实施例中,提供了一种图像特征点的匹配方法,参考图9,图9为一个实施例中图像特征点的匹配方法的流程示意图,该图像特征点的匹配方法可以包括如下步骤:
步骤S701,根据如上任一项实施例所述的图像特征点的跟踪方法对目标特征点进行跟踪,在第二图像中获取与目标特征点相匹配的第一匹配点。
参考图10,图10为一个实施例中图像特征点的匹配关系示意图,采用如上任一项实施例所述的图像特征点的跟踪方法,可以实现对第一图像400a的目标特征点K进行跟踪,在第二图像400b中获取该目标特征点K相匹配的第一匹配点K1,这里所说的匹配是指初步匹配,而第一匹配点K1不一定是真正与目标特征点K匹配的点,这是因为在某些场景当中,目标特征点K所在位置的纹理可能会在第一图像400a和第二图像400b中重复出现,导致得到的第一匹配点K1并非为与目标特征点K真正匹配的点,而这些并非真正匹配的点是不稳定的,匹配结果是可靠的。
步骤S702,基于如上任一项实施例所述的图像特征点的跟踪方法在第一图像中获取与第一匹配点相匹配的第二匹配点。
本步骤主要是以第一匹配点作为新的目标特征点,以反向的方式,通过如上任一项实施例所述的图像特征点的跟踪方法,在第一图像中400a中找到与该第一匹配点相匹配的第二匹配点。
具体来说,如图10,在得到第一匹配点K1后,以第一匹配点K1作为新的目标特征点,以第二图像400b作为新的第一图像,以第一图像400a作为新的第二图像,采用如上任一项实施例所述的图像特征点的跟踪方法,在第一图像400a中获取与第一匹配点K1相匹配的第二匹配点K2。
步骤S703,若第二匹配点与目标特征点为相同的点,则判断第一匹配点与目标特征点相匹配。
本步骤中,将第二匹配点与目标特征点进行比较,若判断第二匹配点与目标特征点属于第一图像中的同一个点,则可以认为第一匹配点是第二图像中的与目标特征点真正匹配的点,如果第二匹配点与目标特征点不是同一个点,则说明目标特征点K的纹理所在场景不唯一,可以去掉该特征点。
上述实施例,先通过如上任一项实施例所述的图像特征点的跟踪方法得到与目标特征点初步匹配的第一匹配点,再以相同的跟踪方法在第一图像中反向获取与该第一匹配点相匹配的第二匹配点,从而将原来的目标特征点和第二匹配点进行比较,判断第一匹配点是否为与目标特征点真正匹配的点,进一步提高了对特征点进行跟踪匹配的鲁棒性和稳定性。
在一个实施例中,提供了一种获取目标物三维坐标的方法,参考图11,图11为一个实施例中获取目标物三维坐标的方法的流程示意图,该方法可以包括如下步骤:
步骤S801,获取对目标物拍摄得到的第一视角图像和第二视角图像;该目标物为三维空间中的物体。
本步骤中,可以采用双目摄像头在第一视角和第二视角对三维空间中的目标物进行拍摄,得到第一视角图像和第二视角图像。
步骤S802,对第一视角图像和第二视角图像进行校正得到第一图像和第二图像。
本步骤主要是对第一视角图像和第二视角图像进行校正处理,消除第一视角图像和第二视角图像的图像畸变,将两张图像进行对齐,使得两张图像在水平方向上严格对齐,从而得到的第一图像和第二图像就是消除畸变的并且在水平方向上对齐的图像。
步骤S803,将目标物在第一图像上投影的点设为目标特征点。
三维空间中的目标物被拍摄为图像后,目标物上的三维点会投影为图像上的二维点,本步骤可以将目标物在第一图像上投影的多个二维像素点设为目标特征点,然后通过计算这些像素点的二维坐标反推出目标物的三维坐标。
步骤S804,根据如上任一项实施例所述的图像特征点的跟踪方法或图像特征点的匹配方法,在第二图像中确定与第一图像的目标特征点相匹配的匹配点。
本步骤主要是基于如上任一项实施例所述的图像特征点的跟踪方法或图像特征点的匹配方法,在第二图像中跟踪得到与目标特征点相匹配的匹配点。
步骤S805,获取目标特征点在第一图像中的二维坐标,获取匹配点在第二图像中的二维坐标。
其中,在对目标特征点进行跟踪得到匹配点后,可以获取该匹配点在第二图像中的二维坐标,以及获取目标特征点在第一图像中的二维坐标。
步骤S806,获取第一图像的第一投影矩阵,获取第二图像的第二投影矩阵。
本步骤主要是分别获取第一图像和第二图像的投影矩阵。其中,在利用如双目摄像头等摄像设备对三维空间中的目标物进行拍摄时,该目标物会投影到拍摄的照片上,而对拍摄的双目摄像头进行标定后,可以得到相应的投影矩阵,通过该投影矩阵可以确定三维目标物与二维图像的位置投影关系。
步骤S807,根据目标特征点在第一图像中的二维坐标、匹配点在第二图像中的二维坐标、第一投影矩阵和第二投影矩阵获取目标物在三维空间中的三维坐标。
其中,根据第一投影矩阵和第二投影矩阵可以确定拍摄的三维空间中的目标物与第一图像和第二图像的位置关系,所以本步骤可以根据目标特征点在第一图像中的二维坐标、匹配点在第二图像中的二维坐标结合第一投影矩阵和第二投影矩阵,从而计算出目标物在三维空间中的三维坐标。
可以对矩阵D进行奇异值分解,得到奇异值分解结果;该矩阵D可以表示为:
其中,U和V分别表示目标特征点在第一图像中的横坐标和纵坐标,U′和V′分别表示匹配点在第二图像中的横坐标和纵坐标,(P
1)
T、(P
2)
T和(P
3)
T分别对应于第一投影矩阵中的第一行、第二行和第三行,(P
1′)
T、(P
2′)
T和(P
3′)
T分别对应于第二投影矩阵中的第一行、第二行和第三行;然后,根据奇异值分解结果可以获取目标物在三维空间中的三维坐标。
以双目摄像系统为例进行说明,在对双目摄像头经过校正后,可以得到左摄像头和右摄像头拍摄图像的投影矩阵,设左摄像头对应的投影矩阵为第一投影矩阵P,右摄像头对应的投影矩阵为第二投影矩阵P′,利用第一投影矩阵和第二投影矩阵,有x=PX,x′=P′X,X表示目标特征点在空间中的三维坐标,x表示目标特征点在第一图像中的二维坐标,x′表示目标特征点在第二图像中的二维坐标,通过投影矩阵,可以将三维空间中的三维点投影到左摄像头和右摄像头的图像中,获得在图像上的二维坐标x和x′,而第一投影矩阵P和第二投影矩阵P′可以分别表示为:
其中,(P
i)
T表示第一投影矩阵P中的第i行,同样地,(P
i′)
T表示第一投影矩阵P′中的第i行,i可以取1、2或3。
在给定左摄像头拍摄的第一图像上的其中一个特征点二维坐标x=[U,V]
T和右摄像头拍摄的第二图像上的与该特征点相匹配的匹配点的二维坐标x′=[U′,V′]
T,联立公式x=PX和x′=P′X并写成DX=0,其中,矩阵D即为:
对该矩阵D进行奇异值分解,有D=U∑V
T,则DX=0的解X为右奇异矩阵V
T的最后一列,X即为最终所求的目标特征点在三维空间中的三维坐标,而由于该目标特征点是目标物在图像上投影的二维像素点,所以该目标特征点对应的三维坐标可以作为该目标物的三维坐标。
上述获取目标物三维坐标的方法,采用本申请实施例提供图像特征点的跟踪方法或匹配方法对目标特征点进行跟踪,并获取目标特征点及其匹配点的在第一图像和第二图像中的二维坐标,基于第一图像和第二图像的投影矩阵,从而更精确地获取目标物在三维空间中的三维坐标,而且还具有运算速度快、鲁棒性好等特点。
在一个实施例中,提供了一种图像特征点的跟踪装置,参考图12,图12为一个实施例中图像特征点的跟踪装置的结构示意图,该图像特征点的跟踪装置可以包括:
水平线确定模块101,用于在第二图像中确定与目标特征点相对应的水平线;其中,所述目标特征点为第一图像的特征点;所述第一图像和第二图像是对第一视角图像和第二视角图像进行校正后得到的图像;
第一获取模块102,用于获取位于所述水平线上的起始跟踪点的第一灰度值;
第二获取模块103,用于获取所述目标特征点的第二灰度值和灰度梯度值;
特征点跟踪模块104,用于根据所述起始跟踪点的第一灰度值以及所述目标特征点的第二灰度值和灰度梯度值,沿所述水平线的方向跟踪匹配点在所述第二图像中的位置;所述匹配点为所述第二图像上与所述目标特征点相匹配的点。
在一个实施例中,水平线确定模块101还用于:
获取目标特征点在第一图像中的位置;确定第一图像与第二图像的水平线对应关系;根据目标特征点在第一图像中的位置和水平线对应关系确定第二图像中的所述水平线。
在一个实施例中,特征点跟踪模块104可以包括:
位置偏差计算单元,用于根据第一图像的目标特征点的第二灰度值、灰度梯度值以及起始跟踪点的第一灰度值计算起始跟踪点在水平线的方向上的位置偏差;
起始跟踪点位置确定单元,用于确定起始跟踪点在水平线上的位置;
目标特征点位置确定单元,用于根据起始跟踪点在水平线上的位置以及在水平线的方向上的位置偏差确定匹配点在第二图像中的位置;
在一个实施例中,位置偏差计算单元还用于:
将目标特征点的第二灰度值与起始跟踪点的第一灰度值进行作差,得到目标特征点与起始跟踪点的灰度偏差值;根据目标特征点的灰度梯度值计算目标特征点在水平线的方向上的灰度梯度值;根据灰度偏差值和目标特征点在水平线的方向上的灰度梯度值获取起始跟踪点在水平线的方向上的位置偏差。
在一个实施例中,位置偏差计算单元还还用于:
将目标特征点在水平线的方向上的灰度梯度值进行平方运算,得到目标特征点在水平线的方向上的空 间梯度值;根据目标特征点在水平线的方向上的灰度梯度值与灰度偏差值的乘积获取图像偏差值;计算图像偏差值与目标特征点在水平线的方向上的空间梯度值的比值;根据该比值和水平线的单位方向向量确定起始跟踪点在所述水平线的方向上的位置偏差。
在一个实施例中,位置偏差计算单元还还用于:
根据目标特征点在第一图像的横向和纵向方向上的灰度梯度值,构建目标特征点的灰度梯度矩阵;获取所述水平线的单位方向向量;将灰度梯度矩阵与单位方向向量的乘积设为目标特征点在该水平线的方向上的灰度梯度值。
在一个实施例中,还可以包括:
窗口创建单元,用于在第一图像中创建以目标特征点为中心的矩形像素窗口;
灰度梯度值计算单元,用于获取矩形像素窗口内各个像素点的灰度值;根据灰度值计算目标特征点在矩形像素窗口的横向和纵向方向上的灰度梯度值;
特征值计算单元,用于根据灰度梯度值计算目标特征点在矩形像素窗口中的空间梯度矩阵,计算空间梯度矩阵的特征值。
特征点类型确定单元,用于根据特征值确定目标特征点的类型。
在一个实施例中,还可以包括:
图像校正单元,用于消除第一视角图像和第二视角图像的图像畸变;将消除图像畸变后的第一视角图像和第二视角图像进行对齐,得到第一图像和第二图像。
在一个实施例中,还提供了一种图像特征点的跟踪装置,参考图13,图13为另一个实施例中图像特征点的跟踪装置的结构示意图,该图像特征点的跟踪装置可以包括:
图像金字塔建立模块601,用于对第一图像和第二图像分别建立图像金字塔;其中,图像金字塔包括多层图像;
特征点位置确定模块602,用于执行步骤a、在第一图像的本层图像中确定目标特征点的位置;其中,本层图像为图像金字塔中的本层图像;
跟踪点获取模块603,用于执行步骤b、根据目标特征点的位置利用上述图像特征点的跟踪方法对目标特征点进行跟踪,获取目标特征点在第二图像的本层图像中与目标特征点相匹配的匹配点;
跟踪点设置模块604,用于执行步骤c、将匹配点设置为第二图像的本层图像的下一层图像的起始跟踪点;
跟踪点确定模块605,用于重复上述步骤a至c,直到匹配点为第二图像的底层图像上的匹配点。
本申请的图像特征点的跟踪装置与本申请的图像特征点的跟踪方法一一对应,关于图像特征点的跟踪装置的具体限定可以参见上文中对于图像特征点的跟踪方法的限定,在上述图像特征点的跟踪方法的实施例阐述的技术特征及其有益效果均适用于图像特征点的跟踪装置的实施例中,在此不再赘述。上述图像特征点的跟踪装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种图像特征点的匹配装置,参考图14,图14为一个实施例中图像特征点的匹配装置的结构示意图,该图像特征点的匹配装置可以包括:
第一匹配点获取模块701,用于根据上述图像特征点的跟踪方法对目标特征点进行跟踪,在第二图像中获取与目标特征点相匹配的第一匹配点;
第二匹配点获取模块702,用于基于上述图像特征点的跟踪方法在第一图像中获取与第一匹配点相匹 配的第二匹配点;
匹配点判断模块703,用于若第二匹配点与目标特征点为相同的点,则判断第一匹配点与目标特征点相匹配。
本申请的图像特征点的匹配装置与本申请的图像特征点的匹配方法一一对应,关于图像特征点的匹配装置的具体限定可以参见上文中对于图像特征点的匹配方法的限定,在上述图像特征点的匹配方法的实施例阐述的技术特征及其有益效果均适用于图像特征点的匹配装置的实施例中,在此不再赘述。上述图像特征点的匹配装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种获取目标物三维坐标的装置,参考图15,图15为一个实施例中获取目标物三维坐标的装置的结构示意图,该装置可以包括:
视角图像获取模块801,用于获取对目标物拍摄得到的第一视角图像和第二视角图像;目标物为三维空间中的物体;
视角图像校正模块802,用于对第一视角图像和第二视角图像进行校正得到第一图像和第二图像;
特征点设置模块803,用于将目标物在第一图像上投影的点设为目标特征点;
匹配点确定模块804,用于根据上述图像特征点的跟踪方法或图像特征点的匹配方法,在第二图像中确定与第一图像的目标特征点相匹配的匹配点;
二维坐标获取模块805,用于获取目标特征点在第一图像中的二维坐标,获取匹配点在第二图像中的二维坐标;
投影矩阵获取模块806,用于获取第一图像的第一投影矩阵,获取第二图像的第二投影矩阵;
三维坐标计算模块807,用于根据目标特征点在第一图像中的二维坐标、匹配点在第二图像中的二维坐标、第一投影矩阵和第二投影矩阵计算目标物在三维空间中的三维坐标。
在一个实施例中,三维坐标计算模块807还用于:
对如下矩阵D进行奇异值分解:
其中,U和V分别表示目标特征点在第一图像中的横坐标和纵坐标,U′和V′分别表示匹配点在第二图像中的横坐标和纵坐标,(P
1)
T、(P
2)
T和(P
3)
T分别对应于第一投影矩阵中的第一行、第二行和第三行,(P
1′)
T、(P
2′)
T和(P
3′)
T分别对应于第二投影矩阵中的第一行、第二行和第三行;根据奇异值分解结果获取目标物在三维空间中的三维坐标。
本申请的获取目标物三维坐标的装置与本申请的获取目标物三维坐标的方法一一对应,关于获取目标 物三维坐标的装置的具体限定可以参见上文中对于获取目标物三维坐标的方法的限定,在上述获取目标物三维坐标的方法的实施例阐述的技术特征及其有益效果均适用于获取目标物三维坐标的装置的实施例中,在此不再赘述。上述获取目标物三维坐标的装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是终端,其内部结构图可以如图16所示,图16为一个实施例中计算机设备的内部结构图。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口、显示屏和输入装置。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种图像特征点的跟踪方法、图像特征点的匹配方法和获取目标物三维坐标的方法。该计算机设备的显示屏可以是液晶显示屏或者电子墨水显示屏,该计算机设备的输入装置可以是显示屏上覆盖的触摸层,也可以是计算机设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。
本领域技术人员可以理解,图16中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,提供了一种计算机设备,包括处理器和存储器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:
在第二图像中确定与目标特征点相对应的水平线;获取位于该水平线上的起始跟踪点的第一灰度值;获取目标特征点的第二灰度值和灰度梯度值;根据起始跟踪点的第一灰度值以及目标特征点的第二灰度值和灰度梯度值,沿该水平线的方向跟踪匹配点在第二图像中的位置;该匹配点为第二图像上与目标特征点相匹配的点。
在一个实施例中,处理器执行计算机程序时还实现以下步骤:
获取目标特征点在第一图像中的位置;确定第一图像与第二图像的水平线对应关系;根据目标特征点在第一图像中的位置和水平线对应关系确定第二图像中的所述水平线。
在一个实施例中,处理器执行计算机程序时还实现以下步骤:
根据第一图像的目标特征点的第二灰度值、灰度梯度值以及起始跟踪点的第一灰度值计算起始跟踪点在水平线的方向上的位置偏差;确定起始跟踪点在水平线上的位置;根据起始跟踪点在水平线上的位置以及在水平线的方向上的位置偏差确定匹配点在第二图像中的位置。
在一个实施例中,处理器执行计算机程序时还实现以下步骤:
将目标特征点的第二灰度值与起始跟踪点的第一灰度值进行作差,得到目标特征点与起始跟踪点的灰度偏差值;根据目标特征点的灰度梯度值计算目标特征点在水平线的方向上的灰度梯度值;根据灰度偏差值和目标特征点在水平线的方向上的灰度梯度值获取起始跟踪点在水平线的方向上的位置偏差。
在一个实施例中,处理器执行计算机程序时还实现以下步骤:
将目标特征点在水平线的方向上的灰度梯度值进行平方运算,得到目标特征点在水平线的方向上的空间梯度值;根据目标特征点在水平线的方向上的灰度梯度值与灰度偏差值的乘积获取图像偏差值;计算图像偏差值与目标特征点在水平线的方向上的空间梯度值的比值;根据该比值和水平线的单位方向向量确定起始跟踪点在所述水平线的方向上的位置偏差。
在一个实施例中,处理器执行计算机程序时还实现以下步骤:
根据目标特征点在第一图像的横向和纵向方向上的灰度梯度值,构建目标特征点的灰度梯度矩阵;获取所述水平线的单位方向向量;将灰度梯度矩阵与单位方向向量的乘积设为目标特征点在该水平线的方向上的灰度梯度值。
在一个实施例中,处理器执行计算机程序时还实现以下步骤:
在第一图像中创建以目标特征点为中心的矩形像素窗口;获取矩形像素窗口内各个像素点的灰度值;根据灰度值计算目标特征点在矩形像素窗口的横向和纵向方向上的灰度梯度值;根据灰度梯度值计算目标特征点在矩形像素窗口中的空间梯度矩阵,计算空间梯度矩阵的特征值;根据特征值确定目标特征点的类型。
在一个实施例中,处理器执行计算机程序时还实现以下步骤:
消除第一视角图像和第二视角图像的图像畸变;将消除图像畸变后的第一视角图像和第二视角图像进行对齐,得到第一图像和第二图像。
在一个实施例中,提供了一种计算机设备,包括处理器和存储器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:
对第一图像和第二图像分别建立图像金字塔;a、在所述第一图像的本层图像中确定目标特征点的位置;b、根据目标特征点的位置利用如上任一项实施例所述的图像特征点的跟踪方法对目标特征点进行跟踪,获取目标特征点在第二图像的本层图像中与目标特征点相匹配的匹配点;c、将所述匹配点设置为第二图像的本层图像的下一层图像的起始跟踪点;重复上述步骤a至c,直到得到的匹配点为第二图像的底层图像上的匹配点。
在一个实施例中,提供了一种计算机设备,包括处理器和存储器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:
根据如上任一项实施例所述的图像特征点的跟踪方法对目标特征点进行跟踪,在第二图像中获取与目标特征点相匹配的第一匹配点;基于如上任一项实施例所述的图像特征点的跟踪方法在第一图像中获取与第一匹配点相匹配的第二匹配点;若第二匹配点与目标特征点为相同的点,则判断第一匹配点与目标特征点相匹配。
在一个实施例中,提供了一种计算机设备,包括处理器和存储器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:
获取对目标物拍摄得到的第一视角图像和第二视角图像;目标物为三维空间中的物体;对第一视角图像和第二视角图像进行校正得到第一图像和第二图像;将目标物在第一图像上投影的点设为目标特征点;根据如上任一项实施例所述的图像特征点的跟踪方法或图像特征点的匹配方法,在第二图像中确定与第一图像的目标特征点相匹配的匹配点;获取目标特征点在第一图像中的二维坐标,获取匹配点在第二图像中的二维坐标;获取第一图像的第一投影矩阵,获取第二图像的第二投影矩阵;根据目标特征点在第一图像中的二维坐标、匹配点在第二图像中的二维坐标、第一投影矩阵和第二投影矩阵获取目标物在三维空间中的三维坐标。
在一个实施例中,处理器执行计算机程序时还实现以下步骤:
对如下矩阵D进行奇异值分解:
其中,U和V分别表示目标特征点在所述第一图像中的横坐标和纵坐标,U′和V′分别表示匹配点在所述第二图像中的横坐标和纵坐标,(P
1)
T、(P
2)
T和(P
3)
T分别对应于所述第一投影矩阵中的第一行、第二行和第三行,(P
1′)
T、(P
2′)
T和(P
3′)
T分别对应于所述第二投影矩阵中的第一行、第二行和第三行;根据奇异值分解结果获取目标物在三维空间中的三维坐标。
上述计算机设备,通过所述处理器上运行的计算机程序,能够增加对目标特征点成功跟踪匹配的特征点数目,提高了对目标特征点进行跟踪的鲁棒性和稳定性,还将特征点的跟踪范围限缩至第二图像的一水平线上,使得特征点的跟踪操作得到简化,加快了运算速度,在保证稳定性的前提下,缩短了对目标特征点进行跟踪的时间,提高了跟踪效率,有利于为双目视觉系统提供更有效的数据支持。
本领域普通技术人员可以理解实现如上任一项实施例所述的图像特征点的跟踪方法、图像特征点的匹配方法和获取目标物三维坐标的方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
据此,在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:
在第二图像中确定与目标特征点相对应的水平线;获取位于该水平线上的起始跟踪点的第一灰度值;获取目标特征点的第二灰度值和灰度梯度值;根据起始跟踪点的第一灰度值以及目标特征点的第二灰度值和灰度梯度值,沿该水平线的方向匹配点在第二图像中的位置;该匹配点为第二图像上与目标特征点相匹配的点。
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:
获取目标特征点在第一图像中的位置;确定第一图像与第二图像的水平线对应关系;根据目标特征点在第一图像中的位置和水平线对应关系确定第二图像中的所述水平线。
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:
根据第一图像的目标特征点的第二灰度值、灰度梯度值以及起始跟踪点的第一灰度值计算起始跟踪点 在水平线的方向上的位置偏差;确定起始跟踪点在水平线上的位置;根据起始跟踪点在水平线上的位置以及在水平线的方向上的位置偏差确定匹配点在第二图像中的位置。
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:
将目标特征点的第二灰度值与起始跟踪点的第一灰度值进行作差,得到目标特征点与起始跟踪点的灰度偏差值;根据目标特征点的灰度梯度值计算目标特征点在水平线的方向上的灰度梯度值;根据灰度偏差值和目标特征点在水平线的方向上的灰度梯度值获取起始跟踪点在水平线的方向上的位置偏差。
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:
将目标特征点在水平线的方向上的灰度梯度值进行平方运算,得到目标特征点在水平线的方向上的空间梯度值;根据目标特征点在水平线的方向上的灰度梯度值与灰度偏差值的乘积获取图像偏差值;计算图像偏差值与目标特征点在水平线的方向上的空间梯度值的比值;根据该比值和水平线的单位方向向量确定起始跟踪点在所述水平线的方向上的位置偏差。
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:
根据目标特征点在第一图像的横向和纵向方向上的灰度梯度值,构建目标特征点的灰度梯度矩阵;获取所述水平线的单位方向向量;将灰度梯度矩阵与单位方向向量的乘积设为目标特征点在该水平线的方向上的灰度梯度值。
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:
在第一图像中创建以目标特征点为中心的矩形像素窗口;获取矩形像素窗口内各个像素点的灰度值;根据灰度值计算目标特征点在矩形像素窗口的横向和纵向方向上的灰度梯度值;根据灰度梯度值计算目标特征点在矩形像素窗口中的空间梯度矩阵,计算空间梯度矩阵的特征值;根据特征值确定目标特征点的类型。
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:
消除第一视角图像和第二视角图像的图像畸变;将消除图像畸变后的第一视角图像和第二视角图像进行对齐,得到第一图像和第二图像。
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:
对第一图像和第二图像分别建立图像金字塔;a、在所述第一图像的本层图像中确定目标特征点的位置;b、根据目标特征点的位置利用如上任一项实施例所述的图像特征点的跟踪方法对目标特征点进行跟踪,获取目标特征点在第二图像的本层图像中与目标特征点相匹配的跟踪点;c、将所述跟踪点设置为第二图像的本层图像的下一层图像的所述起始跟踪点;重复上述步骤a至c,直到得到的跟踪点为第二图像的底层图像的跟踪点。
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:
根据如上任一项实施例所述的图像特征点的跟踪方法对目标特征点进行跟踪,在第二图像中获取与目标特征点相匹配的第一匹配点;基于如上任一项实施例所述的图像特征点的跟踪方法在第一图像中获取与第一匹配点相匹配的第二匹配点;若第二匹配点与目标特征点为相同的点,则判断第一匹配点与目标特征点相匹配。
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:
获取对目标物拍摄得到的第一视角图像和第二视角图像;目标物为三维空间中的物体;对第一视角图 像和第二视角图像进行校正得到第一图像和第二图像;将目标物在第一图像上投影的点设为目标特征点;根据如上任一项实施例所述的图像特征点的跟踪方法或图像特征点的匹配方法,在第二图像中确定与第一图像的目标特征点相匹配的匹配点;获取目标特征点在第一图像中的二维坐标,获取匹配点在第二图像中的二维坐标;获取第一图像的第一投影矩阵,获取第二图像的第二投影矩阵;根据目标特征点在第一图像中的二维坐标、匹配点在第二图像中的二维坐标、第一投影矩阵和第二投影矩阵获取目标物在三维空间中的三维坐标。
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:
对如下矩阵D进行奇异值分解:
其中,U和V分别表示目标特征点在第一图像中的横坐标和纵坐标,U′和V′分别表示匹配点在第二图像中的横坐标和纵坐标,(P
1)
T、(P
2)
T和(P
3)
T分别对应于第一投影矩阵中的第一行、第二行和第三行,(P
1′)
T、(P
2′)
T和(P
3′)
T分别对应于第二投影矩阵中的第一行、第二行和第三行;根据奇异值分解结果获取目标物在三维空间中的三维坐标。
上述计算机可读存储介质,通过其存储的计算机程序,能够增加对目标特征点成功跟踪匹配的特征点数目,提高了对目标特征点进行跟踪的鲁棒性和稳定性,还将特征点的跟踪范围限缩至第二图像的一水平线上,使得特征点的跟踪操作得到简化,加快了运算速度,在保证稳定性的前提下,缩短了对目标特征点进行跟踪的时间,提高了跟踪效率,有利于为双目视觉系统提供更有效的数据支持。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
Claims (18)
- 一种图像特征点的跟踪方法,包括步骤:在第二图像中确定与目标特征点相对应的水平线;其中,所述目标特征点为第一图像的特征点;所述第一图像和第二图像是对第一视角图像和第二视角图像进行校正后得到的图像;获取位于所述水平线上的起始跟踪点的第一灰度值;获取所述目标特征点的第二灰度值和灰度梯度值;根据所述起始跟踪点的第一灰度值以及所述目标特征点的第二灰度值和灰度梯度值,沿所述水平线的方向跟踪匹配点在所述第二图像中的位置;所述匹配点为所述第二图像上与所述目标特征点相匹配的点。
- 根据权利要求1所述的图像特征点的跟踪方法,其中,所述根据所述起始跟踪点的第一灰度值以及所述目标特征点的第二灰度值和灰度梯度值,沿所述水平线的方向跟踪匹配点在所述第二图像中的位置的步骤包括:根据所述第一图像的目标特征点的第二灰度值、灰度梯度值以及所述起始跟踪点的第一灰度值计算所述起始跟踪点在所述水平线的方向上的位置偏差;确定所述起始跟踪点在所述水平线上的位置;根据所述起始跟踪点在所述水平线上的位置以及在所述水平线的方向上的位置偏差确定所述匹配点在所述第二图像中的位置。
- 根据权利要求2所述的图像特征点的跟踪方法,其中,所述根据所述第一图像的目标特征点的第二灰度值、灰度梯度值以及所述起始跟踪点的第一灰度值计算所述起始跟踪点在所述水平线的方向上的位置偏差的步骤包括:将所述目标特征点的第二灰度值与起始跟踪点的第一灰度值进行作差,得到所述目标特征点与起始跟踪点的灰度偏差值;根据所述目标特征点的灰度梯度值计算所述目标特征点在所述水平线的方向上的灰度梯度值;根据所述灰度偏差值和所述目标特征点在所述水平线的方向上的灰度梯度值获取所述起始跟踪点在所述水平线的方向上的位置偏差。
- 根据权利要求3所述的图像特征点的跟踪方法,其中,所述根据所述灰度偏差值和所述目标特征点在所述水平线的方向上的灰度梯度值获取所述起始跟踪点在所述水平线的方向上的位置偏差的步骤包括:将所述目标特征点在所述水平线的方向上的灰度梯度值进行平方运算,得到所述目标特征点在所述水平线的方向上的空间梯度值;根据所述目标特征点在所述水平线的方向上的灰度梯度值与所述灰度偏差值的乘积获取图像偏差值;计算所述图像偏差值与所述目标特征点在所述水平线的方向上的空间梯度值的比值;根据所述比值与所述水平线的单位方向向量确定所述起始跟踪点在所述水平线的方向上的位置偏差。
- 根据权利要求3所述的图像特征点的跟踪方法,其中,所述根据所述目标特征点的灰度梯度值计算所述目标特征点在所述水平线的方向上的灰度梯度值的步骤包括:根据所述目标特征点在所述第一图像的横向和纵向方向上的灰度梯度值,构建所述目标特征点的灰度梯度矩阵;获取所述水平线的单位方向向量;将所述灰度梯度矩阵与所述单位方向向量的乘积设为所述目标特征点在所述水平线的方向上的灰度梯度值。
- 根据权利要求1所述的图像特征点的跟踪方法,其中,所述在第二图像中确定与目标特征点相对 应的水平线的步骤包括:获取所述目标特征点在所述第一图像中的位置;确定所述第一图像与第二图像的水平线对应关系;根据所述目标特征点在所述第一图像中的位置和水平线对应关系确定所述第二图像中的所述水平线。
- 根据权利要求1至6任一项所述的图像特征点的跟踪方法,还包括步骤:在所述第一图像中创建以所述目标特征点为中心的矩形像素窗口;获取所述矩形像素窗口内各个像素点的灰度值;根据所述灰度值计算所述目标特征点在所述矩形像素窗口的横向和纵向方向上的灰度梯度值;根据所述灰度梯度值计算所述目标特征点在所述矩形像素窗口中的空间梯度矩阵,计算所述空间梯度矩阵的特征值;根据所述特征值确定所述目标特征点的类型;其中,所述目标特征点的类型包括角点和/或边缘点。
- 根据权利要求1所述的图像特征点的跟踪方法,其中,在所述在第二图像中确定与目标特征点相对应的水平线的步骤之前,还包括:消除所述第一视角图像和第二视角图像的图像畸变;将消除图像畸变后的第一视角图像和第二视角图像进行对齐,得到所述第一图像和第二图像。
- 一种图像特征点的跟踪方法,包括步骤:对第一图像和第二图像分别建立图像金字塔;其中,所述图像金字塔包括多层图像;a、在所述第一图像的本层图像中确定目标特征点的位置;其中,所述本层图像为图像金字塔中的本层图像;b、根据所述目标特征点的位置利用如权利要求1至8任一项所述的图像特征点的跟踪方法对所述目标特征点进行跟踪,获取所述目标特征点在所述第二图像的本层图像中与所述目标特征点相匹配的匹配点;c、将所述匹配点设置为所述第二图像的本层图像的下一层图像的起始跟踪点;重复上述步骤a至c,直到所述匹配点为所述第二图像的底层图像上的匹配点。
- 一种图像特征点的匹配方法,包括步骤:根据权利要求1至9任一项所述的图像特征点的跟踪方法对目标特征点进行跟踪,在所述第二图像中获取与所述目标特征点相匹配的第一匹配点;基于权利要求1至9任一项所述的图像特征点的跟踪方法在所述第一图像中获取与所述第一匹配点相匹配的第二匹配点;若所述第二匹配点与目标特征点为相同的点,则判断所述第一匹配点与所述目标特征点相匹配。
- 一种获取目标物三维坐标的方法,包括步骤:获取对目标物拍摄得到的第一视角图像和第二视角图像;所述目标物为三维空间中的物体;对所述第一视角图像和第二视角图像进行校正得到第一图像和第二图像;将所述目标物在所述第一图像上投影的点设为目标特征点;根据权利要求1至10任一项所述的图像特征点的跟踪方法或图像特征点的匹配方法,在所述第二图像中确定与第一图像的目标特征点相匹配的匹配点;获取所述目标特征点在所述第一图像中的二维坐标,获取所述匹配点在第二图像中的二维坐标;获取所述第一图像的第一投影矩阵,获取所述第二图像的第二投影矩阵;根据所述目标特征点在所述第一图像中的二维坐标、匹配点在第二图像中的二维坐标、第一投影矩阵和第二投影矩阵获取所述目标物在三维空间中的三维坐标。
- 根据权利要求11所述的获取目标物三维坐标的方法,其中,所述根据所述目标特征点在所述第一图像中的二维坐标、匹配点在第二图像中的二维坐标、第一投影矩阵和第二投影矩阵获取所述目标物在三维空间中的三维坐标的步骤包括:对如下矩阵D进行奇异值分解:其中,U和V分别表示目标特征点在所述第一图像中的横坐标和纵坐标,U′和V′分别表示匹配点在所述第二图像中的横坐标和纵坐标,(P 1) T、(P 2) T和(P 3) T分别对应于所述第一投影矩阵中的第一行、第二行和第三行,(P 1′) T、(P 2′) T和(P 3′) T分别对应于所述第二投影矩阵中的第一行、第二行和第三行;根据奇异值分解结果获取所述目标物在三维空间中的三维坐标。
- 一种图像特征点的跟踪装置,包括:水平线确定模块,用于在第二图像中确定与目标特征点相对应的水平线;其中,所述目标特征点为第一图像的特征点;所述第一图像和第二图像是对第一视角图像和第二视角图像进行校正后得到的图像;第一获取模块,用于获取位于所述水平线上的起始跟踪点的第一灰度值;第二获取模块,用于获取所述目标特征点的第二灰度值和灰度梯度值;特征点跟踪模块,用于根据所述起始跟踪点的第一灰度值以及所述目标特征点的第二灰度值和灰度梯度值,沿所述水平线的方向跟踪匹配点在所述第二图像中的位置;所述匹配点为所述第二图像上与所述目标特征点相匹配的点。
- 一种图像特征点的跟踪装置,包括:图像金字塔建立模块,用于对第一图像和第二图像分别建立图像金字塔;其中,所述图像金字塔包括多层图像;特征点位置确定模块,用于执行步骤a、在所述第一图像的本层图像中确定所述目标特征点的位置;其中,所述本层图像为图像金字塔中的本层图像;跟踪点获取模块,用于执行步骤b、根据所述目标特征点的位置利用如权利要求1至8任一项所述的图像特征点的跟踪方法对所述目标特征点进行跟踪,获取所述目标特征点在所述第二图像的本层图像中与所述目标特征点相匹配的匹配点;跟踪点设置模块,用于执行步骤c、将所述匹配点设置为所述第二图像的本层图像的下一层图像的起始跟踪点;跟踪点确定模块,用于重复上述步骤a至c,直到所述匹配点为所述第二图像的底层图像上的匹配点。
- 一种图像特征点的匹配装置,包括:第一匹配点获取模块,用于根据权利要求1至9任一项所述的图像特征点的跟踪方法对目标特征点进行跟踪,在所述第二图像中获取与所述目标特征点相匹配的第一匹配点;第二匹配点获取模块,用于基于权利要求1至9任一项所述的图像特征点的跟踪方法在所述第一图像中获取与所述第一匹配点相匹配的第二匹配点;匹配点判断模块,用于若所述第二匹配点与目标特征点为相同的点,则判断所述第一匹配点与所述目标特征点相匹配。
- 一种获取目标物三维坐标的装置,包括:视角图像获取模块,用于获取对目标物拍摄得到的第一视角图像和第二视角图像;所述目标物为三维空间中的物体;视角图像校正模块,用于对所述第一视角图像和第二视角图像进行校正得到第一图像和第二图像;特征点设置模块,用于将所述目标物在所述第一图像上投影的点设为目标特征点;匹配点确定模块,用于根据权利要求1至10任一项所述的图像特征点的跟踪方法或图像特征点的匹配方法,在所述第二图像中确定与第一图像的目标特征点相匹配的匹配点;二维坐标获取模块,用于获取所述目标特征点在所述第一图像中的二维坐标,获取所述匹配点在第二图像中的二维坐标;投影矩阵获取模块,用于获取所述第一图像的第一投影矩阵,获取所述第二图像的第二投影矩阵;三维坐标获取模块,用于根据所述目标特征点在所述第一图像中的二维坐标、匹配点在第二图像中的二维坐标、第一投影矩阵和第二投影矩阵获取所述目标物在三维空间中的三维坐标。
- 一种计算机设备,包括处理器和存储器,所述存储器存储有计算机程序,其中,所述处理器执行所述计算机程序时实现权利要求1至12任一项所述方法的步骤。
- 一种计算机可读存储介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现权利要求1至12任一项所述方法的步骤。
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910136888.4A CN109872344A (zh) | 2019-02-25 | 2019-02-25 | 图像特征点的跟踪方法、匹配方法和坐标获取方法、装置 |
| CN201910136888.4 | 2019-02-25 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020173194A1 true WO2020173194A1 (zh) | 2020-09-03 |
Family
ID=66919207
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2019/126816 Ceased WO2020173194A1 (zh) | 2019-02-25 | 2019-12-20 | 图像特征点的跟踪方法、匹配方法和坐标获取方法、装置 |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN109872344A (zh) |
| WO (1) | WO2020173194A1 (zh) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109872344A (zh) * | 2019-02-25 | 2019-06-11 | 广州视源电子科技股份有限公司 | 图像特征点的跟踪方法、匹配方法和坐标获取方法、装置 |
| CN112184766B (zh) * | 2020-09-21 | 2023-11-17 | 广州视源电子科技股份有限公司 | 一种对象的跟踪方法、装置、计算机设备和存储介质 |
| CN113199152B (zh) * | 2021-04-25 | 2022-05-27 | 深圳晶森激光科技股份有限公司 | 虚拟现实激光打标方法、装置、设备及存储介质 |
| CN114022501B (zh) * | 2021-10-28 | 2024-07-30 | 武汉中海庭数据技术有限公司 | 箭头角点自动化检测方法、系统、电子设备及存储介质 |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5383013A (en) * | 1992-09-18 | 1995-01-17 | Nec Research Institute, Inc. | Stereoscopic computer vision system |
| CN101887589A (zh) * | 2010-06-13 | 2010-11-17 | 东南大学 | 一种基于立体视觉的实拍低纹理图像重建方法 |
| CN101976455A (zh) * | 2010-10-08 | 2011-02-16 | 东南大学 | 一种基于立体匹配的彩色图像三维重建方法 |
| CN109102524A (zh) * | 2018-07-17 | 2018-12-28 | 广州视源电子科技股份有限公司 | 图像特征点的跟踪方法和跟踪装置 |
| CN109872344A (zh) * | 2019-02-25 | 2019-06-11 | 广州视源电子科技股份有限公司 | 图像特征点的跟踪方法、匹配方法和坐标获取方法、装置 |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP4069855B2 (ja) * | 2003-11-27 | 2008-04-02 | ソニー株式会社 | 画像処理装置及び方法 |
| CN102074015A (zh) * | 2011-02-24 | 2011-05-25 | 哈尔滨工业大学 | 一种基于二维图像序列的目标对象的三维重建方法 |
| CN104268880A (zh) * | 2014-09-29 | 2015-01-07 | 沈阳工业大学 | 基于特征和区域匹配相结合的深度信息获取方法 |
-
2019
- 2019-02-25 CN CN201910136888.4A patent/CN109872344A/zh active Pending
- 2019-12-20 WO PCT/CN2019/126816 patent/WO2020173194A1/zh not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5383013A (en) * | 1992-09-18 | 1995-01-17 | Nec Research Institute, Inc. | Stereoscopic computer vision system |
| CN101887589A (zh) * | 2010-06-13 | 2010-11-17 | 东南大学 | 一种基于立体视觉的实拍低纹理图像重建方法 |
| CN101976455A (zh) * | 2010-10-08 | 2011-02-16 | 东南大学 | 一种基于立体匹配的彩色图像三维重建方法 |
| CN109102524A (zh) * | 2018-07-17 | 2018-12-28 | 广州视源电子科技股份有限公司 | 图像特征点的跟踪方法和跟踪装置 |
| CN109872344A (zh) * | 2019-02-25 | 2019-06-11 | 广州视源电子科技股份有限公司 | 图像特征点的跟踪方法、匹配方法和坐标获取方法、装置 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN109872344A (zh) | 2019-06-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110689581B (zh) | 结构光模组标定方法、电子设备、计算机可读存储介质 | |
| CN113920206B (zh) | 透视移轴相机的标定方法 | |
| CN111192235B (zh) | 一种基于单目视觉模型和透视变换的图像测量方法 | |
| US9866818B2 (en) | Image processing apparatus and method, image processing system and program | |
| WO2020173194A1 (zh) | 图像特征点的跟踪方法、匹配方法和坐标获取方法、装置 | |
| CN109887002A (zh) | 图像特征点的匹配方法、装置、计算机设备和存储介质 | |
| WO2021196548A1 (zh) | 距离确定方法、装置及系统 | |
| TWI738196B (zh) | 一種圖像深度估計方法、電子設備、儲存介質 | |
| US20230025058A1 (en) | Image rectification method and device, and electronic system | |
| EP3547260B1 (en) | System and method for automatic calibration of image devices | |
| CN109102524B (zh) | 图像特征点的跟踪方法和跟踪装置 | |
| CN112308925A (zh) | 可穿戴设备的双目标定方法、设备及存储介质 | |
| CN106846416A (zh) | 单机分束双目被动立体视觉精确重构与细分拟合方法 | |
| WO2021195939A1 (zh) | 一种双目拍摄装置的外参的标定方法、可移动平台及系统 | |
| CN111325828B (zh) | 一种基于三目相机的三维人脸采集方法及装置 | |
| CN112184811A (zh) | 单目空间结构光系统结构校准方法及装置 | |
| CN113808033A (zh) | 图像文档校正方法、系统、终端及介质 | |
| CN115278071A (zh) | 图像处理方法、装置、电子设备和可读存储介质 | |
| CN111432117A (zh) | 图像矫正方法、装置和电子系统 | |
| CN110322477B (zh) | 特征点观察窗口设置方法、跟踪方法、装置、设备和介质 | |
| CN111915681B (zh) | 多组3d相机群的外参标定方法、装置、存储介质及设备 | |
| WO2023062994A1 (ja) | 学習装置、学習方法、学習プログラム、カメラパラメータ算出装置、カメラパラメータ算出方法及びカメラパラメータ算出プログラム | |
| RU2384882C1 (ru) | Способ автоматической компоновки ландшафтных панорамных изображений | |
| CN120431254A (zh) | 一种基于视觉里程计与深度学习的三维重建方法 | |
| CN120374668A (zh) | Vslam建图方法、装置、计算机设备、存储介质 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19917450 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 19917450 Country of ref document: EP Kind code of ref document: A1 |








