WO2022179002A1 - 图像匹配方法、装置、电子设备以及存储介质 - Google Patents
图像匹配方法、装置、电子设备以及存储介质 Download PDFInfo
- Publication number
- WO2022179002A1 WO2022179002A1 PCT/CN2021/098000 CN2021098000W WO2022179002A1 WO 2022179002 A1 WO2022179002 A1 WO 2022179002A1 CN 2021098000 W CN2021098000 W CN 2021098000W WO 2022179002 A1 WO2022179002 A1 WO 2022179002A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- template
- edge contour
- searched
- matching
- contour
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 77
- 238000013507 mapping Methods 0.000 claims abstract description 27
- 230000005484 gravity Effects 0.000 claims description 29
- 238000012545 processing Methods 0.000 claims description 27
- 238000004364 calculation method Methods 0.000 claims description 22
- 230000003044 adaptive effect Effects 0.000 claims description 17
- 230000001629 suppression Effects 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 8
- 238000005259 measurement Methods 0.000 claims description 4
- 230000008569 process Effects 0.000 abstract description 15
- 238000013519 translation Methods 0.000 abstract description 13
- 238000005286 illumination Methods 0.000 abstract description 7
- 230000008859 change Effects 0.000 abstract description 5
- 230000006872 improvement Effects 0.000 abstract description 3
- 230000006978 adaptation Effects 0.000 abstract 1
- 238000010276 construction Methods 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 19
- 230000009466 transformation Effects 0.000 description 14
- PXFBZOLANLWPMH-UHFFFAOYSA-N 16-Epiaffinine Natural products C1C(C2=CC=CC=C2N2)=C2C(=O)CC2C(=CC)CN(C)C1C2CO PXFBZOLANLWPMH-UHFFFAOYSA-N 0.000 description 12
- 238000011524 similarity measure Methods 0.000 description 12
- 230000006870 function Effects 0.000 description 10
- 239000011159 matrix material Substances 0.000 description 9
- 238000012360 testing method Methods 0.000 description 7
- 239000013598 vector Substances 0.000 description 6
- 238000004422 calculation algorithm Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 4
- 230000001186 cumulative effect Effects 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 239000000463 material Substances 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 230000011218 segmentation Effects 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 241001292396 Cirrhitidae Species 0.000 description 1
- 238000012937 correction Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000011156 evaluation Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000013138 pruning Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000000717 retained effect Effects 0.000 description 1
- 238000010187 selection method Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V10/00—Arrangements for image or video recognition or understanding
- G06V10/70—Arrangements for image or video recognition or understanding using pattern recognition or machine learning
- G06V10/74—Image or video pattern matching; Proximity measures in feature spaces
- G06V10/75—Organisation of the matching processes, e.g. simultaneous or sequential comparisons of image or video features; Coarse-fine approaches, e.g. multi-scale approaches; using context analysis; Selection of dictionaries
- G06V10/752—Contour matching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/02—Affine transformations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20016—Hierarchical, coarse-to-fine, multiscale or multiresolution image processing; Pyramid transform
Definitions
- the present application provides an image matching method, apparatus, electronic device and storage medium, so as to solve the problems of high matching complexity and low matching speed in the shape matching process.
- the present application provides an image matching method, the method comprising:
- the template edge contour feature information is used to represent the template edge contour feature points of multiple rotation angles under different pyramid layers extracted from the template image;
- the contour matching search information used when performing similarity matching between the template edge contour feature point of the next layer and the edge contour feature point corresponding to the next layer to be searched, and use it to skip to the next step.
- a layer of similarity matching is performed until the bottom of the pyramid;
- the contour matching search information includes the position of the region to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched; the contour matching result includes the template edge contour when the edge contour to be searched completes similarity matching.
- the position and rotation angle of the contour center of gravity includes the position of the region to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched; the contour matching result includes the template edge contour when the edge contour to be searched completes similarity matching. The position and rotation angle of the contour center of gravity.
- the present application also provides an image matching device, the device comprising:
- an image recognition module to be searched configured to locate the target shape indicated by the template image in the image to be searched according to the contour matching result at the bottom of the pyramid;
- the contour matching search information includes the position of the region to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched; the contour matching result includes the template edge contour when the edge contour to be searched completes similarity matching.
- the position and rotation angle of the contour center of gravity includes the position of the region to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched; the contour matching result includes the template edge contour when the edge contour to be searched completes similarity matching. The position and rotation angle of the contour center of gravity.
- the application also provides an electronic device, comprising:
- At least one processing device At least one processing device
- the at least one processing apparatus When the at least one program is executed by the at least one processing apparatus, the at least one processing apparatus implements the image matching method described in the first aspect of the present application.
- the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processing device, the image matching described in the first aspect of the present application is implemented method.
- FIG. 2 is a schematic diagram of a template edge profile feature information provided in an embodiment of the present application.
- FIG. 3 is a schematic diagram of a kind of pyramid layering provided in the embodiment of the present application that performs similarity matching between template edge contours and to-be-searched edge contours;
- Fig. 4 is the overall flow chart of a kind of image matching provided in the embodiment of the present application.
- FIG. 5 is a schematic diagram of performing edge extraction on a template image provided in an embodiment of the present application.
- FIG. 9 is a schematic diagram of performing adaptive hysteresis threshold processing provided in an embodiment of the present application.
- FIG. 10 is a schematic diagram of a gradient magnitude image of a template image provided in an embodiment of the present application.
- Fig. 13 is a kind of mapping schematic diagram of performing contour matching search information from the upper layer of the pyramid to the lower layer provided in the embodiment of the present application;
- FIG. 14 is a schematic diagram of sliding traversal of the template edge contour corresponding to the edge contour to be searched according to the embodiment of the present application;
- 17 is a schematic diagram of a matching time test result provided in an embodiment of the present application.
- FIG. 18 is a structural diagram of an image matching apparatus provided in an embodiment of the present application.
- FIG. 19 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
- FIG. 1 is a flowchart of an image matching method provided in an embodiment of the present application.
- the technical solution of this embodiment can be applied to the case of matching shapes between images, and the method can be performed by an image matching device, which can be implemented in software and/or hardware, and can be integrated into any device with a network communication function. on electronic devices.
- the image matching method in this embodiment of the present application may include steps S110 to S150.
- the template image including the target shape can be pyramid-layered to obtain template images corresponding to multiple layers, and after the pyramid layering, the template edge contour feature points of the template image of each layer can be processed through multiple rotation angles. Describe, create template edge contour feature information of template image.
- the template edge contour features are not affected by image grayscale changes, and the image shape matching based on template edge contour features can adapt to different illumination changes, such as less sensitive or non-uniform illumination changes. Lighting and other scenes can also be used for recognition tasks including translation and rotation, and can still accurately match the target shape for partial occlusion.
- image matching is usually performed based on edge contour features, and shape matching is performed between the image to be searched and the template image. Therefore, the image to be searched can be pyramid-layered according to the number of pyramid layers of the template image to obtain a plurality of layers of the to-be-searched image. Furthermore, corresponding edge contour feature points to be searched can be extracted from each layered image to be searched, and edge contour feature information to be searched of each layered image to be searched can be constructed. In this way, the image shape matching of the template image and the image to be searched under the same pyramid layer can be performed using the edge contour features of the same layer.
- the contour matching search information includes the position of the to-be-matched region and the to-be-matched angle range where the template image performs similarity matching on the to-be-searched edge contour of the to-be-searched image based on the template edge contour.
- the to-be-matched area can indicate the matching search position of the template edge contour when the to-be-searched edge contour is matched for similarity, so as to avoid wasting image matching resources by using the to-be-searched edge contour feature points outside the to-be-matched area for similarity matching.
- the angle range to be matched can indicate the template edge contour to perform similarity matching on the edge contour to be searched, and the rotation angle range of the template edge contour to be used to avoid using the template edge contour feature points with inappropriate angles to perform similarity matching and waste similarity matching. resource.
- the similarity When the similarity between the template edge contour and the edge contour to be searched is matched, statistics can be made between the edge contour feature points to be searched corresponding to the overlapping part of the template edge contour feature points of the current layer and the template edge contour feature points on the edge contour to be searched.
- the similarity the greater the similarity, the more similar the two are, and the similarity is 1 when they are completely matched.
- the contour matching results include the position of the contour center of gravity of the template edge contour on the edge contour to be searched and the rotation angle of the template edge contour when the template edge contour completes similarity matching based on the similarity of the edge contour feature points on the edge contour to be searched.
- the similarity matching is performed on the template edge contour of the same layer to be searched through the template edge contours of different rotation angles, and the feature points of the template edge contour under different rotation angles are calculated.
- the overlapping part on the edge contour to be searched corresponds to the similarity between the edge contour feature points to be searched, a series of similarity measure values between the edge contour feature points are obtained, and the location area corresponding to the maximum similarity measure value and the template are obtained.
- the rotation angle of the edge contour is used as the contour matching result of the current layer.
- S140 determine the contour matching search information used when performing similarity matching between the template edge contour feature point of the next layer and the edge contour feature point to be searched corresponding to the next layer, to jump Go to the next layer for similarity matching until the bottom of the pyramid.
- the edge contour features of the template edge contour near the bottom of the pyramid and the edge contour to be searched are more detailed, and the template edge contour close to the bottom of the pyramid and the edge contour to be searched are used for similarity. Matching is more accurate, but there will be a lot of edge contour feature points to be searched that need to be traversed during similarity matching, and the matching time will be longer. Therefore, an image pyramid is introduced to perform top-down hierarchical matching to achieve similarity matching between the edge contour feature points of the board and their corresponding edge contour feature points to be searched.
- the area to be matched and the angle range to be matched in the lower layer of the pyramid are determined by top-down mapping, which greatly reduces the edge contour feature points to be searched and the template edge contour feature points of the useless angle at the position of the useless area in the similar matching of the lower layer of the pyramid.
- the matching speed of the contour similarity between the edge contour of the template at the lower level of the pyramid and the edge contour to be searched is accelerated.
- the top-down pyramid layering determine whether the similarity matching reaches the bottom layer of the pyramid. If it reaches the bottom layer, you can directly use the contour matching result of the bottom layer of the pyramid to map to obtain the contour matching search information.
- the feature points perform similarity matching on the edge contour feature points to be searched to obtain the contour matching result of the bottom layer of the pyramid.
- the contour matching result of the bottom layer of the pyramid may include the position of the center of gravity and the rotation angle of the contour of the template edge contour of the bottom layer of the pyramid when the similarity matching is completed with respect to the edge contour to be searched.
- the target shape indicated by the template image is drawn in the image to be searched to achieve shape matching between images.
- the template image is created by pyramid layered multi-angle template image to extract template edge contour features, and multi-layer multi-angle template edge contour feature information is created, so that template edge contour features It is not affected by changes in image grayscale information, and ensures that it can adapt to different illumination changes based on edge shape matching, and is suitable for positioning tasks including translation and rotation, and can still accurately match the target in the case of partial occlusion; at the same time, taking into account the template edge
- the data structure of contour feature information is complicated to construct, and the matching process takes a long time.
- determining the template edge contour feature information of the template image may include steps A1-A2.
- Step A1 Perform pyramid adaptive layering on the template image to obtain multiple layered template images, and perform multi-rotation angle configuration on each layered template image.
- image rotation is performed for each layered template image according to the rotation angle configured by the angle interval and step size to achieve the Similarity matching using template images from different angles.
- Each layered template image is rotated and processed using bilinear interpolation, and the introduced black border area is filled with the copy boundary method.
- the rotation angle configuration of each layered template image can be performed through image affine transformation.
- image affine transformation is as follows:
- image affine transformation which includes the rotation and translation of the image. From the perspective of the spatial three-dimensional coordinate system of the image, the rotation of the image is equivalent to performing around the Z axis of the image, and at the same time, the rotation center point of the image is translated, and finally an affine transformation matrix containing the rotation and translation of the image is constructed.
- the corresponding affine transformation matrix expression is:
- (u, v) are the matrix coordinates after affine transformation of the image
- (x, y) are the image coordinates of the template image or the image to be searched.
- (c 1 , c 2 ) are the translation coordinates of the rotation center of the image relative to the rotation center of the template image or the image to be searched
- (a 1 , a 2 , b 1 , b 2 ) are the rotation matrices in the affine transformation matrix
- the rotation matrix of the affine transformation is calculated and recorded as:
- ⁇ is the rotation angle around the Z-axis of the image space coordinate system.
- the rotation center of the image is defined as the coordinate center of the image, taking half of the image row and column values, which is (cols/2,rows/2).
- i is the pixel of the image to be rotated
- i 1,2,...,n
- n is the number of pixels of the image to be rotated
- (x i , y i ) is the corresponding pixel of i in the image to be rotated.
- Coordinate position, ⁇ i is the rotation angle
- (u i , v i ) is the rotated coordinate position corresponding to the i pixel point, so as to realize the multi-rotation angle configuration for multiple layered template images.
- Step A2 Extract the template edge contour feature points corresponding to each layered template image with multiple rotation angles to construct template edge contour feature information of the template image with multiple layers and multiple rotation angles.
- Edge extraction is to obtain template edge contour point information in template edge contour images with different angles.
- the template edge contour feature information may include the centroid position of the contour, the pixel position of the edge contour point relative to the contour centroid, the gradient magnitude of the edge contour point, and the gradient direction of the edge contour point, such as lateral gradient and vertical gradient.
- the centroid of edge contour points is calculated as: summing the row coordinates and column coordinates of all edge contour points separately, and dividing by the number of statistical edge contour points.
- edge contour center of gravity is calculated using the following formula:
- edge contour feature information for example, template edge contour points are extracted from L layered template images to obtain template edge contour points of L ⁇ D template images, where D is the rotation angle of the template image, which is 360 by default.
- the constructed template edge contour feature information can be pre-stored, instead of needing to determine the template edge contour feature information for the template image every time the image to be searched is image-matched.
- performing pyramid adaptive layering on the template image to obtain multiple layered template images may include the following steps B1-B3.
- Step B1 Perform non-maximum suppression processing on the pixels in the template image according to the gradient magnitude and gradient direction of the template image to obtain a non-maximum suppressed template image.
- the edge gradient direction information of the template image is calculated, and the gradient of the template image f at coordinates (x, y) is defined as a two-dimensional vector:
- g x is the derivative in the x direction
- g y is the derivative in the y direction.
- the operator calculates the gradient in the form of image convolution, and the application can choose the Sobel operator to calculate the difference value of the two-dimensional image on the x-axis and the y-axis, wherein the templates in the x and y directions are as follows:
- the gradient magnitude G and gradient direction ⁇ of each pixel can be calculated; for example, the gradient magnitude G and gradient direction ⁇ are as follows:
- G x is the gradient amplitude in the x direction
- G y is the gradient amplitude in the y direction
- the calculation result of the gradient direction ⁇ of the corresponding pixel is in radians.
- the neighborhood range of the pixel point in the center of the image is divided into four directions: horizontal gradient direction, vertical gradient direction, upper right diagonal gradient direction and lower right gradient direction. direction.
- the gradient value of the center point is the maximum value in the 8-neighborhood, and this point is reserved as an edge point; when the gradient value of the center point is less than or equal to the gradient direction
- Figure 8 is the template image after non-maximum suppression processing.
- Step B2 Perform adaptive hysteresis threshold processing on the template image with non-maximum suppression processing, so as to perform edge division on the template image with non-maximum suppression processing to obtain template edge contour feature points.
- the template image with non-maximum value suppression is divided into edge points by double thresholds.
- the gradient value exceeds the high threshold Th is called strong edge, and the gradient value is smaller than the high threshold Th and greater than the low threshold T l is called weak edge.
- the gradient value less than T l is not an edge.
- the weak edge may be the edge, or it may be the noise in the image, so the strong edge point is directly retained; the weak edge point continues to judge, when there are strong edge points in the 8 neighborhoods around the weak edge point, the weak edge Points become strong edge points to connect strong edge points; non-edge points are culled to remove noise.
- the hysteresis threshold can be adaptively determined according to the gradient magnitude of the template image, and edge point division processing is performed on the template image that is not subjected to maximum suppression processing according to the hysteresis threshold of the template image.
- the high and low thresholds are adaptively obtained according to the image gradient amplitude. Adapt to the selection of high and low thresholds to reduce the interference of factors such as artificially set thresholds. The process of obtaining high and low thresholds by using the adaptive threshold selection method is as follows:
- n i is the number of gradient amplitudes at each stage, and N is the total number of gradient amplitudes.
- ⁇ 0 (k) is the expected sum of the 0th level to the k-1th level (that is, the expected sum of the C 0 class classification)
- ⁇ 1 (k, m) is the kth level.
- the expected sum of the mth level ie the expected sum of the C 1 class classification
- ⁇ 2 (m) is the expected sum of the items at the m+1th class and after the m+1 class (ie the expected sum of the C 2 class classification).
- ⁇ 0 (k) is obtained by the following formula:
- Step B3 Perform pyramid adaptive layering on the template image according to the extracted number of template edge contour feature points to obtain a plurality of layered template images.
- adaptive hysteresis threshold processing is performed on the template image with non-maximum value suppression, and after obtaining the edge contour of the template image after hysteresis threshold processing, the contour center of gravity, edge contour point gradient and gradient amplitude of the template edge contour are extracted.
- the edge contour feature information may include the centroid position of the contour, the pixel position of the edge contour point relative to the contour centroid, the gradient magnitude of the edge contour point, and the lateral and vertical gradients of the edge contour point.
- the calculation method is the same as that described above.
- the number of template edge contour feature points of the template image is obtained, and if the number of template edge contour feature points is more than the set minimum number of edge contour feature points m, the template image is subjected to pyramid downsampling and layering. Continue to obtain the number of template edge contour feature points of the template image after downsampling. If it is more than m, continue to layer until the requirements are met. At this time, the number of layers is the layer number L of the pyramid, so as to realize the pyramid adaptive segmentation of the template image. Layers get multiple layered template images.
- determining the edge contour feature information of the to-be-searched image includes steps C1-C2.
- Step C1 Perform pyramid layering on the image to be searched according to the number of pyramid layers of the template image to obtain a plurality of layered images to be searched.
- Step C2 extracting corresponding edge contour feature points to be searched from each layered image to be searched to construct feature information of the edge contour to be searched for each layered image to be searched.
- the feature information of the edge contour to be searched includes the position of the contour center of gravity, the pixel position of the edge contour point relative to the contour center of gravity, the gradient amplitude of the edge contour point, and the horizontal and vertical gradients of the edge contour point.
- the process of extracting the corresponding edge contour feature point to be searched Referring to the foregoing process of extracting template edge contour feature points from template images, details are not repeated here.
- FIG. 12 is a flowchart of another image matching method provided in the embodiment of the present application.
- the technical solution of this embodiment is refined on the basis of the above-mentioned embodiment, and the technical solution of this embodiment can be combined with at least one of the above-mentioned embodiments Combining each of the options.
- the image matching method provided in this embodiment of the present application may include steps S1210 to S1270.
- the template edge contour feature information represents template edge contour feature points with multiple rotation angles under different pyramid layers extracted from the template image.
- the edge contour feature information to be searched is used to represent the edge contour feature points to be searched under different pyramid layers extracted from the image to be searched according to the number of pyramid layers of the template image .
- the contour matching search information includes the position of the area to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched.
- the coordinate value of each edge contour point on the pre-created template edge contour relative to the contour center of gravity is obtained, and the contour center of gravity of the template edge contour is used as the key point of sliding matching, starting from the upper left corner of the edge contour to be searched, Sliding traversal is performed on the to-be-matched area corresponding to the to-be-searched edge contour of the template edge contour.
- the matching area and rotation angle of similarity matching are effectively controlled through the contour matching search information, avoiding traversing in the non-critical area of the edge contour to be searched and avoiding using the template edge contour with an inappropriate rotation angle for sliding traversal. Waste swipe traversal resources and avoid unnecessary data computation.
- the template edge contour when the template edge contour performs sliding traversal in the to-be-matched area of the edge contour to be searched, the template edge contour may have multiple sliding traversal positions, different rotations. There are more traversal positions when the template edge contour of the angle is traversed on the edge contour to be searched in the current layer. At each traversing position, the single point similarity between the single template edge contour feature point and the to-be-searched edge contour feature point corresponding to the single template edge contour point in the to-be-matched region can be calculated one by one.
- the similarity measure function that can be used is as follows:
- n is the number of edge points participating in the calculation
- d' i is the direction vector of a certain edge contour point in the template image edge contour of the template image
- e q+p' is the edge contour to be searched for the image to be searched
- the direction vector of a certain edge contour point t′ i is the x-direction gradient of the template image corresponding to the edge contour point, is the x-direction gradient of the edge contour point corresponding to the image to be searched
- u′ i is the y-direction gradient of the template image corresponding to the edge contour point
- the similarity measure Since the denominator of the similarity measure function formula normalizes the direction vector, the similarity measure is invariant to any illumination change, and all vectors are scaled to a length of 1. This similarity measure is robust to occlusion and clutter because if a feature is missing, either in the template or in the image to be searched, the noise will result in a random orientation vector, which on average has nothing to do with the sum contribution, does not affect the calculation results.
- the result obtained by the above formula is 1, which is a complete match.
- the calculated single-point similarity metric values will be accumulated in real time. It is judged whether the accumulated sum of the single-point similarity metric values reaches the preset minimum similarity metric value Smin, and if the accumulated sum has reached the minimum similarity metric value Smin, the point-by-point calculation at the corresponding traversing position is stopped. In this way, when performing similarity matching, it is not necessary to comprehensively calculate all the template edge contour feature points corresponding to the traversed position and all the to-be-searched edge contour feature points in the area to be matched, and the similarity metric value at the impossible target position does not need to be completely calculated.
- the cut-off condition is used to end the point-by-point calculation in advance, so as to quickly locate the real target position, save a lot of calculation, and thus speed up the matching speed; and, the cumulative sum of the single-point similarity metric values is For the similarity measure of the edge contour points of some templates, the problem of occlusion and hidden objects can be realized by using an improved termination condition, so it has good robustness to occlusion scenes.
- the first part is judged by a loose threshold, and the remaining part is judged by a strict threshold, which is achieved by presetting a greedy coefficient g.
- a strict threshold which is achieved by presetting a greedy coefficient g.
- S1250 Determine the contour matching result of the template edge contour of the current layer on the edge contour to be searched for the current layer according to the accumulated value of the single-point similarity when the point-by-point calculation is stopped at each traversal position.
- the contour matching search information of the current layer includes taking the entire contour area of the edge contour to be searched as the area to be matched, and using the initially set rotation angle range as the angle range to be matched.
- the contour matching search information of the current layer is based on the contour matching result in the contour of the edge to be searched corresponding to the previous layer, according to the preset matching search mapping method in the current layer. The mapping is determined corresponding to the edge contour to be searched.
- a preset matching search mapping method may be used to match the map to determine the contour matching search used when the template edge contour of the next layer is matched to the edge contour to be searched in the next layer for similarity matching. information.
- the matching search mapping method is used to map out the contour matching search information used for similarity matching corresponding to the edge contour to be searched at the lower layer according to the contour matching result corresponding to the edge contour to be searched at the upper layer.
- the matching search mapping method is used to map from the upper level of the pyramid to the lower level to determine the matching search information of the lower level contour.
- the contour center of the template edge contour is traversed and matched along the edge contour to be searched in the upper layer, and the upper layer matching position (x, y) with the highest score is obtained.
- the area to be matched for searching edge contours is:
- (x', y') are the coordinates of the upper left corner of the edge contour image mapping area to be searched in the lower layer
- (x", y") are the coordinates of the lower right corner of the edge contour image mapping area to be searched in the lower layer. It is determined that the contour matching search information in the lower layer of the pyramid corresponds to the location of the region to be matched.
- the matching search mapping method further includes mapping the range of angles to be matched in the contour matching search information from the upper level of the pyramid to the lower level.
- the calculation formula of the angle included in the contour matching result determined by the upper layer of the pyramid to map the angle range to the lower layer of the pyramid according to the matching search mapping method is:
- angle mapping formula to be matched angle next_pre is the starting point angle of the lower layer mapping
- angle next_aft is the end point angle of the lower layer mapping
- numLevels is the previously determined number of pyramid layers of the image to be searched.
- the contour matching search information from the upper layer of the pyramid to the lower layer of the pyramid is finely determined, and the similarity between the template edge contour and the edge contour to be searched from top to bottom is realized.
- the contour matching result of the bottom layer of the pyramid can be obtained, that is, the matching position and angle of the template edge contour of the bottom layer of the pyramid in the original image to be searched can be obtained, and the corresponding edge contour of the template edge contour can be found in turn from the matching position coordinates and angle. point, and draw the final target shape outline in the image to be searched. So far, a fast shape matching with translation, rotation and occlusion invariance is completed.
- the target shape indicated by the template image in the image to be searched according to the contour matching result at the bottom of the pyramid it also includes:
- the angle range to be matched in the contour matching search information of the current layer is corrected as follows: the angle step size changes with the number of pyramid layers, and is selected from the angle range to be matched according to the changed angle step size and based on the angles to be matched indicated by the modified contour matching search information, the similarity matching is performed on the contour of the template edge of the current layer corresponding to the contour of the edge to be searched.
- the angle variable step size matching strategy is as follows:
- numLevels is the determined number of pyramid layers
- angle next_pre and angle next_aft are determined by the angle range of the current layer to be matched
- the angle step size changes with the number of pyramid layers
- the angle of the current layer needs to be matched three times in total, that is, angle next_pre , angle next_aft and angle three angles, thereby reducing the number of angle matching.
- the template edge contours of different rotation angles of the current layer are controlled, and the interval sliding traversal is performed on the edge contour corresponding to the current layer to be searched according to the number of edge contour points of the current layer.
- the edge contour points of the current layer are accessed at a certain pixel interval during matching, so as to reduce the number of matching points and increase the number of matching points.
- P total is the total number of template edge contour points of the current layer
- P delete_num is the number of edge contour point intervals used for matching calculation in the current layer.
- the image matching scheme proposed in this application is tested, and four images with different characteristics are selected from the Halcon test library, namely: "rings.png” with obvious outline, “green-dot.png” with background interference, The deformation “metal-parts.png” and the inconspicuous contour map “20cent_german.png” are used as the images to be tested for matching test, and the test results are shown in Figure 15.
- the template image is created by pyramid layered multi-angle template image to extract template edge contour features, and multi-layer multi-angle template edge contour feature information is created, so that template edge contour features Unaffected by changes in image grayscale information, it is guaranteed to adapt to different illumination changes based on edge shape matching, and in translation and rotation positioning tasks, it can still accurately match the target in the case of partial occlusion; at the same time, taking into account the template edge contour
- the data structure of the feature information is complex, and the matching process takes a long time.
- the performance improvement strategy of similarity matching from coarse to fine reduces the amount of matching data of template edge contour features in the lower layer of the pyramid, solves the problem of high complexity of the feature point matching algorithm, and effectively improves the matching speed under the premise of ensuring matching accuracy. It is suitable for application scenarios with translation rotation and occlusion.
- FIG. 18 is a structural block diagram of an image matching apparatus provided in an embodiment of the present application.
- the technical solution of this embodiment can be applied to the case of matching shapes between images, and the apparatus can be implemented in software and/or hardware, and be integrated on any electronic device with network communication function.
- the image matching apparatus in this embodiment of the present application includes the following: a template information determination module 1810 , a to-be-searched information determination module 1820 , a similarity matching module 1830 , a lower-level map matching module 1840 , and a to-be-searched image recognition module 1850 . in:
- the template information determination module 1810 is configured to determine the template edge contour feature information of the template image; the template edge contour feature information is used to represent the template edge contour feature points of multiple rotation angles under different pyramid layers extracted from the template image;
- the to-be-searched information determination module 1820 is configured to determine the to-be-searched edge contour feature information of the to-be-searched image; the to-be-searched edge contour feature information is used to represent the number of pyramid layers according to the template image, extracted from the to-be-searched image The edge contour feature points to be searched under different pyramid layers;
- the similarity matching module 1830 is configured for the top-down pyramid hierarchical structure, based on the contour matching search information of the current layer, according to the template edge contour feature points of the current layer and the template edge contour feature of the current layer. Similarity matching is performed on the edge contour feature points corresponding to the points to be searched to obtain the contour matching result of the current layer;
- the lower layer mapping matching module 1840 is configured to determine the contour matching used when performing similarity matching between the template edge contour feature point of the next layer and the edge contour feature point corresponding to the next layer to be searched according to the contour matching result of the current layer. Search for information to jump to the next level for similarity matching until the bottom of the pyramid;
- the to-be-searched image recognition module 1850 is configured to locate the target shape indicated by the template image in the to-be-searched image according to the contour matching result at the bottom of the pyramid;
- the contour matching search information includes the position of the region to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched; the contour matching result includes the template edge contour when the edge contour to be searched completes similarity matching.
- the position and rotation angle of the contour center of gravity includes the position of the region to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched; the contour matching result includes the template edge contour when the edge contour to be searched completes similarity matching. The position and rotation angle of the contour center of gravity.
- the template information determination module 1810 is configured to:
- the template edge contour feature information includes the position of the contour center of gravity, the pixel position of the edge contour point relative to the contour center of gravity, the gradient magnitude of the edge contour point, and the gradient direction of the edge contour point.
- pyramid adaptive layering is performed on the template image to obtain multiple layered template images, including:
- non-maximum suppression processing is performed on the pixels in the template image to obtain a non-maximum suppressed template image
- pyramid adaptive layering is performed on the template image to obtain multiple layered template images.
- the information to be searched determining module 1820 is configured to:
- the image to be searched is subjected to pyramid layering to obtain a plurality of layered images to be searched;
- the edge contour feature information to be searched includes the position of the center of gravity of the contour, the pixel position of the edge contour point relative to the center of gravity of the contour, the gradient amplitude of the edge contour point, and the lateral and vertical gradients of the edge contour point.
- similarity matching module 1830 includes:
- the single point similarity between the template edge contour feature point and the to-be-searched edge contour feature point corresponding to the template edge contour feature point is calculated point by point under each traversing position; and, at each traversal position Under the position, the single point similarity calculated point by point is accumulated, and when the accumulated value of the single point similarity reaches the preset similarity measurement value, the calculation is stopped;
- the contour matching result of the template edge contour of the current layer on the edge contour to be searched in the current layer is determined.
- the contour matching search information of the current layer includes taking the entire contour area of the edge contour to be searched as the area to be matched, and using the initial set rotation angle ranges as The range of angles to be matched;
- the contour matching search information of the current layer is based on the contour matching result corresponding to the edge contour to be searched in the previous layer, according to the preset matching search mapping method in the current layer The mapping is determined corresponding to the edge contour to be searched.
- the matching search mapping method is used to map the contour matching search information used for similarity matching corresponding to the edge contour to be searched at the lower layer according to the contour matching result corresponding to the edge contour to be searched at the upper layer.
- the angle range to be matched in the contour matching search information of the current layer is revised as follows: the angle step length follows the change of the number of pyramid layers, and the angle range to be matched is changed according to the change. Multiple angles to be matched selected by the next angle step.
- the template edge contours of different rotation angles of the current layer are controlled, and the interval sliding traversal is performed on the edge contour corresponding to the current layer to be searched according to the number of edge contour points of the current layer.
- the image matching apparatus provided in this embodiment of the present application can perform the image matching method provided in any of the above-mentioned embodiments of the present application, and has the corresponding function of executing the image matching method. Refer to the image matching method provided in any embodiment of this application.
- FIG. 19 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.
- the electronic device provided in this embodiment of the present application includes: at least one processor 1910 and a storage device 1920 ; the processor 1910 in the electronic device may be at least one, and in FIG. 19 , one processor 1910 is For example; the storage device 1920 is configured to store at least one program; the at least one program is executed by the at least one processor 1910, so that the at least one processor 1910 implements the image matching according to any one of the embodiments of the present application method.
- the electronic device may further include: an input device 1930 and an output device 1940 .
- the processor 1910 , the storage device 1920 , the input device 1930 and the output device 1940 in the electronic device may be connected by a bus or in other ways.
- the connection by a bus is taken as an example.
- the storage device 1920 in the electronic device may be configured to store at least one program, and the program may be a software program, a computer-executable program, and a module, such as the images provided in the embodiments of the present application
- the program instruction/module corresponding to the matching method.
- the processor 1910 executes various functional applications and data processing of the electronic device by running the software programs, instructions and modules stored in the storage device 1920, ie, implements the image matching method in the above method embodiments.
- the storage device 1920 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the electronic device, and the like. Additionally, storage device 1920 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, storage 1920 may include memory located remotely from processor 1910, which may be connected to the device through a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
- the input device 1930 may be configured to receive input numerical or character information, and to generate key signal input related to user settings and function control of the electronic device.
- the output device 1940 may include a display device such as a display screen.
- the program when at least one program included in the above electronic device is executed by the at least one processor 1910, the program performs the following operations:
- the template edge contour feature information is used to represent the template edge contour feature points of multiple rotation angles under different pyramid layers extracted from the template image;
- the to-be-searched edge contour feature information is used to represent the to-be-searched under different pyramid layers extracted from the to-be-searched image according to the number of pyramid layers of the template image edge contour feature points;
- the contour matching search information used when performing similarity matching between the template edge contour feature point of the next layer and the edge contour feature point corresponding to the next layer to be searched, and use it to skip to the next step.
- a layer of similarity matching is performed until the bottom of the pyramid;
- the contour matching search information includes the position of the region to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched; the contour matching result includes the template edge contour when the edge contour to be searched completes similarity matching.
- the position and rotation angle of the contour center of gravity includes the position of the region to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched; the contour matching result includes the template edge contour when the edge contour to be searched completes similarity matching. The position and rotation angle of the contour center of gravity.
- An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, is used to execute an image matching method, and the method includes:
- the template edge contour feature information is used to represent the template edge contour feature points of multiple rotation angles under different pyramid layers extracted from the template image;
- the to-be-searched edge contour feature information is used to represent the to-be-searched under different pyramid layers extracted from the to-be-searched image according to the number of pyramid layers of the template image edge contour feature points;
- the contour matching search information used when performing similarity matching between the template edge contour feature point of the next layer and the edge contour feature point corresponding to the next layer to be searched, and use it to skip to the next step.
- a layer of similarity matching is performed until the bottom of the pyramid;
- the contour matching search information includes the position of the region to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched; the contour matching result includes the template edge contour when the edge contour to be searched completes similarity matching.
- the position and rotation angle of the contour center of gravity includes the position of the region to be matched and the angle range to be matched for similarity matching on the contour of the edge to be searched; the contour matching result includes the template edge contour when the edge contour to be searched completes similarity matching. The position and rotation angle of the contour center of gravity.
- the computer program when executed by the processor, it can also be used to execute the image matching method provided in any embodiment of the present application.
- the computer storage medium of the embodiments of the present application may adopt any combination of at least one computer-readable medium.
- the computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium.
- the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above.
- Computer readable storage media include: electrical connections having at least one wire, portable computer disks, hard disks, random access memory (RAM), read only memory (Read Only Memory, ROM), Erasable Programmable Read Only Memory (Erasable Programmable Read Only Memory, EPROM), flash memory, optical fiber, portable CD-ROM, optical storage device, magnetic storage device, or any suitable combination of the above.
- a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
- a computer-readable signal medium may include a propagated data signal in baseband or as part of a carrier wave, with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing.
- a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
- Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
- suitable medium including but not limited to: wireless, wire, optical fiber cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
- Computer program code for performing the operations of the present application may be written in one or more programming languages, including object-oriented programming languages—such as Java, Smalltalk, C++, but also conventional Procedural programming language - such as the "C" language or similar programming language.
- the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server.
- the remote computer can be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or it can be connected to an external computer (eg using an internet service provider to connect via the internet).
- LAN Local Area Network
- WAN Wide Area Network
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physics & Mathematics (AREA)
- Evolutionary Computation (AREA)
- Data Mining & Analysis (AREA)
- Artificial Intelligence (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Biology (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Databases & Information Systems (AREA)
- General Health & Medical Sciences (AREA)
- Medical Informatics (AREA)
- Software Systems (AREA)
- Multimedia (AREA)
- Image Analysis (AREA)
Abstract
一种图像匹配方法、装置、电子设备以及存储介质。所述方法包括通过对模板图像进行金字塔分层多角度的模板图像创建来提取模板边缘轮廓特征,创建多层多角度的模板边缘轮廓特征,使模板边缘轮廓特征不受图像灰度信息变化的影响,保证基于边缘形状匹配适应不同光照变化;同时考虑到模板边缘轮廓特征信息的数据结构构建复杂,匹配过程中需要较长时间,通过使用分层的模板边缘轮廓特征从金字塔结构自上而下逐层映射进行相似度匹配,综合运用金字塔多个层级实现由粗到精的相似度匹配的性能提升策略,降低金字塔下层的模板边缘轮廓特征匹配数据量,在保证匹配精度的前提下有效提升匹配速度且适用于存在平移旋转以及遮挡的应用场景。
Description
本申请要求在2021年2月24日提交中国专利局、申请号202110208903.9的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
本申请实施例涉及图像处理技术领域,例如涉及一种图像匹配方法、装置、电子设备以及存储介质。
图像匹配已成为机器视觉技术重要的研究内容之一,在目标识别、工件精确定位以及视频跟踪等领域中得到广泛应用。
图像匹配技术主要分为三类:基于灰度相关的模板匹配方法、基于几何基元的匹配方法和基于几何特征的模板匹配方法。但是,第一类以图像灰度信息直接匹配,相对比较简单且容易实现,但其抗干扰性差,不适应非均匀变化的光照和部分遮挡情况;第二类在目标图像中匹配模板中的几何基元,适用于待测目标发生旋转的场景,对特征点要求较高且计算复杂度非常高;第三类适用于目标存在旋转和缩放的情况,但需要建立庞大的累加计数器数组,初始化和统计的过程比较复杂,耗时较大,会影响图像匹配效率。
发明内容
本申请提供了一种图像匹配方法、装置、电子设备以及存储介质,以实现在形状匹配过程中兼顾解决匹配复杂度高和匹配速度低的问题。
第一方面,本申请提供了一种图像匹配方法,所述方法包括:
确定模板图像的模板边缘轮廓特征信息;所述模板边缘轮廓特征信息用于表征从模板图像提取的不同金字塔分层下的多旋转角度的模板边缘轮廓特征点;
确定待搜索图像的待搜索边缘轮廓特征信息;所述待搜索边缘轮廓特征信 息用于表征根据所述模板图像的金字塔分层数,从所述待搜索图像提取的不同金字塔分层下的待搜索边缘轮廓特征点;
针对自上而下的金字塔分层结构,基于当前分层的轮廓匹配搜索信息,依据当前分层的模板边缘轮廓特征点与所述当前分层的模板边缘轮廓特征点对应的待搜索边缘轮廓特征点进行相似度匹配,得到当前分层的轮廓匹配结果;
依据当前分层的轮廓匹配结果,确定将下一分层的模板边缘轮廓特征点与下一分层对应待搜索边缘轮廓特征点进行相似度匹配时使用的轮廓匹配搜索信息,用以跳到下一分层进行相似度匹配,直至金字塔底层;
依据在金字塔底层的轮廓匹配结果,在所述待搜索图像中定位模板图像指示的目标形状;
其中,所述轮廓匹配搜索信息包括在待搜索边缘轮廓上进行相似度匹配的待匹配区域位置和待匹配角度范围;所述轮廓匹配结果包括模板边缘轮廓在待搜索边缘轮廓完成相似度匹配时的轮廓重心位置与旋转角度。
第二方面,本申请还提供了一种图像匹配装置,所述装置包括:
模板信息确定模块,设置为确定模板图像的模板边缘轮廓特征信息;所述模板边缘轮廓特征信息用于表征从模板图像提取的不同金字塔分层下的多旋转角度的模板边缘轮廓特征点;
待搜索信息确定模块,设置为确定待搜索图像的待搜索边缘轮廓特征信息;所述待搜索边缘轮廓特征信息用于表征根据所述模板图像的金字塔分层数,从所述待搜索图像提取的不同金字塔分层下的待搜索边缘轮廓特征点;
相似度匹配模块,设置为针对自上而下的金字塔分层结构,基于当前分层的轮廓匹配搜索信息,依据当前分层的模板边缘轮廓特征点与所述当前分层的模板边缘轮廓特征点对应的待搜索边缘轮廓特征点进行相似度匹配,得到当前分层的轮廓匹配结果;
下层映射匹配模块,设置为依据当前分层的轮廓匹配结果,确定将下一分层的模板边缘轮廓特征点与下一分层对应待搜索边缘轮廓特征点进行相似度匹 配时使用的轮廓匹配搜索信息,用以跳到下一分层进行相似度匹配,直至金字塔底层;
待搜索图像识别模块,设置为依据在金字塔底层的轮廓匹配结果,在所述待搜索图像中定位模板图像指示的目标形状;
其中,所述轮廓匹配搜索信息包括在待搜索边缘轮廓上进行相似度匹配的待匹配区域位置和待匹配角度范围;所述轮廓匹配结果包括模板边缘轮廓在待搜索边缘轮廓完成相似度匹配时的轮廓重心位置与旋转角度。
第三方面,本申请还提供了一种电子设备,包括:
至少一个处理装置;
存储装置,设置为存储至少一个程序;
当所述至少一个程序被所述至少一个处理装置执行,使得所述至少一个处理装置实现本申请第一方面所述的图像匹配方法。
第四方面,本申请还提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理装置执行时实现本申请第一方面所述的图像匹配方法。
图1是本申请实施例中提供的一种图像匹配方法的流程图;
图2是本申请实施例中提供的一种模板边缘轮廓特征信息的示意图;
图3是本申请实施例中提供的一种金字塔分层对模板边缘轮廓与待搜索边缘轮廓进行相似度匹配的示意图;
图4是本申请实施例中提供的一种图像匹配的总体流程框图;
图5是本申请实施例中提供的一种对模板图像进行边缘提取的示意图;
图6是本申请实施例中提供的一种对模板图像方向差分处理的效果示意图;
图7是本申请实施例中提供的一种模板图像的图像梯度方向的示意图;
图8是本申请实施例中提供的一种对图像进行非极大值抑制的示意图;
图9是本申请实施例中提供的一种进行自适应滞后阈值处理的示意图;
图10是本申请实施例中提供的一种模板图像的梯度幅值图像的示意图;
图11是本申请实施例中提供的一种对模板图像进行自适应滞后阈值处理的效果示意图;
图12是本申请实施例中提供的另一种图像匹配方法的流程图;
图13是本申请实施例中提供的一种从金字塔上层向下层进行轮廓匹配搜索信息的映射示意图;
图14是本申请实施例中提供的一种将模板边缘轮廓在对应待搜索边缘轮廓进行滑动遍历的示意图;
图15是本申请实施例中提供的一种匹配准确度测试结果的示意图;
图16是本申请实施例中提供的一种匹配测试效果显示的示意图;
图17是本申请实施例中提供的一种匹配时间测试结果的示意图;
图18是本申请实施例中提供的一种图像匹配装置的结构图;
图19是本申请实施例中提供的一种电子设备的结构示意图。
下面结合附图和实施例对本申请作详细说明。
在更加详细地讨论示例性实施例之前,应当提到的是,一些示例性实施例被描述成作为流程图描绘的处理或方法。虽然流程图将各项操作(或步骤)描述成顺序的处理,但是其中的许多操作(或步骤)可以被并行地、并发地或者同时实施。此外,各项操作的顺序可以被重新安排。当其操作完成时所述处理可以被终止,但是还可以具有未包括在附图中的附加步骤。所述处理可以对应于方法、函数、规程、子例程、子程序等等。
图1是本申请实施例中提供的一种图像匹配方法的流程图。本实施例的技术方案可适用于对图像间的形状进行匹配的情况,该方法可以由图像匹配装置来执行,该装置可以采用软件和/或硬件的方式实现,并集成在任何具有网络通 信功能的电子设备上。如图1所示,本申请实施例中的图像匹配方法,可以包括步骤S110至S150。
S110、确定模板图像的模板边缘轮廓特征信息;模板边缘轮廓特征信息表征从模板图像提取的不同金字塔分层下的多旋转角度的模板边缘轮廓特征点。
在进行图像形状匹配时,需通过包含目标形状的模板图像来对待搜索图像中包括的目标形状进行形状匹配。参见图2,可对包括目标形状的模板图像进行金字塔分层得到多个分层对应的模板图像,并在金字塔分层后通过多个旋转角度对每层的模板图像的模板边缘轮廓特征点进行描述,创建模板图像的模板边缘轮廓特征信息。通过提取多分层多角度的模板边缘轮廓特征,使模板边缘轮廓特征不受图像灰度变化影响,使基于模板边缘轮廓特征的图像形状匹配适应不同光照变化,例如光照较不敏感或非均匀变化光照等场景,同时可用于含有平移及旋转的识别任务,且对于部分遮挡情况仍可准确匹配到目标形状。
S120、确定待搜索图像的待搜索边缘轮廓特征信息;待搜索边缘轮廓特征信息表征根据模板图像的金字塔分层数,从待搜索图像提取的不同金字塔分层下的待搜索边缘轮廓特征点。
在图像形状匹配时,通常会基于边缘轮廓特征进行图像匹配,对待搜索图像与模板图像进行形状匹配。因此,可按照对模板图像的金字塔分层数对待搜索图像进行金字塔分层得到多个分层的待搜索图像。进而,可从每个分层的待搜索图像中提取对应的待搜索边缘轮廓特征点,构建每个分层的待搜索图像的待搜索边缘轮廓特征信息。这样,可使用同层的边缘轮廓特征对模板图像与待搜索图像在同一个金字塔分层下进行图像形状匹配。
S130、针对自上而下的金字塔分层结构,基于当前分层的轮廓匹配搜索信息,依据当前分层的模板边缘轮廓特征点与当前分层的模板边缘轮廓特征点对应的待搜索边缘轮廓特征点进行相似度匹配,得到当前分层的轮廓匹配结果。
轮廓匹配搜索信息包括模板图像基于模板边缘轮廓在待搜索图像的待搜索边缘轮廓上进行相似度匹配的待匹配区域位置和待匹配角度范围。其中,待匹 配区域可指示模板边缘轮廓在待搜索边缘轮廓进行相似度匹配时的匹配搜索位置,避免使用待匹配区域以外的待搜索边缘轮廓特征点进行相似度匹配而浪费图像匹配资源。待匹配角度范围可指示模板边缘轮廓在待搜索边缘轮廓进行相似度匹配,所使用的模板边缘轮廓的旋转角度范围,避免使用角度不合适的模板边缘轮廓特征点进行相似度匹配而浪费相似度匹配资源。
在对模板边缘轮廓与待搜索边缘轮廓进行相似度匹配时,可统计当前分层的模板边缘轮廓特征点与模板边缘轮廓特征点在待搜索边缘轮廓上重叠部分对应待搜索边缘轮廓特征点之间的相似度,相似度越大,两者之间越相似,完全匹配时相似度为1。轮廓匹配结果包括模板边缘轮廓在待搜索边缘轮廓上基于边缘轮廓特征点的相似度完成相似匹配时,模板边缘轮廓的轮廓重心在待搜索边缘轮廓上的轮廓重心位置以及模板边缘轮廓的旋转角度。
对于同一分层的模板边缘轮廓与待搜索边缘轮廓而言,通过不同旋转角度的模板边缘轮廓分别在同分层待搜索边缘轮廓上进行相似度匹配,统计不同旋转角度下模板边缘轮廓特征点与在待搜索边缘轮廓上重叠部分对应待搜索边缘轮廓特征点之间的相似度,得到一系列的边缘轮廓特征点之间的相似度度量值,取相似度度量值最大值对应的位置区域以及模板边缘轮廓的旋转角度作为当前分层的轮廓匹配结果。
S140、依据当前分层的轮廓匹配结果,确定将下一分层的模板边缘轮廓特征点与下一分层对应待搜索边缘轮廓特征点进行相似度匹配时使用的轮廓匹配搜索信息,用以跳到下一分层进行相似度匹配,直至金字塔底层。
参见图3,对于自上而下的金字塔分层,靠近金字塔底层的模板边缘轮廓与待搜索边缘轮廓的边缘轮廓特征细节较多,使用靠近金字塔底层的模板边缘轮廓与待搜索边缘轮廓进行相似度匹配更为准确,但是相似度匹配时需要遍历的待搜索边缘轮廓特征点会非常多,匹配花费的时间也会比较长。因此,引入图像金字塔进行自上而下分层匹配,实现板边缘轮廓特征点与其对应的待搜索边缘轮廓特征点的相似度匹配。
参见图3,按照自上而下的金字塔分层,先在金字塔上层进行少量模板边缘轮廓特征点与少量待搜索边缘轮廓特征点之间的相似度粗匹配得到一个粗略的轮廓匹配结果。在金字塔上层得到一个粗略的轮廓匹配结果后,基于在金字塔上层得到的轮廓匹配结果向金字塔下层映射得到新的轮廓匹配搜索信息,便于在金字塔下层使用更加细致的模板边缘轮廓特征点与待搜索边缘轮廓特征点进行相似度匹配。通过自上而下映射确定在金字塔下层的待匹配区域和待匹配角度范围,大幅度缩减在金字塔下层相似匹配时无用区域位置处的待搜索边缘轮廓特征点和无用角度的模板边缘轮廓特征点,从而加快在金字塔下层模板边缘轮廓与待搜索边缘轮廓之间的轮廓相似度匹配速度。
S150、依据在金字塔底层的轮廓匹配结果,在待搜索图像中定位模板图像指示的目标形状。
参见图3,按照自上而下的金字塔分层,判断相似度匹配是否到达金字塔底层,如果到达底层可直接利用金字塔次底层的轮廓匹配结果映射得到轮廓匹配搜索信息,在金字塔底层将模板边缘轮廓特征点在待搜索边缘轮廓特征点上进行相似度匹配,得到金字塔底层的轮廓匹配结果。金字塔底层的轮廓匹配结果可包括金字塔底层的模板边缘轮廓在对应待搜索边缘轮廓完成相似度匹配时的轮廓重心位置与旋转角度。基于在金字塔底层相似度匹配结束时的轮廓匹配结果指示的轮廓重心位置以及所使用的模板边缘轮廓的旋转角度,在待搜索图像中勾画出模板图像指示的目标形状,实现图像间形状匹配。
根据本申请实施例中提供的图像匹配方法,通过对模板图像进行金字塔分层多角度的模板图像创建来提取模板边缘轮廓特征,创建多层多角度的模板边缘轮廓特征信息,使模板边缘轮廓特征不受图像灰度信息变化的影响,保证基于边缘形状匹配适应不同的光照变化,并且适用于含有平移及旋转的定位任务,且对于部分遮挡的情况仍然可准确匹配到目标;同时考虑到模板边缘轮廓特征信息的数据结构构建复杂,匹配过程中需要较长时间,通过使用分层的模板边缘轮廓特征从金字塔分层自上而下逐层映射进行相似度匹配,综合运用金字塔 在多个分层实现由粗到精的相似度匹配的性能提升策略,降低金字塔下层的模板边缘轮廓特征匹配数据量,解决特征点匹配算法复杂度过高的问题,在保证匹配精度的前提下有效提升匹配速度且适用于存在平移旋转以及遮挡的应用场景。
在本实施例的一种可选方案中,可以与上述至少一个实施例中各个可选方案结合。其中,确定模板图像的模板边缘轮廓特征信息,可包括步骤A1-A2。
步骤A1、对模板图像进行金字塔自适应分层得到多个分层的模板图像,并对每个分层的模板图像进行多旋转角度配置。
给定形状匹配的角度区间和步长,在不改变每个分层的模板图像大小的情况下,针对每个分层的模板图像按照角度区间和步长配置的旋转角度进行图像旋转,实现能使用不同角度的模板图像进行相似度匹配。对每个分层的模板图像进行旋转后使用双线性插值进行处理,此外对引入的黑边区域使用复制边界法进行填充。
可选地,由于数字图像通常是以矩阵形式存在,可通过图像仿射变换对每个分层的模板图像进行旋转角度配置,图像仿射变换的流程如下:
(1)、构建仿射变换矩阵
通过图像仿射变换实现图像从一个二维坐标到另一个二维坐标的转换,其中包含对图像的旋转和平移。从图像的空间三维坐标系来看,对图像的旋转相当于绕图像的Z轴进行,同时对图像的旋转中心点进行平移,最终构造成包含图像旋转平移的仿射变换矩阵。对应的仿射变换矩阵表达式为:
上式中(u,v)为对图像进行仿射变换后的矩阵坐标,(x,y)为模板图像或待搜索图像的图像坐标。(c
1,c
2)为图像旋转中心相对于模板图像或待搜索图像旋转中心的平移坐标,(a
1,a
2,b
1,b
2)为构成仿射变换矩阵中旋转矩阵
的参数, 其包含了对图像的旋转、尺度变化等信息,图像坐标轴x、y轴为正交轴,因此,参数(a
1,a
2,b
1,b
2)满足
和a
1b
1+a
2b
2=0。
(2)、计算仿射变换矩阵
由于图像的旋转变换围绕图像空间坐标系Z轴进行,根据第一步获得的图像旋转角度信息,计算得到仿射变换的旋转矩阵,记为:
上式中,θ为绕图像空间坐标系Z轴的旋转角度。图像的旋转中心定义为图像的坐标中心,取图像行与列值的一半,即为(cols/2,rows/2)。最终,得到包含图像旋转平移信息的仿射变换矩阵,记为:
根据第一步图像的角度起点、范围和步长信息,可以得到由若干旋转角度构成的一系列图像仿射变换矩阵组,记为:
上式中,i为待旋转图像的像素点,i=1,2,…,n,n为待旋转图像的像素点数,(x
i,y
i)为对应i像素点在待旋转图像中的坐标位置,θ
i为旋转角度,(u
i,v
i)为对应i像素点旋转后的坐标位置,这样就实现对多个分层的模板图像的多旋转角度配置。
步骤A2、提取每个分层的多旋转角度的模板图像对应的模板边缘轮廓特征点,以构建模板图像多分层多旋转角度的模板边缘轮廓特征信息。
边缘提取是为了获得具有不同角度的模板边缘轮廓图像中的模板边缘轮廓点信息。模板边缘轮廓特征信息可包括轮廓的重心位置、边缘轮廓点相对于轮廓重心的像素位置、边缘轮廓点梯度幅值以及边缘轮廓点的梯度方向,比如横 向梯度与纵向梯度。边缘轮廓点的重心计算为:分别统计求和所有边缘轮廓点的行坐标和列坐标,并除以统计的边缘轮廓点数。边缘轮廓重心
的计算采用下式:
上式中,统计每个边缘像素点的行、列坐标之和,n为边缘像素点个数,求取行、列坐标均值。边缘轮廓点相对于轮廓重心像素的坐标求解为:
边缘轮廓点在x方向和y方向的梯度由图像方向差分生成的x方向和y方向梯度图像得到。边缘轮廓点的梯度幅值由前述计算的梯度幅值得到。
在从每个分层的模板图像中分别提取对应的模板边缘轮廓特征后,以结构体的形式保存,同时为便于访问可采用线性表的方式对所有的边缘轮廓特征点进行组织,最终构建模板边缘轮廓特征信息;例如针对L个分层的模板图像提取模板边缘轮廓点,共得到L×D幅模板图像的模板边缘轮廓点,D为模板图像的旋转角度,默认为360。在构建模板边缘轮廓特征信息后,可对构建的模板边缘轮廓特征信息进行预先存储,而不用每次对待搜索图像进行图像匹配时都需要针对模板图像确定一次模板边缘轮廓特征信息。
在本实施例的一种可选方案中,可以与上述至少一个实施例中各个可选方案结合。其中,对模板图像进行金字塔自适应分层得到多个分层的模板图像,可包括以下步骤B1-B3。
步骤B1、依据模板图像的梯度幅值与梯度方向,对模板图像中像素点进行非极大值抑制处理,得到非极大值抑制的模板图像。
参见图4与图5,计算模板图像的边缘梯度方向信息,模板图像f在坐标 (x,y)处的梯度定义为二维向量:
将x方向和y方向的Sobel模板与模板图像进行卷积,分别得到x方向和y方向的差分值,即可得到图6示出的图像方向差分示意图。利用每个像素在x方向和y方向的差分值,可计算得到每个像素点的梯度幅值G和梯度方向θ;例如梯度幅值G和梯度方向θ分别如下:
上式中,G
x为x方向梯度幅值,G
y为y方向梯度幅值,对应像素点的梯度方向θ的计算结果为弧度制。
经过Sobel算子检测出来的边缘有时会过于粗大,无法直接利用过于粗大的边缘信息,因此需要抑制梯度不够大的像素点,保留最大的梯度,从而达到细化边缘,将梯度不够大的像素点剔除,只保留梯度幅值最大的边缘点的目的,梯度不够大的像素点很可能是某一条边缘的过渡点。
参见图5与图7,据每个边缘的像素点的梯度方向,将图像中心像素点的邻域范围划分为水平梯度方向、垂直梯度方向、右上对角梯度方向以及右下梯度方向这四个方向。当中心点梯度值大于梯度方向上两个端点的梯度值时,该 中心像素点梯度值即为8邻域内的极大值,保留该点为边缘点;当中心点梯度值小于或等于梯度方向上两个端点的梯度值时,则将该点从边缘点中剔除,其中图8为经过非极大值抑制处理后的模板图像。
步骤B2、对非极大值抑制的模板图像进行自适应滞后阈值处理,以对非极大值抑制处理的模板图像进行边缘划分得到模板边缘轮廓特征点。
参见图9,利用双阈值对非极大值抑制的模板图像划分边缘点,梯度值超过高阈值T
h的称为强边缘,梯度值小于高阈值T
h大于低阈值T
l的称为弱边缘,梯度值小于T
l的不是边缘。弱边缘则可能是边缘,也有可能是图像中存在的噪声,因此强边缘点直接保留;弱边缘点继续判断,弱边缘点周围的8邻域中有强边缘点存在时,就将该弱边缘点变成强边缘点,以此来连接强边缘点;非边缘点剔除,以此来去除杂点。
参见图9,可依据模板图像的梯度幅值自适应确定滞后阈值,并依据模板图像的滞后阈值,对非极大值抑制处理的模板图像进行边缘点划分处理。为了减少人为设置阈值带来误差,参见图10,根据图像梯度幅值自适应取得高低阈值,例如在根据图像梯度幅值自适应取得高低阈值时,边缘提取过程中可引入类内方差最小化自适应选取高低阈值,减少人为设置阈值等因素的干扰。采用自适应阈值选取方式获得高低阈值过程如下:
(1)、将模板图像的梯度幅值图像,按梯度幅值分为L级,这里L=256,将所有分级分为三类,C
0、C
1和C
2,其中C
0为非边缘点像素梯度,梯度幅值分级[0,1,…,k-1],C
1为弱边缘点像素梯度,梯度幅值分级[k,k+1,…,m],C
2为强边缘点像素梯度,梯度幅值分级[m+1,m+2,…,L-1]。分割强弱边缘像素梯度的值(m,k)即为待求的高低阈值。
(3)、计算每一类分级的期望和,构造类内方差,由此计算最小化评价函数并求其导数,得到关于(m,k)的偏导公式,求解该公式即可得到高低阈值。
式中,μ
0(k)为第0级至第k-1级的期望和(即C
0类分级的期望和),μ
1(k,m)为第k级至第m级的期望和(即C
1类分级的期望和),μ
2(m)为第m+1级及第m+1级之后项的期望和(即C
2类分级的期望和)。
示例性的,μ
0(k)通过以下公式得到:
步骤B3、依据提取的模板边缘轮廓特征点数对模板图像进行金字塔自适应分层得到多个分层的模板图像。
参见图11,对非极大值抑制的模板图像进行自适应滞后阈值处理,并获取滞后阈值处理后模板图像的边缘轮廓后,提取模板边缘轮廓的轮廓重心、边缘轮廓点梯度及梯度幅值等边缘轮廓特征信息并存储。边缘轮廓特征信息可包括轮廓的重心位置、边缘轮廓点相对于轮廓重心的像素位置、边缘轮廓点梯度幅值以及边缘轮廓点横向梯度与纵向梯度,计算方式与前述相同。
示例性地,求取模板图像的模板边缘轮廓特征点数,如果模板边缘轮廓特征点数多于设置的最小边缘轮廓特征点数m,则对模板图像进行金字塔降采样 分层。继续求取降采样后模板图像的模板边缘轮廓特征点数,多于m则继续分层,直到达到要求,此时的层数即为金字塔的层数L,进而实现对模板图像进行金字塔自适应分层得到多个分层的模板图像。
在本实施例的一种可选方案中,可以与上述至少一个实施例中各个可选方案结合。其中,确定待搜索图像的待搜索边缘轮廓特征信息,包括步骤C1-C2。
步骤C1、依据对模板图像的金字塔分层数对待搜索图像进行金字塔分层,得到多个分层的待搜索图像。
步骤C2、从每个分层的待搜索图像中提取对应的待搜索边缘轮廓特征点,以构建每个分层的待搜索图像的待搜索边缘轮廓特征信息。
其中,待搜索边缘轮廓特征信息包括轮廓重心位置、边缘轮廓点相对于轮廓重心的像素位置、边缘轮廓点梯度幅值以及边缘轮廓点横向梯度与纵向梯度,提取对应的待搜索边缘轮廓特征点过程参考前述从模板图像中提取模板边缘轮廓特征点的过程,这里不再赘述。
图12是本申请实施例中提供的另一种图像匹配方法的流程图,本实施例的技术方案在上述实施例的基础上进行细化,本实施例的技术方案可以与上述至少一个实施例中各个可选方案结合。如图12所示,本申请实施例中提供的图像匹配方法,可以包括步骤S1210至S1270。
S1210、确定模板图像的模板边缘轮廓特征信息;模板边缘轮廓特征信息表征从模板图像提取的不同金字塔分层下的多旋转角度的模板边缘轮廓特征点。
S1220、确定待搜索图像的待搜索边缘轮廓特征信息;待搜索边缘轮廓特征信息用于表征根据模板图像的金字塔分层数,从待搜索图像提取的不同金字塔分层下的待搜索边缘轮廓特征点。
S1230、针对自上而下的金字塔分层结构,基于当前分层的轮廓匹配搜索信息,分别将当前分层的不同旋转角度的模板边缘轮廓在当前分层的待搜索边缘轮廓上遍历。
其中,轮廓匹配搜索信息包括在待搜索边缘轮廓上进行相似度匹配的待匹 配区域位置和待匹配角度范围。
参见图13,分别取当前分层的轮廓匹配搜索信息指示的待搜索边缘轮廓中待匹配区域和当前分层的轮廓匹配搜索信息指示的不同旋转角度的模板边缘轮廓作为当前分层遍历匹配的输入,将不同旋转角度的模板边缘轮廓按照预设遍历方向在待搜索边缘轮廓的待匹配区域中进行滑动遍历。参见图14,比如获取预先创建的模板边缘轮廓上每个边缘轮廓点相对于轮廓重心的坐标值,以模板边缘轮廓的轮廓重心作为滑动匹配的关键点,从待搜索边缘轮廓的左上角开始,将模板边缘轮廓在待搜索边缘轮廓对应的待匹配区域上进行滑动遍历。
这样,通过轮廓匹配搜索信息对相似度匹配的匹配区域与旋转角度进行有效控制,避免在待搜索边缘轮廓的非关键区域进行遍历以及避免使用不合适旋转角度的模板边缘轮廓进行滑动遍历,尽可能浪费滑动遍历资源以及避免产生不必要的数据计算量。
S1240、对于多个遍历位置,在每个遍历位置下逐点计算模板边缘轮廓特征点与所述模板边缘轮廓特征点对应的待搜索边缘轮廓特征点之间的单点相似度;以及,在每个遍历位置下将逐点计算的单点相似度进行累加,并在单点相似度的累加值到达预设相似度度量值时,停止在对应遍历位置进行逐点计算。
参见图4与图13,对于每一个旋转角度的模板边缘轮廓而言,当模板边缘轮廓在待搜索边缘轮廓的待匹配区域进行滑动遍历时,模板边缘轮廓可存在多个滑动遍历位置,不同旋转角度的模板边缘轮廓在当前分层的待搜索边缘轮廓上遍历时会存在更多的遍历位置。在每个遍历位置下,可依次逐个计算单个模板边缘轮廓特征点与该单个模板边缘轮廓点在待匹配区域对应的待搜索边缘轮廓特征点之间的单点相似度。
示例性地,在逐点计算模板边缘轮廓特征点与模板边缘轮廓特征点对应的待搜索边缘轮廓特征点之间相似度时,可采用的相似度度量函数如下:
上式中,n为参于计算的边缘点个数,d'
i为模板图像的模板图像边缘轮廓中某一边缘轮廓点的方向向量,e
q+p'为待搜索图像的待搜索边缘轮廓的某一边缘轮廓点的方向向量,t′
i为模板图像对应边缘轮廓点的x方向梯度,
为待搜索图像对应边缘轮廓点的x方向梯度,u′
i为模板图像对应边缘轮廓点的的y方向梯度,
为待搜索图像对应边缘轮廓点的y方向梯度。
由于相似度度量函数公式的分母对方向向量进行了归一化处理,相似性度量对于任意照明变化是具有不变性的,所有向量都被缩放为1的长度。这种相似性度量对遮挡和杂波具有鲁棒性,原因是如果一个特征缺失,无论是在模板中还是在待搜索图像中,噪声都会导致随机方向向量,平均而言,这对总和没有任何贡献,并不影响计算结果。当待搜索边缘轮廓图像和模板边缘轮廓图像对应像素点梯度相同时,上式得到的结果为1,即为完全匹配。
参见图4与图13,在逐个计算得到单点相似度后,会实时的对已经计算得到的单点相似度度量值进行累加。判断单点相似度度量值的累加和是否到达预设的最小相似度度量值Smin,如果累加和已经达到最小相似度度量值Smin,则停止在对应遍历位置进行逐点计算。这样,在进行相似度匹配时就不需将遍历位置对应全部模板边缘轮廓特征点与其在待匹配区域的全部待搜索边缘轮廓特征点进行综合计算,在非可能目标位置相似度量值可以不必完全计算,即通过 一定的阈值,采用截止条件,提前结束逐点计算,从而快速定位到真正的目标位置,节省了大量的计算量,进而加快匹配速度;并且,单点相似度度量值的累加和是针对部分模板边缘轮廓点的相似度度量,对于目标存在遮挡和隐藏的问题,采用改进的终止条件可实现,因此对遮挡场景具有很好鲁棒性。
示例性地,根据相似度量函数的计算公式可以得到部分单点相似度度量值的累积和公式为:
由归一化相似度度量公式可知,剩余n-j项的和小于(n-j)/n=1-j/n,所以当部分单点相似度度量值的累积和满足s
j<s
min-1+j/n(s
min为设定最小相似度度量值阈值),即可终止相似度量的计算。对于目标存在遮挡和隐藏的问题,通过两部分阈值来判断,第一部分采用宽松的阈值判断,剩下的部分采用严格的阈值判断,通过预先设定一个贪婪度系数g来实现。其中,对于逐点计算提前截止的最小相似度量阈值,s
j<min(s
min-1+fj/n,s
min*j/n);式中:f=(1-gs
min)/(1-s
min),当g=1时,所有的点都使用宽松的终止条件来判断。可选地,为了保证不产生误判,参数g通常可设置为0.9。
S1250、依据在每个遍历位置下停止逐点计算时的单点相似度的累加值,确定当前分层的模板边缘轮廓在当前分层的待搜索边缘轮廓上的轮廓匹配结果。
参见图13,对于不同遍历位置使用不同角度的模板边缘轮廓进行相似度匹配时,会得到一系列停止逐点计算时的单点相似度的累加值,取单点相似度的累加值最大值所对应的位置与旋转角度作为当前分层下模板边缘轮廓在待搜索边缘轮廓的轮廓匹配结果。其中,轮廓匹配结果包括模板边缘轮廓在待搜索边缘轮廓完成相似度匹配时的轮廓重心位置与旋转角度。
S1260、依据当前分层的轮廓匹配结果,确定将下一分层的模板边缘轮廓特征点与下一分层对应待搜索边缘轮廓特征点进行相似度匹配时使用的轮廓匹配搜索信息,用以跳到下一分层进行相似度匹配,直至金字塔底层。
在本实施例的一种可选方案中,可以与上述至少一个实施例中各个可选方案结合。其中,在当前分层为金字塔顶层的情况下,当前分层的轮廓匹配搜索信息包括将待搜索边缘轮廓的整个轮廓区域作为待匹配区域,以及将初始化设置的旋转角度范围作为待匹配角度范围。
参见图13,分别取金字塔顶层的待搜索边缘轮廓的全部和初始化设置的旋转角度范围对应的不同旋转角度的模板边缘轮廓作为金字塔顶层遍历匹配的输入,由于模板边缘轮廓点的位置坐标都是相对于模板边缘轮廓重心,所以金字塔顶层遍历匹配的过程中也是以模板边缘轮廓的重心在待搜索边缘轮廓整个轮廓中按照预设遍历方向移动逐点计算相似度。
在本实施例的另一种可选方案中,可以与上述至少一个实施例中各个可选方案结合。其中,在当前分层为非金字塔顶层的情况下,当前分层的轮廓匹配搜索信息根据在上一分层对应待搜索边缘轮廓中的轮廓匹配结果,按照预设匹配搜索映射方式在当前分层对应待搜索边缘轮廓进行映射确定。
参见图13,分别取当前分层的轮廓匹配搜索信息指示的待搜索边缘轮廓中待匹配区域、以及当前分层的中轮廓匹配搜索信息指示的待匹配角度范围的模板边缘轮廓作为当前分层遍历匹配的输入,由于模板边缘轮廓点的位置坐标都是相对于模板边缘轮廓重心,所以当前分层遍历匹配的过程中是以轮廓匹配搜索信息指示的待匹配角度范围的模板边缘轮廓的重心在待搜索边缘轮廓中待匹配区域中进行移动遍历计算相似度。
在本实施例的一种可选方案中,可以与上述至少一个实施例中各个可选方案结合。其中,在确定当前分层的轮廓匹配结果,可按照预设匹配搜索映射方式匹配映射确定下一分层的模板边缘轮廓在下一分层对应待搜索边缘轮廓进行相似度匹配时使用的轮廓匹配搜索信息。匹配搜索映射方式用于依据在上层对应待搜索边缘轮廓的轮廓匹配结果,映射出在下层对应待搜索边缘轮廓进行相似度匹配所使用的轮廓匹配搜索信息。
这样,基于下一层的轮廓匹配搜索信息,将下一层模板边缘轮廓在下一层 待搜索边缘轮廓上进行相似度匹配,自上而下直至在每个金字塔分层均进行相似度匹配。通过引入金字塔分层,当上层匹配到结果后通过向下层映射匹配区域,可以有效缩减下层匹配区域,从而加快在下层的匹配速度。
参见图13,匹配搜索映射方式用于从金字塔上层向下层映射确定下层轮廓匹配搜索信息。在模板边缘轮廓的轮廓重心沿着上层待搜索边缘轮廓进行遍历匹配,得到得分最高的上层匹配位置(x,y),该位置在金字塔下层的位置为(2x,2y),相应地在下层待搜索边缘轮廓的待匹配区域为:
上式中,(x',y')为下层待搜索边缘轮廓图像映射区域的左上角坐标,(x”,y”)为下层待搜索边缘轮廓图像映射区域的右下角坐标,至此,便可确定在金字塔下层的轮廓匹配搜索信息对应待匹配区域位置。
参见图13,匹配搜索映射方式还包括从金字塔上层向下层对轮廓匹配搜索信息中待匹配角度范围进行映射。由金字塔上层确定的轮廓匹配结果中包括的角度按照匹配搜索映射方式向金字塔下层映射角度范围的计算公式为:
上式为待匹配角度映射公式,angle
next_pre为下层映射起点角度,angle
next_aft为下层映射终点角度,numLevels为前述确定的对待搜索图像的金字塔分层数。
S1270、依据在金字塔底层的轮廓匹配结果,在待搜索图像中定位模板图像指示的目标形状。
依据匹配搜索映射方式将按照自上而下的金字塔,从金字塔上层到金字塔下层的轮廓匹配搜索信息的精细确定,实现自上而下有粗到精的模板边缘轮廓与待搜索边缘轮廓的相似度匹配,即可得到金字塔底层的轮廓匹配结果,也就是得到金字塔底层的模板边缘轮廓在原始待搜索图像中的匹配位置和角度,由这一匹配位置坐标和角度依次找到模板边缘轮廓对应的边缘轮廓点,并在待搜索图像中绘制出最终的目标形状轮廓。至此,完成一种具有平移、旋转、遮挡不变性的快速形状匹配。
,可选地,依据在金字塔底层的轮廓匹配结果,在待搜索图像中定位模板图像指示的目标形状之前,还包括:
在确定当前分层位于非金字塔顶层时,当前分层的轮廓匹配搜索信息中待匹配角度范围修正为:角度步长跟随金字塔层数变化,从待匹配角度范围中根据变化后的角度步长选择的多个待匹配角度,以及基于修正后的轮廓匹配搜索信息指示的待匹配角度,将当前分层的模板边缘轮廓在对应待搜索边缘轮廓上进行相似度匹配。
在确定当前分层轮廓匹配搜索信息中待匹配角度范围后,为了提高在当前分层的匹配速度,减少了角度的匹配数量,将原先在当前分层轮廓匹配搜索信息中待匹配角度范围内遍历匹配,修正为跟随金字塔层数变角度步长选择的多个待匹配角度进行匹配。角度变步长匹配策略如下:
上式中,numLevels为确定的金字塔分层数,angle
next_pre和angle
next_aft由当前分层的待匹配角度范围决定,角度步长随金字塔层数变化,当前分层的角度共需匹配三次,即angle
next_pre、angle
next_aft和angle三个角度,从而减少角度匹配数量。
可选地,分别将当前分层的不同旋转角度的模板边缘轮廓在当前分层的待搜索边缘轮廓上遍历,包括:
在确定当前分层位于非金字塔顶层时,控制当前分层的不同旋转角度的模板边缘轮廓,在当前分层对应待搜索边缘轮廓上按照当前分层的边缘轮廓点间隔数进行间隔滑动遍历。
为减少当前分层的匹配时间,在保证上一分层匹配的边缘轮廓点数量不变的情况下,对当前分层的边缘轮廓点在匹配时间隔一定像素进行访问,从而达到减少匹配点数提高匹配速度的效果。保证下层边缘轮廓点数在100个点,需要获得当前分层的模板边缘轮廓点的总点数(P
total),当前分层的边缘轮廓点遍历匹配时的间隔点数为:P
delete_num=P
total/100,式中,P
total为当前分层的模板边缘轮廓总点数,P
delete_num为当前分层用于匹配计算的边缘轮廓点间隔数。通过对非金字塔顶层的边缘轮廓点删减策略可有效减少信息冗余和计算复杂度。
对本申请提出的图像匹配方案进行测试,从Halcon测试库中选择四种特征各不相同的图像,分别为:轮廓明显图“rings.png”、含有背景干扰“green-dot.png”、含有微小形变“metal-parts.png”以及轮廓不明显图“20cent_german.png”作为待测图像进行匹配测试,其测试结果参见图15。
不难看出,本申请所提出的方法能够解决待测目标平移、旋转及部分遮挡的问题。以“green-dot.png”图像为例,匹配结果显示如图16所示。选取“rings.png”以及“green-dot.png”两幅图像在平移、旋转、遮挡情况下的运行时间,测试结果参见图17。由表中数据可知,本申请方案能解决算法耗时较长的问题,较普通边缘形状匹配算法的计算速度至少可提升一个数量级。
根据本申请实施例中提供的图像匹配方法,通过对模板图像进行金字塔分层多角度的模板图像创建来提取模板边缘轮廓特征,创建多层多角度的模板边缘轮廓特征信息,使模板边缘轮廓特征不受图像灰度信息变化的影响,保证基于边缘形状匹配适应不同的光照变化,并且在平移及旋转的定位任务中,且对 于部分遮挡的情况仍然可准确匹配到目标;同时考虑到模板边缘轮廓特征信息的数据结构构建复杂,匹配过程中需要较长时间,通过使用分层的模板边缘轮廓特征从金字塔分层自上而下逐层映射进行相似度匹配,综合运用金字塔在多个分层实现由粗到精的相似度匹配的性能提升策略,降低金字塔下层的模板边缘轮廓特征匹配数据量,解决特征点匹配算法复杂度过高的问题,在保证匹配精度的前提下有效提升匹配速度且适用于存在平移旋转以及遮挡的应用场景。
图18是本申请实施例中提供的一种图像匹配装置的结构框图。本实施例的技术方案可适用于对图像间的形状进行匹配的情况,该装置可以采用软件和/或硬件的方式实现,并集成在任何具有网络通信功能的电子设备上。如图18所示,本申请实施例中的图像匹配装置,包括以下:模板信息确定模块1810、待搜索信息确定模块1820、相似度匹配模块1830、下层映射匹配模块1840以及待搜索图像识别模块1850。其中:
模板信息确定模块1810,设置为确定模板图像的模板边缘轮廓特征信息;所述模板边缘轮廓特征信息用于表征从模板图像提取的不同金字塔分层下的多旋转角度的模板边缘轮廓特征点;
待搜索信息确定模块1820,设置为确定待搜索图像的待搜索边缘轮廓特征信息;所述待搜索边缘轮廓特征信息用于表征根据所述模板图像的金字塔分层数,从所述待搜索图像提取的不同金字塔分层下的待搜索边缘轮廓特征点;
相似度匹配模块1830,设置为针对自上而下的金字塔分层结构,基于当前分层的轮廓匹配搜索信息,依据当前分层的模板边缘轮廓特征点与所述当前分层的模板边缘轮廓特征点对应的待搜索边缘轮廓特征点进行相似度匹配,得到当前分层的轮廓匹配结果;
下层映射匹配模块1840,设置为依据当前分层的轮廓匹配结果,确定将下一分层的模板边缘轮廓特征点与下一分层对应待搜索边缘轮廓特征点进行相似度匹配时使用的轮廓匹配搜索信息,用以跳到下一分层进行相似度匹配,直至金字塔底层;
待搜索图像识别模块1850,设置为依据在金字塔底层的轮廓匹配结果,在所述待搜索图像中定位模板图像指示的目标形状;
其中,所述轮廓匹配搜索信息包括在待搜索边缘轮廓上进行相似度匹配的待匹配区域位置和待匹配角度范围;所述轮廓匹配结果包括模板边缘轮廓在待搜索边缘轮廓完成相似度匹配时的轮廓重心位置与旋转角度。
可选地,模板信息确定模块1810是设置为:
对模板图像进行金字塔自适应分层得到多个分层的模板图像,并对每个分层的模板图像进行多旋转角度配置;
提取每个分层的多旋转角度的模板图像对应的模板边缘轮廓特征点,以构建模板图像多分层多旋转角度的模板边缘轮廓特征信息;
其中,所述模板边缘轮廓特征信息包括轮廓重心位置、边缘轮廓点相对于轮廓重心的像素位置、边缘轮廓点梯度幅值以及边缘轮廓点梯度方向。
可选地,对模板图像进行金字塔自适应分层得到多个分层的模板图像,包括:
依据模板图像的梯度幅值与梯度方向,对模板图像中像素点进行非极大值抑制处理,得到非极大值抑制的模板图像;
对非极大值抑制的模板图像进行自适应滞后阈值处理,以对非极大值抑制处理的模板图像进行边缘划分得到模板边缘轮廓特征点;
依据提取的模板边缘轮廓特征点数对模板图像进行金字塔自适应分层得到多个分层的模板图像。
可选地,待搜索信息确定模块1820是设置为:
依据对所述模板图像的金字塔分层数对待搜索图像进行金字塔分层,得到多个分层的待搜索图像;
从每个分层的待搜索图像中提取对应的待搜索边缘轮廓特征点,以构建所述每个分层的待搜索图像的待搜索边缘轮廓特征信息;
其中,所述待搜索边缘轮廓特征信息包括轮廓重心位置、边缘轮廓点相对 于轮廓重心的像素位置、边缘轮廓点梯度幅值以及边缘轮廓点横向梯度与纵向梯度。
可选地,相似度匹配模块1830包括:
分别将当前分层的不同旋转角度的模板边缘轮廓在当前分层的待搜索边缘轮廓上遍历;
对于多个遍历位置,在每个遍历位置下逐点计算模板边缘轮廓特征点与所述模板边缘轮廓特征点对应的待搜索边缘轮廓特征点之间的单点相似度;以及,在每个遍历位置下将逐点计算的单点相似度进行累加,并在单点相似度的累加值到达预设相似度度量值时,停止计算;
依据在每个遍历位置下停止逐点计算时的单点相似度的累加值,确定当前分层的模板边缘轮廓在当前分层的待搜索边缘轮廓上的轮廓匹配结果。
可选地,在所述当前分层为金字塔顶层的情况下,当前分层的轮廓匹配搜索信息包括将待搜索边缘轮廓的整个轮廓区域作为待匹配区域,以及将初始化设置的旋转角度范围分别作为待匹配角度范围;
在所述当前分层为非金字塔顶层的情况下,当前分层的轮廓匹配搜索信息根据在上一分层对应待搜索边缘轮廓中的轮廓匹配结果,按照预设匹配搜索映射方式在当前分层对应待搜索边缘轮廓进行映射确定。
可选地,所述匹配搜索映射方式用于依据在上层对应待搜索边缘轮廓的轮廓匹配结果,映射出在下层对应待搜索边缘轮廓进行相似度匹配所使用的轮廓匹配搜索信息。
可选地,在确定所述当前分层位于非金字塔顶层时,当前分层的轮廓匹配搜索信息中待匹配角度范围修正为:角度步长跟随金字塔层数变化,从待匹配角度范围中根据变化后的角度步长选择的多个待匹配角度。
可选地,分别将当前分层的不同旋转角度的模板边缘轮廓在当前分层的待搜索边缘轮廓上遍历,包括:
在确定所述当前分层位于非金字塔顶层时,控制当前分层的不同旋转角度 的模板边缘轮廓,在当前分层对应待搜索边缘轮廓上按照当前分层的边缘轮廓点间隔数进行间隔滑动遍历。
本申请实施例中所提供的图像匹配装置可执行上述本申请任意实施例中所提供的图像匹配方法,具备执行该图像匹配方法相应的功能,未在上述实施例中详尽描述的技术细节,可参见本申请任意实施例中所提供的图像匹配方法。
图19是本申请实施例中提供的一种电子设备的结构示意图。如图19所示结构,本申请实施例中提供的电子设备包括:至少一个处理器1910和存储装置1920;该电子设备中的处理器1910可以是至少一个,图19中以一个处理器1910为例;存储装置1920设置为存储至少一个程序;所述至少一个程序被所述至少一个处理器1910执行,使得所述至少一个处理器1910实现如本申请实施例中任一项所述的图像匹配方法。
该电子设备还可以包括:输入装置1930和输出装置1940。
该电子设备中的处理器1910、存储装置1920、输入装置1930和输出装置1940可以通过总线或其他方式连接,图19中以通过总线连接为例。
该电子设备中的存储装置1920作为一种计算机可读存储介质,可设置为存储至少一个程序,所述程序可以是软件程序、计算机可执行程序以及模块,如本申请实施例中所提供的图像匹配方法对应的程序指令/模块。处理器1910通过运行存储在存储装置1920中的软件程序、指令以及模块,从而执行电子设备的各种功能应用以及数据处理,即实现上述方法实施例中图像匹配方法。
存储装置1920可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据电子设备的使用所创建的数据等。此外,存储装置1920可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储装置1920可包括相对于处理器1910远程设置的存储器,这些远程存储器可以通过网络连接至设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
输入装置1930可设置为接收输入的数字或字符信息,以及产生与电子设备的用户设置以及功能控制有关的键信号输入。输出装置1940可包括显示屏等显示设备。
并且,当上述电子设备所包括至少一个程序被所述至少一个处理器1910执行时,程序进行如下操作:
确定模板图像的模板边缘轮廓特征信息;所述模板边缘轮廓特征信息用于表征从模板图像提取的不同金字塔分层下的多旋转角度的模板边缘轮廓特征点;
确定待搜索图像的待搜索边缘轮廓特征信息;所述待搜索边缘轮廓特征信息用于表征根据所述模板图像的金字塔分层数,从所述待搜索图像提取的不同金字塔分层下的待搜索边缘轮廓特征点;
针对自上而下的金字塔分层结构,基于当前分层的轮廓匹配搜索信息,依据当前分层的模板边缘轮廓特征点与所述当前分层的模板边缘轮廓特征点对应的待搜索边缘轮廓特征点进行相似度匹配,得到当前分层的轮廓匹配结果;
依据当前分层的轮廓匹配结果,确定将下一分层的模板边缘轮廓特征点与下一分层对应待搜索边缘轮廓特征点进行相似度匹配时使用的轮廓匹配搜索信息,用以跳到下一分层进行相似度匹配,直至金字塔底层;
依据在金字塔底层的轮廓匹配结果,在所述待搜索图像中定位模板图像指示的目标形状;
其中,所述轮廓匹配搜索信息包括在待搜索边缘轮廓上进行相似度匹配的待匹配区域位置和待匹配角度范围;所述轮廓匹配结果包括模板边缘轮廓在待搜索边缘轮廓完成相似度匹配时的轮廓重心位置与旋转角度。
当然,本领域技术人员可以理解,当上述电子设备所包括的至少一个程序被所述至少一个处理器1910执行时,程序还可以进行本申请任意实施例中所提供的图像匹配方法中的相关操作。
本申请实施例中提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时用于执行图像匹配方法,该方法包括:
确定模板图像的模板边缘轮廓特征信息;所述模板边缘轮廓特征信息用于表征从模板图像提取的不同金字塔分层下的多旋转角度的模板边缘轮廓特征点;
确定待搜索图像的待搜索边缘轮廓特征信息;所述待搜索边缘轮廓特征信息用于表征根据所述模板图像的金字塔分层数,从所述待搜索图像提取的不同金字塔分层下的待搜索边缘轮廓特征点;
针对自上而下的金字塔分层结构,基于当前分层的轮廓匹配搜索信息,依据当前分层的模板边缘轮廓特征点与所述当前分层的模板边缘轮廓特征点对应的待搜索边缘轮廓特征点进行相似度匹配,得到当前分层的轮廓匹配结果;
依据当前分层的轮廓匹配结果,确定将下一分层的模板边缘轮廓特征点与下一分层对应待搜索边缘轮廓特征点进行相似度匹配时使用的轮廓匹配搜索信息,用以跳到下一分层进行相似度匹配,直至金字塔底层;
依据在金字塔底层的轮廓匹配结果,在所述待搜索图像中定位模板图像指示的目标形状;
其中,所述轮廓匹配搜索信息包括在待搜索边缘轮廓上进行相似度匹配的待匹配区域位置和待匹配角度范围;所述轮廓匹配结果包括模板边缘轮廓在待搜索边缘轮廓完成相似度匹配时的轮廓重心位置与旋转角度。
可选的,该计算机程序被处理器执行时还可以用于执行本申请任意实施例中所提供的图像匹配方法。
本申请实施例的计算机存储介质,可以采用至少一个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有至少一个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(Random Access Memory,RAM)、只读存储器(Read Only Memory,ROM)、可擦式可编程只读存储器(Erasable Programmable Read Only Memory,EPROM)、闪存、光纤、便携式CD-ROM、 光存储器件、磁存储器件、或者上述的任意合适的组合。计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于:电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、无线电频率(RadioFrequency,RF)等等,或者上述的任意合适的组合。
可以以一种或多种程序设计语言或其组合来编写用于执行本申请操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(Local Area Network,LAN)或广域网(Wide Area Network,WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本申请的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施例或示例 中以合适的方式结合。
Claims (12)
- 一种图像匹配方法,包括:确定模板图像的模板边缘轮廓特征信息;所述模板边缘轮廓特征信息用于表征从模板图像提取的不同金字塔分层下的多旋转角度的模板边缘轮廓特征点;确定待搜索图像的待搜索边缘轮廓特征信息;所述待搜索边缘轮廓特征信息用于表征根据所述模板图像的金字塔分层数,从所述待搜索图像提取的不同金字塔分层下的待搜索边缘轮廓特征点;针对自上而下的金字塔分层结构,基于当前分层的轮廓匹配搜索信息,依据当前分层的模板边缘轮廓特征点与所述当前分层的模板边缘轮廓特征点对应的待搜索边缘轮廓特征点进行相似度匹配,得到当前分层的轮廓匹配结果;依据当前分层的轮廓匹配结果,确定将下一分层的模板边缘轮廓特征点与下一分层对应待搜索边缘轮廓特征点进行相似度匹配时使用的轮廓匹配搜索信息,用以跳到下一分层进行相似度匹配,直至金字塔底层;依据在金字塔底层的轮廓匹配结果,在所述待搜索图像中定位模板图像指示的目标形状;其中,所述轮廓匹配搜索信息包括在待搜索边缘轮廓上进行相似度匹配的待匹配区域位置和待匹配角度范围;所述轮廓匹配结果包括模板边缘轮廓在待搜索边缘轮廓完成相似度匹配时的轮廓重心位置与旋转角度。
- 根据权利要求1所述的方法,其中,确定模板图像的模板边缘轮廓特征信息,包括:对模板图像进行金字塔自适应分层得到多个分层的模板图像,并对每个分层的模板图像进行多旋转角度配置;提取每个分层的多旋转角度的模板图像对应的模板边缘轮廓特征点,以构建模板图像多分层多旋转角度的模板边缘轮廓特征信息;其中,所述模板边缘轮廓特征信息包括轮廓重心位置、边缘轮廓点相对于轮廓重心的像素位置、边缘轮廓点梯度幅值以及边缘轮廓点梯度方向。
- 根据权利要求2所述的方法,其中,对模板图像进行金字塔自适应分 层得到多个分层的模板图像,包括:依据模板图像的梯度幅值与梯度方向,对模板图像中像素点进行非极大值抑制处理,得到非极大值抑制的模板图像;对非极大值抑制的模板图像进行自适应滞后阈值处理,以对非极大值抑制处理的模板图像进行边缘划分得到模板边缘轮廓特征点;依据提取得到的模板边缘轮廓特征点数对模板图像进行金字塔自适应分层得到多个分层的模板图像。
- 根据权利要求1所述的方法,其中,确定待搜索图像的待搜索边缘轮廓特征信息,包括:依据对所述模板图像的金字塔分层数对待搜索图像进行金字塔分层,得到多个分层的待搜索图像;从每个分层的待搜索图像中提取对应的待搜索边缘轮廓特征点,以构建所述每个分层的待搜索图像的待搜索边缘轮廓特征信息;其中,所述待搜索边缘轮廓特征信息包括轮廓重心位置、边缘轮廓点相对于轮廓重心的像素位置、边缘轮廓点梯度幅值以及边缘轮廓点横向梯度与纵向梯度。
- 根据权利要求1所述的方法,其中,依据当前分层的模板边缘轮廓特征点与所述当前分层的模板边缘轮廓特征点对应的待搜索边缘轮廓特征点进行相似度匹配,得到当前分层的轮廓匹配结果,包括:分别将当前分层的不同旋转角度的模板边缘轮廓在当前分层的待搜索边缘轮廓上遍历;对于多个遍历位置,在每个遍历位置下逐点计算模板边缘轮廓特征点与所述模板边缘轮廓特征点对应的待搜索边缘轮廓特征点之间的单点相似度;以及,在每个遍历位置下将逐点计算的单点相似度进行累加,并在单点相似度的累加值到达预设相似度度量值时,停止计算;依据在每个遍历位置下停止逐点计算时的单点相似度的累加值,确定当前 分层的模板边缘轮廓在当前分层的待搜索边缘轮廓上的轮廓匹配结果。
- 根据权利要求5所述的方法,其中,在所述当前分层为金字塔顶层的情况下,当前分层的轮廓匹配搜索信息包括将待搜索边缘轮廓的整个轮廓区域作为待匹配区域,以及将初始化设置的旋转角度范围分别作为待匹配角度范围;在所述当前分层为非金字塔顶层的情况下,当前分层的轮廓匹配搜索信息根据在上一分层对应待搜索边缘轮廓中的轮廓匹配结果,按照预设匹配搜索映射方式在当前分层对应待搜索边缘轮廓进行映射确定。
- 根据权利要求6所述的方法,其中,所述匹配搜索映射方式用于依据上层对应待搜索边缘轮廓的轮廓匹配结果,映射出下层对应待搜索边缘轮廓进行相似度匹配所使用的轮廓匹配搜索信息。
- 根据权利要求1所述的方法,其中,在确定所述当前分层位于非金字塔顶层的情况下,当前分层的轮廓匹配搜索信息中待匹配角度范围修正为:角度步长跟随金字塔层数变化,从待匹配角度范围中根据变化后的角度步长选择的多个待匹配角度。
- 根据权利要求5所述的方法,其中,,分别将当前分层的不同旋转角度的模板边缘轮廓在当前分层的待搜索边缘轮廓上遍历,包括:在确定所述当前分层位于非金字塔顶层的情况下,控制当前分层的不同旋转角度的模板边缘轮廓,在当前分层对应待搜索边缘轮廓上按照当前分层的边缘轮廓点间隔数进行间隔滑动遍历。
- 一种图像匹配装置,包括:模板信息确定模块,设置为确定模板图像的模板边缘轮廓特征信息;所述模板边缘轮廓特征信息用于表征从模板图像提取的不同金字塔分层下的多旋转角度的模板边缘轮廓特征点;待搜索信息确定模块,设置为确定待搜索图像的待搜索边缘轮廓特征信息;所述待搜索边缘轮廓特征信息用于表征根据所述模板图像的金字塔分层数,从 所述待搜索图像提取的不同金字塔分层下的待搜索边缘轮廓特征点;相似度匹配模块,设置为针对自上而下的金字塔分层结构,基于当前分层的轮廓匹配搜索信息,依据当前分层的模板边缘轮廓特征点与所述当前分层的模板边缘轮廓特征点对应的待搜索边缘轮廓特征点进行相似度匹配,得到当前分层的轮廓匹配结果;下层映射匹配模块,设置为依据当前分层的轮廓匹配结果,确定将下一分层的模板边缘轮廓特征点与下一分层对应待搜索边缘轮廓特征点进行相似度匹配时使用的轮廓匹配搜索信息,用以跳到下一分层进行相似度匹配,直至金字塔底层;待搜索图像识别模块,设置为依据在金字塔底层的轮廓匹配结果,在所述待搜索图像中定位模板图像指示的目标形状;其中,所述轮廓匹配搜索信息包括在待搜索边缘轮廓上进行相似度匹配的待匹配区域位置和待匹配角度范围;所述轮廓匹配结果包括模板边缘轮廓在待搜索边缘轮廓完成相似度匹配时的轮廓重心位置与旋转角度。
- 一种电子设备,包括:至少一个处理装置;存储装置,设置为存储至少一个程序;当所述至少一个程序被所述至少一个处理装置执行,使得所述至少一个处理装置实现权利要求1-9中任一项所述的图像匹配方法。
- 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理装置执行时实现权利要求1-9中任一项所述的图像匹配方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110208903.9A CN112861983A (zh) | 2021-02-24 | 2021-02-24 | 图像匹配方法、装置、电子设备以及存储介质 |
CN202110208903.9 | 2021-02-24 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022179002A1 true WO2022179002A1 (zh) | 2022-09-01 |
Family
ID=75991266
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/098000 WO2022179002A1 (zh) | 2021-02-24 | 2021-06-02 | 图像匹配方法、装置、电子设备以及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112861983A (zh) |
WO (1) | WO2022179002A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117351794A (zh) * | 2023-10-13 | 2024-01-05 | 浙江上国教育科技有限公司 | 基于云平台的在线课程管理系统 |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112861983A (zh) * | 2021-02-24 | 2021-05-28 | 广东拓斯达科技股份有限公司 | 图像匹配方法、装置、电子设备以及存储介质 |
CN113569876A (zh) * | 2021-08-31 | 2021-10-29 | 东软睿驰汽车技术(沈阳)有限公司 | 图像特征提取方法、装置和电子设备 |
CN114119443B (zh) * | 2021-11-28 | 2022-07-01 | 特斯联科技集团有限公司 | 一种基于多光谱相机的图像融合系统 |
CN114898128A (zh) * | 2022-04-21 | 2022-08-12 | 东声(苏州)智能科技有限公司 | 图像相似度比对方法、存储介质和计算机 |
CN117036753B (zh) * | 2023-07-18 | 2024-06-21 | 北京观微科技有限公司 | 一种基于模板匹配和InfoGAN的SAR图像扩容方法 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120082385A1 (en) * | 2010-09-30 | 2012-04-05 | Sharp Laboratories Of America, Inc. | Edge based template matching |
CN102654902A (zh) * | 2012-01-16 | 2012-09-05 | 江南大学 | 基于轮廓向量特征的嵌入式实时图像匹配方法 |
CN105261012A (zh) * | 2015-09-25 | 2016-01-20 | 上海瑞伯德智能系统科技有限公司 | 基于Sobel向量的模板匹配方法 |
CN107671896A (zh) * | 2017-05-19 | 2018-02-09 | 重庆誉鸣科技有限公司 | 基于scara机器人的快速视觉定位方法及系统 |
CN109801318A (zh) * | 2019-01-30 | 2019-05-24 | 东北大学 | 一种快速物体匹配算法 |
CN112861983A (zh) * | 2021-02-24 | 2021-05-28 | 广东拓斯达科技股份有限公司 | 图像匹配方法、装置、电子设备以及存储介质 |
-
2021
- 2021-02-24 CN CN202110208903.9A patent/CN112861983A/zh active Pending
- 2021-06-02 WO PCT/CN2021/098000 patent/WO2022179002A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120082385A1 (en) * | 2010-09-30 | 2012-04-05 | Sharp Laboratories Of America, Inc. | Edge based template matching |
CN102654902A (zh) * | 2012-01-16 | 2012-09-05 | 江南大学 | 基于轮廓向量特征的嵌入式实时图像匹配方法 |
CN105261012A (zh) * | 2015-09-25 | 2016-01-20 | 上海瑞伯德智能系统科技有限公司 | 基于Sobel向量的模板匹配方法 |
CN107671896A (zh) * | 2017-05-19 | 2018-02-09 | 重庆誉鸣科技有限公司 | 基于scara机器人的快速视觉定位方法及系统 |
CN109801318A (zh) * | 2019-01-30 | 2019-05-24 | 东北大学 | 一种快速物体匹配算法 |
CN112861983A (zh) * | 2021-02-24 | 2021-05-28 | 广东拓斯达科技股份有限公司 | 图像匹配方法、装置、电子设备以及存储介质 |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117351794A (zh) * | 2023-10-13 | 2024-01-05 | 浙江上国教育科技有限公司 | 基于云平台的在线课程管理系统 |
CN117351794B (zh) * | 2023-10-13 | 2024-06-04 | 浙江上国教育科技有限公司 | 基于云平台的在线课程管理系统 |
Also Published As
Publication number | Publication date |
---|---|
CN112861983A (zh) | 2021-05-28 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022179002A1 (zh) | 图像匹配方法、装置、电子设备以及存储介质 | |
CN111795704B (zh) | 一种视觉点云地图的构建方法、装置 | |
CN109146948B (zh) | 基于视觉的作物长势表型参数量化与产量相关性分析方法 | |
JP4785880B2 (ja) | 三次元オブジェクト認識のためのシステムおよび方法 | |
CN110688947B (zh) | 一种同步实现人脸三维点云特征点定位和人脸分割的方法 | |
US9311756B2 (en) | Image group processing and visualization | |
CN102834845A (zh) | 用于多摄像装置校准的方法与装置 | |
CN111476251A (zh) | 一种遥感影像匹配方法及装置 | |
CN108022262A (zh) | 一种基于点的邻域重心向量特征的点云配准方法 | |
WO2022205605A1 (zh) | 图像边缘特征库构建方法、装置、计算机设备及存储介质 | |
CN113111212A (zh) | 一种图像匹配方法、装置、设备及存储介质 | |
KR101032446B1 (ko) | 영상의 정점 검출 장치 및 방법 | |
CN112085033A (zh) | 一种模板匹配方法、装置、电子设备及存储介质 | |
CN116452644A (zh) | 基于特征描述子的三维点云配准方法、装置及存储介质 | |
Guo et al. | 3D object recognition from cluttered and occluded scenes with a compact local feature | |
CN113159103B (zh) | 图像匹配方法、装置、电子设备以及存储介质 | |
CN112419372A (zh) | 图像处理方法、装置、电子设备及存储介质 | |
CN109344846B (zh) | 图像特征提取方法和装置 | |
Jisen | A study on target recognition algorithm based on 3D point cloud and feature fusion | |
CN117745780A (zh) | 一种基于孤立簇去除的室外大场景3d点云配准方法 | |
CN113570667B (zh) | 视觉惯导补偿方法、装置及存储介质 | |
CN113723424B (zh) | 一种目标检测方法及装置、设备、存储介质 | |
CN114926488A (zh) | 基于广义Hough模型和改进金字塔搜索加速的工件定位方法 | |
Sales et al. | 3D shape descriptor for objects recognition | |
Heimann et al. | Joint Geometry and Attribute Upsampling of Point Clouds Using Frequency-Selective Models with Overlapped Support |
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: 21927434 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: 21927434 Country of ref document: EP Kind code of ref document: A1 |