Log-Polar transform-based image fast matching algorithm

文档序号:1599712 发布日期:2020-01-07 浏览:17次 中文

阅读说明:本技术 一种基于Log-Polar变换的图像快速匹配算法 (Log-Polar transform-based image fast matching algorithm ) 是由 曹玲 于 2019-08-26 设计创作,主要内容包括:本发明属于机器视觉技术领域,具体涉及一种基于Log-Polar变换的图像快速匹配算法,包括以下步骤:S1、对模板图像和目标图像分别进行图像金字塔分解,得到一系列由金字塔底部到顶部分辨率逐步降低的模板和原图,其中,最大分辨率的图像称为底层图像,最小分辨率的图像简称为顶层图像;S2、分别对模板图像的金字塔顶层图像、目标图像的金字塔顶层图像进行Log-Polar变换;S3、计算出模板图形的灰度均值,灰度积分,灰度平方的积分值。该算法利用Log-Polar变换来解决笛卡尔坐标系中的尺度和旋转问题,再利用NCC实现图像的快速匹配。(The invention belongs to the technical field of machine vision, and particularly relates to an image fast matching algorithm based on Log-Polar transformation, which comprises the following steps: s1, carrying out image pyramid decomposition on the template image and the target image respectively to obtain a series of templates and original images with gradually reduced resolution from the bottom to the top of the pyramid, wherein the image with the maximum resolution is called as a bottom image, and the image with the minimum resolution is called as a top image for short; s2, respectively carrying out Log-Polar transformation on the pyramid top-level image of the template image and the pyramid top-level image of the target image; and S3, calculating the gray average value, the gray integral and the gray square integral of the template graph. The algorithm solves the problems of scale and rotation in a Cartesian coordinate system by using Log-Polar transformation, and then realizes the rapid matching of images by using NCC.)

1. An image fast matching algorithm based on Log-Polar transform, characterized by comprising the following steps:

s1, carrying out image pyramid decomposition on the template image and the target image respectively to obtain a series of templates and original images with gradually reduced resolution from the bottom to the top of the pyramid, wherein the image with the maximum resolution is called as a bottom image, and the image with the minimum resolution is called as a top image for short;

s2, respectively carrying out Log-Polar transformation on the pyramid top-level image of the template image and the pyramid top-level image of the target image;

s3, calculating the gray average value, the gray integral and the gray square integral of the top template graph;

s4, performing global traversal on the top target image, calculating the gray variance of the top target image, wherein if the gray variance of the target position is lower than a certain threshold, the position does not participate in the calculation of the similarity, if the gray variance meets the requirement, the position and the Normalized Cross Correlation (NCC) coefficient of the top template graph are calculated, if the numerical value is larger, the similarity is higher, and then the information of the target position, the scale, the angle and the like is determined by utilizing non-maximum value inhibition;

s5, projecting the target position obtained from the top layer of the target image to the next layer, and repeating the step S4 on the target position, the scale, the angle and a certain dynamic range in the layer until the bottom layer;

and S6, carrying out iterative search at the target position of the bottommost layer until the similarity converges to a local extreme value or the iteration number reaches a specified value, and finally carrying out fitting to obtain a high-precision result.

2. The Log-Polar transform-based image fast matching algorithm according to claim 1, wherein in step S2, the Log-Polar transform is Log operated based on Polar transform, assuming (x, y) corresponds to Polar(r, θ) in the ar coordinate system, corresponding to (Log-r, θ) in the Log-polar coordinate system, r denotes (x) from the center pointc,yc) The distance to point (x, y), θ being an angle, satisfies the following relation:

Figure FDA0002179795500000011

Figure FDA0002179795500000021

Figure FDA0002179795500000022

where base is the base of the Log transform.

3. The Log-Polar transform based image fast matching algorithm of claim 2, wherein: (x ', y') corresponds to (Log-r ', θ') in the Log-polar coordinate system, and (x ', y') is the coordinate of (x, y) after transformation by the scale s and rotation by the angle α, that is, the relation is satisfied:

4. the Log-Polar transform-based image fast matching algorithm according to claim 3, wherein when x isc=ycWhen x is 0, r cos θ, y is r sin θ, and substituting (4) into (2) includes:

Figure FDA0002179795500000024

when (4) is substituted into (3), there are

Figure FDA0002179795500000025

As can be seen from the equations (5) and (6), the scale change and the rotation change of the image are represented as translation along the Log-r axis and the theta axis in the Log-Polar coordinate system.

5. The Log-Polar transform-based image fast matching algorithm according to claim 1, wherein in step S4, for template I1(x, y) and Source map I2(x, y) whose normalized cross-correlation coefficient, NCC, is defined as:

Figure FDA0002179795500000031

wherein w and h are the width and height of the template image;

Figure FDA0002179795500000032

is a source diagram I2Grayscale mean of (x, y).

6. The Log-Polar transform-based image fast matching algorithm according to claim 5, characterized in that integral images s (x, y) and s are introduced for simplifying the computation of denominator2(x, y) satisfying:

s(x,y)=I(x,y)+s(x-1,y)+s(x,y-1)-s(x-1,y-1) (8)

in a similar manner to that described above,

s2(x,y)=I2(x,y)+s2(x-1,y)+s2(x,y-1)-s2(x-1,y-1) (9)

is unfolded

Figure FDA0002179795500000034

the denominator of NCC is calculated using the formula of integral image.

7. The Log-Polar transform-based image fast matching algorithm according to claim 5, wherein the optimization molecule:

wherein

Figure FDA0002179795500000037

8. The Log-Polar transform-based image fast matching algorithm of claim 1, wherein: in step S6, the fitting manner is sub-pixel fitting.

Technical Field

The invention belongs to the technical field of machine vision, and particularly relates to an image fast matching algorithm based on Log-Polar transformation.

Background

Machine vision is to use a machine to replace human eyes for measurement and judgment. The target information is picked up by a specific device and converted into an image signal, the image signal is transmitted to a special image processing system, various operations are carried out to extract the characteristics of the target according to the information of pixel distribution, brightness, color and the like, and the results of measurement, judgment and identification are given according to the characteristics.

In machine vision, image positioning is a basic problem in the field of image processing, and in aspects of robot positioning and grabbing, image splicing, target identification and positioning, product quality detection and the like, an image matching algorithm is an important technology in image positioning. In the past decades, a large number of image matching algorithms have been proposed by researchers, such as gray-scale-based, or mutual information, or local descriptor methods, among others, wherein the gray-scale-based methods are commonly known as Sum of Absolute Differences (SAD) or Sum of Squares Differences (SSD) of all Differences between images and (normalized Cross Correlation, NCC), wherein the SAD and SSD calculation speed is fast, but the case of varying illumination cannot be used; NCC has illumination invariance, but is computationally expensive; the mutual information is a concept in the information theory, does not need the gray relation of two images, does not need the preprocessing of the images, and is mainly applied to medical images and remote sensing images from the statistical information of the images; local descriptors such as SIFT features and Shapecontext have invariance to scale and rotation changes, but are sensitive to noise; thus, high precision and deformation fast image matching algorithms remain the focus of research so far. In a cartesian coordinate system, in order to accurately position a target, a large number of scale and angle transformations need to be performed, each corresponding transformation also needs to correspond to one translation search, which includes a large number of calculations, and the algorithm is inefficient and needs to be improved urgently.

Disclosure of Invention

The invention aims to: an image fast matching algorithm based on Log-Polar transformation is provided, the Log-Polar transformation is utilized to solve the problems of scale and rotation between a template image and a target image, and then NCC is utilized to realize fast matching of the images.

In order to achieve the purpose, the invention adopts the following technical scheme:

an image fast matching algorithm based on Log-Polar transform,

the method comprises the following steps:

s1, carrying out image pyramid decomposition on the template image and the target image respectively to obtain a series of templates and original images with gradually reduced resolution from the bottom to the top of the pyramid, wherein the image with the maximum resolution is called as a bottom image, and the image with the minimum resolution is called as a top image for short;

s2, respectively carrying out Log-Polar transformation on the pyramid top-level image of the template image and the pyramid top-level image of the target image;

s3, calculating the gray average value, the gray integral and the gray square integral value of the template graph;

s4, performing global traversal on the top-level target image, wherein if the gray variance of the target position is lower than a certain threshold, the position does not participate in the calculation of the similarity, if the gray variance meets the requirement, the NCC coefficient is calculated, if the numerical value is larger, the similarity is higher, and then the information such as position, scale, angle and the like is restrained and determined by using a non-maximum value;

s5, repeating the calculation of similarity of the target position, the scale, the angle and a certain dynamic range until the level is 0;

and S6, carrying out iterative search until the similarity converges to a local extreme value or the iteration number reaches a specified value, and finally carrying out fitting to obtain a high-precision result.

As an improvement of the Log-Polar transform-based image fast matching algorithm of the present invention, in step S2, the Log-Polar transform is Log-operated based on Polar transform as its name implies, and it is assumed that (x, y) corresponds to (r, θ) in Polar coordinate system and (Log-r, θ) in Log-Polar coordinate system, and r represents (x-Polar coordinate system) from the center point (r, θ), where r representsc,yc) The distance to point (x, y), θ being an angle, satisfies the following relation:

Figure BDA0002179795510000031

Figure BDA0002179795510000032

Figure BDA0002179795510000033

where base is the base of the Log transform.

As an improvement of the Log-Polar transform-based image fast matching algorithm of the present invention, (x ', y') corresponds to (Log-r ', θ') in the Log-Polar coordinate system, and (x ', y') is the coordinate after (x, y) is transformed by the scale s and rotated by the angle α, that is, the relationship is satisfied:

as an improvement of the Log-Polar transform-based image fast matching algorithm of the invention, when x isc=ycWhen x is 0, r cos θ, y is r sin θ, and substituting (4) into (2) includes:

when (4) is substituted into (3), there are

Figure BDA0002179795510000036

As can be seen from the equations (5) and (6), the scale change and the rotation change of the image are represented as translation along the Log-r axis and the theta axis in the Log-Polar coordinate system.

As an improvement of the Log-Polar transform-based image fast matching algorithm of the present invention, in step S4, for the template I1(x, y) and Source map I2(x, y) whose normalized cross-correlation coefficients are defined as:

wherein w and h are the width and height of the template image;

Figure BDA0002179795510000042

as a template I1A gray scale mean of (x, y);

is a source diagram I2Grayscale mean of (x, y).

As an improvement of the Log-Polar transform-based image fast matching algorithm, in order to simplify the calculation of denominator, integral images s (x, y) and s (x, y) are introduced2(x, y) satisfying:

s(x,y)=I(x,y)+s(x-1,y)+s(x,y-1)-s(x-1,y-1) (8)

in a similar manner to that described above,

s2(x,y)=I2(x,y)+s2(x-1,y)+s2(x,y-1)-s2(x-1,y-1) (9)

is unfolded

Figure BDA0002179795510000044

Comprises the following steps:

Figure BDA0002179795510000045

the denominator of NCC is calculated using the formula of integral image.

As an improvement of the Log-Polar transform-based image fast matching algorithm, the optimization molecule comprises the following steps:

Figure BDA0002179795510000046

wherein

Figure BDA0002179795510000051

Conversion to frequency is possible and other terms may be simplified from the integral image.

As an improvement of the Log-Polar transform-based image fast matching algorithm of the present invention, in step S6, the fitting manner is sub-pixel fitting.

Compared with the prior art, the invention has the beneficial effects that: by the method, the problems of low change speed and poor stability of the correlation matching algorithm in the aspects of scale, angle and the like are solved; the change speed of the correlation matching algorithm in the aspects of scale, angle and the like is greatly improved, and the stability of the correlation matching algorithm is improved.

Drawings

The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:

FIG. 1 is a schematic flow chart of an embodiment of the present invention;

FIG. 2 is a schematic diagram of an image set with resolution gradually decreasing from the bottom to the top of the pyramid in an embodiment of the present invention;

FIG. 3 is a diagram illustrating traversal of all locations at the top-most level in an embodiment of the present invention;

FIG. 4 is an original drawing of a sample image according to an embodiment of the present invention;

FIG. 5 is a Log-Polar transform of FIG. 4;

FIG. 6 is a view rotated 90 of FIG. 4;

FIG. 7 is a Log-Polar transform of FIG. 6;

Detailed Description

As shown in fig. 1, an image fast matching algorithm for Log-Polar transform based image comprises the following steps:

s1, carrying out image pyramid decomposition on the template image and the target image respectively to obtain a series of templates and original images with gradually reduced resolution from the bottom to the top of the pyramid, wherein the image with the maximum resolution is called as a bottom image, and the image with the minimum resolution is called as a top image for short;

s2, respectively carrying out Log-Polar transformation on the pyramid top-level image of the template image and the pyramid top-level image of the target image;

s3, calculating the gray average value, the gray integral and the gray square integral value of the template graph;

s4, performing global traversal on the top-level target image, wherein if the gray variance of the target position is lower than a certain threshold, the position does not participate in the calculation of the similarity, if the gray variance meets the requirement, the NCC coefficient is calculated, if the numerical value is larger, the similarity is higher, and then the information such as position, scale, angle and the like is restrained and determined by using a non-maximum value;

s5, repeating the calculation of similarity of the target position, the scale, the angle and a certain dynamic range until the level is 0;

and S6, carrying out iterative search until the similarity converges to a local extreme value or the iteration number reaches a specified value, and finally carrying out fitting to obtain a high-precision result. Firstly, carrying out pyramid operation on a template image and a target image to form a series of image sets (shown in figure 2) with gradually reduced resolution from the bottom to the top of the pyramid, traversing all positions (shown in figure 3) at the top layer to carry out NCC calculation, determining rough attitude information according to the result, introducing pyramid calculation, and reducing the calculation amount to a great extent; however, there is a certain constraint that the template is fixed and unchangeable, so the establishment of the pyramid is based on the template as a reference, and because the Log-Polar transformation energy changes two images with scale and rotation relation existing in the cartesian coordinate system into two images with only translation relation existing in the Log-Polar coordinate system, for example, as shown in fig. 4-7, the angular direction is annular translation, and by using this characteristic, the two Log-Polar images are firstly projected to the Log-r axis, and are equalized to a one-dimensional projection curve, and the two projection curves are subjected to related calculation by using a one-dimensional NCC, so that the angular relation is obtained, the calculation amount is reduced, and the matching speed is accelerated.

Preferably, in step S2, the Log-Polar transform is based on Polar transform and Log operation is performed, wherein (x, y) corresponds to (r, θ) in Polar coordinate system and (Log-r, θ) in Log-Polar coordinate system, and r represents (x, x) from the center pointc,yc) The distance to point (x, y), θ being an angle, satisfies the following relation:

Figure BDA0002179795510000071

Figure BDA0002179795510000072

where base is the base of the Log transform.

Preferably, (x ', y') corresponds to (Log-r ', θ') in the Log-polar coordinate system, and (x ', y') is the coordinate of (x, y) after transformation by the scale s and rotation by the angle α, that is, the relationship is satisfied:

preferably, when xc=ycWhen x is 0, r cos θ, y is r sin θ, and substituting (4) into (2) includes:

Figure BDA0002179795510000075

when (4) is substituted into (3), there are

Figure BDA0002179795510000076

As can be seen from the equations (5) and (6), the scale change and the rotation change of the image are represented as translation along the Log-r axis and the theta axis in the Log-Polar coordinate system.

Preferably, in step S4, for template I1(x, y) and Source map I2(x, y) whose normalized cross-correlation coefficients are defined as:

Figure BDA0002179795510000077

wherein w and h are the width and height of the template image;

Figure BDA0002179795510000081

as a template I1A gray scale mean of (x, y);

Figure BDA0002179795510000082

is a source diagram I2Grayscale mean of (x, y).

Preferably, in order to simplify the calculation of the denominator, integral images s (x, y) and s are introduced2(x, y) satisfying:

s(x,y)=I(x,y)+s(x-1,y)+s(x,y-1)-s(x-1,y-1) (8)

in a similar manner to that described above,

s2(x,y)=I2(x,y)+s2(x-1,y)+s2(x,y-1)-s2(x-1,y-1) (9)

is unfolded

Figure BDA0002179795510000083

Comprises the following steps:

Figure BDA0002179795510000084

the denominator of NCC is calculated using the formula of integral image.

Preferably, the optimization molecule:

Figure BDA0002179795510000085

whereinConversion to frequency is possible and other terms may be simplified from the integral image.

Preferably, in step S6, the fitting manner is sub-pixel fitting.

While the foregoing specification illustrates and describes several embodiments of the invention, it is to be understood, as noted above, that the invention is not limited to the forms disclosed herein, but is not intended to be exhaustive of other embodiments, and is capable of use in various other combinations, modifications, and environments and is capable of changes within the scope of the inventive concept as described herein, commensurate with the above teachings, or the skill or knowledge of the relevant art. And that modifications and variations may be effected by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:基于结构光的辊压机辊面重建装置和方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!