Fourier transform and integrogram-based normalized cross-correlation calculation method and system
By using Fourier transform and integral graph methods, the problem of long computation time for normalized cross-correlation calculations is solved, enabling fast template matching, improving computational efficiency and reducing resource requirements. This method is suitable for high-speed industrial inspection and edge devices.
Patent Information
- Application Number
- CN202511863121.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-11
- Publication Date
- 2026-02-17
AI Technical Summary
In existing technologies, the normalized cross-correlation calculation process is time-consuming and cannot meet the needs of rapid template matching.
We employ a method based on Fourier transform and integral image. By constructing a normalized cross-correlation formula and transforming it into a Fourier integral image, we perform fast Fourier transform and image integral image calculations, reducing the computational complexity of the mean and sum of squares. We utilize the convolution theorem of Fourier transform to convert spatial domain convolution into frequency domain dot product, and combine the preprocessing characteristics of integral images to achieve fast template matching.
It significantly improves the computational efficiency of template matching, meeting the needs of real-time scenarios such as high-speed industrial inspection and dynamic target tracking, reducing the dependence on computing power and memory, and facilitating deployment on edge devices.
Smart Images

Figure CN121542545A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer image processing technology, and in particular to a normalized cross-correlation calculation method and system based on Fourier transform and integral image. Background Technology
[0002] Template matching achieves precise location of the target image in the source image by quantifying the gray-level similarity of each region of the "template image" (i.e., the target image to be located) and the "source image" (i.e., the original scene image to be searched). Currently, normalized cross-correlation (NCC) is usually used to calculate the similarity between the target image and the source image. However, the normalized cross-correlation calculation process is time-consuming and cannot meet the needs of fast template matching. Summary of the Invention
[0003] This application provides a normalized cross-correlation calculation method and system based on Fourier transform and integral graph, which can solve the problem that the current normalized cross-correlation calculation process is time-consuming and cannot meet the needs of rapid template matching.
[0004] Firstly, this application provides a normalized cross-correlation calculation method based on Fourier transform and integral graph, including: Construct a normalized cross-correlation formula for calculating the similarity between the target image and the source image; The normalized cross-correlation formula is transformed into a Fourier integral graph form to obtain a Fourier integral graph correlation formula that includes Fourier calculation terms and integral graph calculation terms. Perform a Fast Fourier Transform on the Fourier calculation terms to obtain the Fourier calculation results; The integral image calculation is performed on the integral image calculation item to obtain the integral image calculation result; Substituting the Fourier calculation result and the integral image calculation result into the relevant formula of the Fourier integral image, the region similarity value of the above region of the source image is obtained.
[0005] In some embodiments, the normalized cross-correlation formula is: .
[0006] In some embodiments, the formula related to the Fourier integral graph is: ; Where mn represents the number of pixels in the target image. For Fourier calculation terms, For the window source plot mean integral plot item, For the window source plot mean square integral plot item, The mean pixel value of the target image. The squared term of the target image mean. For the window source plot of the sum of squares and integral plot items, This is the sum of squares of the pixels in the target image.
[0007] In some embodiments, performing a Fast Fourier Transform on the Fourier calculation terms to obtain the Fourier calculation result specifically involves: For the Fourier calculation term Perform a Fast Fourier Transform (FFT) calculation to obtain the Fourier results for all regions on the source image.
[0008] In some embodiments, the integral plot calculation term includes the window source plot mean integral plot term. The window source image mean square integral plot item and the window source graph square and integral graph items ; The step of performing image integral image calculation on the integral image calculation item to obtain the integral image calculation result includes: Formula for using the mean integral plot of the window source image The mean integral plot item of the source image of the window Perform image integral image calculation to obtain the result of the mean integral image of the window source image; Substitute the calculation result of the mean integral plot of the window source image into the term of the mean square integral plot of the window source image. The result of the mean square integral plot of the source image is obtained; Using the formula for the sum of squares and integrals of the source image in a window For the window source graph square and integral graph items Perform image integral plot calculation to obtain the result of the window source image square sum integral plot calculation.
[0009] In some embodiments, performing image integral image calculation on the integral image calculation item to obtain the integral image calculation result further includes: Calculate the pixel mean of the target image The mean value of the target image is calculated. Substitute the result of the target image mean calculation into the target image mean square term. The result of the squared mean of the target image is obtained. Calculate the sum of squares of the pixels in the target image. The result of the sum of squared pixels of the target image is obtained.
[0010] In some embodiments, substituting the Fourier calculation result and the integral image calculation result into the relevant formula of the Fourier integral image to obtain the region similarity value of the previous region of the source image specifically involves: Substituting the Fourier integral image calculation results, the window source image mean integral image calculation results, the window source image mean square integral image calculation results, the window source image sum of squares integral image calculation results, the target image mean calculation results, the target image mean square calculation results, and the target image pixel sum of squares calculation results into the relevant formula of the Fourier integral image, the region similarity value of the previous region of the source image is obtained.
[0011] In some embodiments, substituting the Fourier calculation result and the integral image calculation result into the relevant formula of the Fourier integral image to obtain the region similarity value of the previous region of the source image further includes: The region similarity value of all regions in the source image is calculated by iterating through the Fourier integral image correlation formula. The position of the target image in the source image is determined based on the magnitude of the region similarity value.
[0012] In some embodiments, the normalized cross-correlation calculation method based on Fourier transform and integral graph further includes: Construct an image pyramid; The target image is downsampled using the image pyramid to obtain a low-resolution target image; The source image is downsampled using the image pyramid to obtain a low-resolution source image; Based on the low-resolution source image, template matching is performed on the low-resolution target image to obtain the low-resolution region to be located. The low-resolution region to be located is magnified to the original resolution to obtain the region to be located in the original source image. Based on the region to be located in the original source image, template matching is performed on the target image to obtain the position of the target image.
[0013] Secondly, embodiments of this application provide a normalized cross-correlation calculation system based on Fourier transform and integral graph, applied to the normalized cross-correlation calculation method based on Fourier transform and integral graph as described in any one of the first aspects, including: The module is used to construct a normalized cross-correlation formula for calculating the similarity between the target image and the source image; The transformation module is used to perform a Fourier integral graph transformation on the normalized cross-correlation formula to obtain a Fourier integral graph correlation formula including Fourier calculation terms and integral graph calculation terms. The calculation module is used to perform fast Fourier transform calculation on the Fourier calculation terms to obtain the Fourier calculation result; to perform image integral image calculation on the integral image calculation terms to obtain the integral image calculation result; and to substitute the Fourier calculation result and the integral image calculation result into the Fourier integral image related formula to obtain the region similarity value of the previous region of the source image.
[0014] The technical solutions provided in this application have the following advantages compared with the prior art: The normalized cross-correlation calculation method and system based on Fourier transform and integral image provided in this application embodiment constructs a normalized cross-correlation formula for calculating the similarity between a target image and a source image; performs a Fourier integral image transformation on the normalized cross-correlation formula to obtain a Fourier integral image correlation formula including Fourier calculation terms and integral image calculation terms; performs a fast Fourier transform on the Fourier calculation terms to obtain the Fourier calculation result; performs image integral image calculation on the integral image calculation terms to obtain the integral image calculation result; and substitutes the Fourier calculation result and the integral image calculation result into the Fourier integral. The graph correlation formula yields the region similarity value of a region in the source image. It can utilize the "convolution theorem" of Fourier transform to convert the convolution operation in the spatial domain into an equivalent dot product operation in the frequency domain, significantly improving the computational efficiency of the convolution step. By leveraging the "one-time preprocessing, multiple fast queries" characteristic of image integral maps, only one integral map of the source image needs to be constructed. The mean and sum of squares of any subsequent region can be obtained by the difference of the four corner coordinates of the integral map, reducing the overall computational complexity of the mean and sum of squares. This solves the problem that the current normalized cross-correlation calculation process is time-consuming and cannot meet the requirements for rapid template matching. Attached Figure Description
[0015] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0016] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.
[0018] Figure 1A flowchart illustrating a normalized cross-correlation calculation method based on Fourier transform and integral graph provided in an embodiment of this application; Figure 2 A schematic diagram of a target image and a source image provided in an embodiment of this application; Figure 3 This is a schematic diagram showing a target image sliding on a source image, according to an embodiment of this application. Figure 4 This is a schematic diagram showing the target image at any position on the source image, as provided in an embodiment of this application. Figure 5 This is a schematic diagram of convolution operation provided in an embodiment of this application; Figure 6 This is a schematic diagram of an image integral image provided in an embodiment of this application; Figure 7 This is a schematic diagram of calculating the mean of an integral graph according to an embodiment of this application; Figure 8 This is a schematic diagram illustrating the calculation of the mean sum of squared pixels in the source image using an integral image, provided in an embodiment of this application. Figure 9 This is a schematic diagram of source and target image downsampling provided in an embodiment of this application; Figure 10 A flowchart of a normalized cross-correlation calculation method based on Fourier transform and integral graph provided for another embodiment of this application; Figure 11 This is a schematic diagram of a normalized cross-correlation calculation system based on Fourier transform and integral graph provided in an embodiment of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] The following disclosure provides numerous different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of the invention. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.
[0021] Template matching is a key technology supporting target relocalization. Its core logic lies in quantifying the similarity between different regions of the target image and the source image. By locating the region in the source image with the highest similarity to the target image, the target's position can be accurately locked. This vision-based technology, with its intuitiveness and practicality, has been widely applied in various fields of production and daily life, such as industrial inspection, intelligent monitoring, and robot navigation. Among many similarity evaluation metrics, Normalized Cross Correlation (NCC) has become a classic choice that combines reliability and robustness because it can effectively suppress interference such as changes in illumination.
[0022] Traditional template matching employs a "sliding window" strategy: using the target image size as a fixed window, it traverses all possible positions in the source image from left to right and from top to bottom, calculating the similarity between the window region and the target image point by point, and finally using the position corresponding to the maximum similarity as the target localization result. However, the calculation of the NCC index requires simultaneous calculation of multiple operations such as image mean, variance, and pixel convolution, resulting in a large amount of redundant computation during the traversal process, significantly increasing the overall time consumption and making it difficult to meet the application requirements of real-time scenarios.
[0023] like Figure 2 , 3 As shown in Figure 4, template matching is the process of finding the location of a target image within a source image. The typical template matching method involves sliding the target image across the source image in a left-to-right, top-to-bottom order, with the sliding window size matching the target image, to calculate the similarity between different locations (or regions). The target image traverses all locations (or regions) in the source image, and the location with the highest similarity value is the target image's position in the source image. A schematic diagram of the target image sliding across the source image is shown below. Figure 3 As shown in the diagram; the target image needs to traverse all positions in the source image. For any position (x, y), the normalized cross-correlation NCC(x, y) value at that position is calculated. The higher the NCC(x, y) value, the higher the similarity. The position corresponding to the highest similarity value is the target position. A schematic diagram of any position is shown below. Figure 4 As shown.
[0024] Firstly, such as Figure 1-10 As shown, to address the aforementioned technical problems, this application provides a normalized cross-correlation calculation method based on Fourier transform and integral graph, including: S101: Construct a normalized cross-correlation formula for calculating the similarity between the target image and the source image; S102: Perform a Fourier integral graph transformation on the normalized cross-correlation formula to obtain a Fourier integral graph correlation formula including Fourier calculation terms and integral graph calculation terms. S103: Perform a fast Fourier transform on the Fourier calculation terms to obtain the Fourier calculation results; S104: Perform image integral image calculation on the integral image calculation item to obtain the integral image calculation result; S105: Substitute the Fourier calculation result and the integral image calculation result into the relevant formula of the Fourier integral image to obtain the region similarity value of the previous region of the source image.
[0025] It should be noted that the core problem of the traditional NCC algorithm is the high complexity (O(M×N×K×L)) of the coupled "mean / variance calculation" and "convolution operation". However, by transforming the formula, the normalized cross-correlation formula is decomposed into "Fourier calculation term" (corresponding to convolution operation) and "integral image calculation term" (corresponding to mean / variance calculation), which realizes "divide and conquer processing of high-complexity tasks". This not only avoids the redundant operation of "repeatedly calculating mean / variance + convolution for each sub-region" in the traditional algorithm, but also provides a logical basis for subsequent targeted acceleration.
[0026] It should be noted that by performing Fast Fourier Transform on the Fourier calculation terms, the convolution operation in the spatial domain can be equivalently transformed into the dot product operation in the frequency domain. For large source images (such as high-definition scene images in industrial inspection) or large template images, this transformation can significantly reduce the amount of computation and significantly improve the efficiency of the convolution step in the calculation process.
[0027] It should be noted that by performing image integral image calculation on the integral image calculation items, the "construction once, query multiple times" characteristic of integral images can be utilized to reduce the computational workload of "calculating the mean / variance of each sub-region separately" in traditional algorithms. Only one integral image preprocessing is required for the source image and the template image. The mean and sum of squares of any subsequent sub-region can be quickly solved by the difference of the four corner coordinates of the integral image. The variance calculation is also simplified, completely eliminating the redundant traversal in the mean / variance calculation and further reducing the overall computation time.
[0028] In some embodiments, the normalized cross-correlation formula is: .
[0029] It should be noted that in the numerator of the normalized cross-correlation formula (Pixels of a sub-region of the source image minus the mean of the sub-region) The processing of (template pixels minus template mean) is equivalent to "centering" the gray levels of the source image sub-regions and the template image. That is, regardless of the overall brightness increase / decrease in the scene (such as the fluctuating lighting in industrial inspection) or the overall gray level shift of the target itself (such as the difference in gray level of imaging from different devices in medical imaging), centering can eliminate the interference of this "overall shift" and ensure that the similarity calculation focuses on the shape matching of the gray level distribution, rather than the matching of absolute gray level values. The denominator of the normalized cross-correlation formula is the square root of the product of the "gray level variance of the source image sub-region" and the "gray level variance of the template". The variance reflects the degree of dispersion of gray level. By normalizing the variance, the similarity deviation caused by "uneven lighting intensity" can be eliminated (such as the same target having large gray level fluctuations under strong light and small fluctuations under weak light, but its similarity value remains stable after normalization).
[0030] It should be noted that the normalized cross-correlation formula is obtained by normalizing the mean of the target image (w) and the source image window (f) respectively (subtracting their own mean). , Then, correlation calculation is performed to offset the impact of overall changes in light intensity (such as uniform enhancement / decrease in brightness) or contrast scaling on similarity. Among them, the calculation result of the NCC formula (i.e., the normalized cross-correlation formula) is fixed in the range of [-1, 1]: 1 represents a perfect match, -1 represents a completely negative correlation, and 0 represents no correlation. Based on this standardized result range, the similarity in different locations and different scenes can be directly comparable, which facilitates the rapid determination of the "location corresponding to the maximum similarity" and improves the efficiency and reliability of target positioning.
[0031] In some embodiments, the formula related to the Fourier integral graph is: ; Where mn represents the number of pixels in the target image. For Fourier calculation terms, For the window source plot mean integral plot item, For the window source plot mean square integral plot item, The mean pixel value of the target image. The squared term of the target image mean. For the window source plot of the sum of squares and integral plot items, This is the sum of squares of the pixels in the target image.
[0032] It should be noted that the Fourier integral graph related formula is an equivalent algebraic transformation of the traditional NCC (without approximation or simplification). The Fourier calculation terms and the integral graph calculation terms can be calculated independently (e.g., in engineering, FFT and integral graph queries can be processed simultaneously through a hardware pipeline), further shortening the overall processing time. Through the synergistic acceleration of Fourier and integral graph, the overall computational efficiency is improved by an order of magnitude compared to the traditional NCC, which can meet the needs of real-time scenarios such as high-speed industrial inspection and dynamic target tracking. Among them, the integral graph only requires a small amount of memory to store the preprocessing results, and the Fourier transform can be efficiently implemented through hardware IP cores (such as the FFT module of an FPGA), reducing the dependence on computing power / memory and facilitating deployment on edge devices (such as industrial robots and mobile devices).
[0033] In some embodiments, performing a Fast Fourier Transform on the Fourier calculation terms to obtain the Fourier calculation result specifically involves: For the Fourier calculation term Perform a Fast Fourier Transform (FFT) calculation to obtain the Fourier results for all regions on the source image.
[0034] It should be noted that, as Figure 5 As shown, the Fourier calculation term is essentially a "spatial convolution between the source image and the template image" (i.e., a dot product operation where the template slides across regions of the source image). Traditional methods require performing a spatial dot product between each sub-region of the source image and the template image (i.e., the target image) individually, resulting in a computational complexity of O(M×N×K×L), where M×N is the source image size and K×L is the template size. This is a brute-force computation involving "region-by-region traversal," and the time consumption increases exponentially with the image size. However, by using the Fast Fourier Transform (FFT), it is possible to... Using the "convolution theorem," the spatial convolution of the entire source image and the template image can be equivalently transformed into "frequency domain dot product." Only one FFT is needed for each of the source and template images (complexity O((M+K)×(N+L)log[(M+K)×(N+L)])), followed by one frequency domain dot product (complexity O((M+K)×(N+L)), and finally one inverse FFT to obtain the convolution result of all regions of the source image (i.e., the Fourier calculation result). The computational efficiency can be improved by tens or even hundreds of times.
[0035] It should be noted that in the traditional NCC method, when the template image slides on the source image, the convolution of each sub-region is "independently repeated" (adjacent sub-regions have a large number of overlapping pixels, but still need to be traversed again), while the global calculation of FFT "processes the entire source image at once", directly outputs the convolution results of all sub-regions, completely eliminating the repeated calculation of overlapping areas and further compressing the time consumption.
[0036] In some embodiments, the integral plot calculation term includes the window source plot mean integral plot term. The window source image mean square integral plot item and the window source graph square and integral graph items ; The step of performing image integral image calculation on the integral image calculation item to obtain the integral image calculation result includes: Formula for using the mean integral plot of the window source image The mean integral plot item of the source image of the window Perform image integral image calculation to obtain the result of the mean integral image of the window source image; Substitute the calculation result of the mean integral plot of the window source image into the term of the mean square integral plot of the window source image. The result of the mean square integral plot of the source image is obtained; Using the formula for the sum of squares and integrals of the source image in a window For the window source graph square and integral graph items Perform image integral plot calculation to obtain the result of the window source image square sum integral plot calculation.
[0037] It should be noted that, as Figure 6 , 7 As shown in Figure 8, the integral image calculation ensures that only the original pixels of the source image need to be processed during the preprocessing stage. and pixel square Constructing an integral image once has a time complexity of O(M×N) (where M×N is the source image size); during the query phase, the mean / sum of squares of any (sub)region can be directly calculated using the "difference of the four corner coordinates" of the integral image (as in the mean formula). It is the sum of pixels in the sub-region), with a complexity of only O(1) / sub-region (or region); and the mean square term (i.e., the mean square integral term of the window source image) The result can be obtained directly by squaring the mean result (i.e. the result of the mean integral plot of the source image of the window) without additional traversal. The complexity is O(1) / sub-region. This optimization can significantly reduce the computation of mean / squaring, and is especially suitable for large source images or multi-sub-region scenarios.
[0038] It should be noted that in the traditional NCC method, there are a large number of overlapping pixels in adjacent sub-regions (e.g., when the template sliding step size is 1, adjacent sub-regions overlap by mn-1 pixels), but these pixels still need to be traversed repeatedly. However, the "one-time preprocessing" of the integral image only traverses the source image once, and the calculation of all subsequent sub-regions is based on the pre-stored results of the integral image, which completely avoids the repeated traversal of overlapping pixels, thus reducing the computation time and the CPU / GPU computing power consumption.
[0039] In some embodiments, performing image integral image calculation on the integral image calculation item to obtain the integral image calculation result further includes: Calculate the pixel mean of the target image The mean value of the target image is calculated. Substitute the result of the target image mean calculation into the target image mean square term. The result of the squared mean of the target image is obtained. Calculate the sum of squares of the pixels in the target image. The result of the sum of squared pixels of the target image is obtained.
[0040] It should be noted that the target image (template) is fixed. In traditional NCC methods, the mean of the template is repeatedly calculated "when matching each sub-region of the source image". ), mean square ( ), sum of squares ( This part of the operation pre-executes these three types of calculations for the template and caches the results. The matching process of all subsequent source image sub-regions can directly reuse these pre-calculated results without repeatedly traversing the template pixels, thus completely eliminating the redundant calculations related to the template.
[0041] In some embodiments, substituting the Fourier calculation result and the integral image calculation result into the relevant formula of the Fourier integral image to obtain the region similarity value of the previous region of the source image specifically involves: Substituting the Fourier integral image calculation results, the window source image mean integral image calculation results, the window source image mean square integral image calculation results, the window source image sum of squares integral image calculation results, the target image mean calculation results, the target image mean square calculation results, and the target image pixel sum of squares calculation results into the relevant formula of the Fourier integral image, the region similarity value of the previous region of the source image is obtained.
[0042] It should be noted that the previous steps decomposed the NCC formula into "Fourier calculation terms (convolution)" and "integral image calculation terms (source image mean / sum of squares, template mean / sum of squares)" and accelerated the calculations separately. This step integrates the "dispersed intermediate results" into "similarity values of source image sub-regions" by substituting all the results into the Fourier integral image related formula, forming a complete matching process from "formula decomposition → divide-and-conquer acceleration → result fusion". Moreover, this step only requires substituting the pre-calculated / accelerated results into the formula and performing simple algebraic operations (such as subtraction and multiplication of the numerator, and square root operation of the denominator). Compared with the previous convolution and integral image calculations, the time consumption of this step is negligible and will not cancel the previous acceleration effect, ensuring the efficiency of the overall matching process.
[0043] In some embodiments, substituting the Fourier calculation result and the integral image calculation result into the relevant formula of the Fourier integral image to obtain the region similarity value of the previous region of the source image further includes: The region similarity value of all regions in the source image is calculated by iterating through the Fourier integral image correlation formula. The position of the target image in the source image is determined based on the magnitude of the region similarity value.
[0044] It should be noted that by "traversing and calculating the similarity value of all regions", the entire region of the source image can be covered, ensuring that no possible location of the target image is missed. Then, by "filtering by similarity value" (usually taking the region with the closest similarity to 1), the coordinates of the target image in the source image can be accurately located, transforming the previous "accelerated calculation" into "the actual target location result".
[0045] In some embodiments, the normalized cross-correlation calculation method based on Fourier transform and integral graph further includes: Construct an image pyramid; The target image is downsampled using the image pyramid to obtain a low-resolution target image; The source image is downsampled using the image pyramid to obtain a low-resolution source image; Based on the low-resolution source image, template matching is performed on the low-resolution target image to obtain the low-resolution region to be located. The low-resolution region to be located is magnified to the original resolution to obtain the region to be located in the original source image. Based on the region to be located in the original source image, template matching is performed on the target image to obtain the position of the target image.
[0046] It should be noted that, as Figure 9 As shown, for large source images (such as 4K high-definition images) or large template images (i.e., target images), directly traversing all regions at the original resolution may still be time-consuming. However, the image pyramid strategy of "low-resolution matching first, then high-resolution refinement" can further reduce the computational load of high-resolution matching. That is, the size of the low-resolution source image / target image is much smaller than the original resolution (e.g., sampled to 1 / 4 size). The number of regions for matching is only 1 / 16 of the original, which can lock the "approximate target region" (low-resolution region to be located) in a very short time, avoiding global traversal at the original resolution and compressing the global search time to a fraction of the original. Original resolution matching is performed only within the "small range after the low-resolution region to be located is enlarged", without traversing the entire original source image.
[0047] Secondly, such as Figure 11As shown, this application provides a normalized cross-correlation calculation system based on Fourier transform and integral graph, applied to the normalized cross-correlation calculation method based on Fourier transform and integral graph as described in any one of the first aspects, including: Module 10 is used to construct a normalized cross-correlation formula for calculating the similarity between the target image and the source image; Transformation module 20 is used to perform Fourier integral graph transformation on the normalized cross-correlation formula to obtain a Fourier integral graph correlation formula including Fourier calculation terms and integral graph calculation terms. The calculation module 30 is used to perform fast Fourier transform calculation on the Fourier calculation term to obtain the Fourier calculation result; to perform image integral image calculation on the integral image calculation term to obtain the integral image calculation result; and to substitute the Fourier calculation result and the integral image calculation result into the Fourier integral image related formula to obtain the region similarity value of the previous region of the source image.
[0048] The device / system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0049] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0050] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also mean including the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a specific order described or illustrated unless the order of execution is explicitly indicated. It should also be understood that additional or alternative steps may be used. The above description is merely a specific embodiment of the invention to enable those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for calculating normalized cross-correlation based on Fourier transform and integral graph, characterized in that, include: Construct a normalized cross-correlation formula for calculating the similarity between the target image and the source image; The normalized cross-correlation formula is transformed into a Fourier integral graph form to obtain a Fourier integral graph correlation formula that includes Fourier calculation terms and integral graph calculation terms. Perform a Fast Fourier Transform on the Fourier calculation terms to obtain the Fourier calculation results; The integral image calculation is performed on the integral image calculation item to obtain the integral image calculation result; Substituting the Fourier calculation result and the integral image calculation result into the relevant formula of the Fourier integral image, the region similarity value of the above region of the source image is obtained.
2. The normalized cross-correlation calculation method based on Fourier transform and integral graph as described in claim 1, characterized in that, The normalized cross-correlation formula is: 。 3. The normalized cross-correlation calculation method based on Fourier transform and integral graph as described in claim 1, characterized in that, The relevant formula for the Fourier integral graph is: ; Where mn represents the number of pixels in the target image. For Fourier calculation terms, For the window source plot mean integral plot item, For the window source plot mean square integral plot item, The mean pixel value of the target image. The squared term of the target image mean. For the window source plot of the sum of squares and integral plot items, This is the sum of squares of the pixels in the target image.
4. The normalized cross-correlation calculation method based on Fourier transform and integral graph as described in claim 1, characterized in that, The process of performing a Fast Fourier Transform on the Fourier calculation terms to obtain the Fourier calculation result is as follows: For the Fourier calculation term Perform a Fast Fourier Transform (FFT) calculation to obtain the Fourier results for all regions on the source image.
5. The normalized cross-correlation calculation method based on Fourier transform and integral graph as described in claim 3, characterized in that, The integral plot calculation item includes the window source image mean integral plot item. The window source image mean square integral plot item and the window source graph square and integral graph items ; The step of performing image integral image calculation on the integral image calculation item to obtain the integral image calculation result includes: Formula for using the mean integral plot of the window source image The mean integral plot item of the source image of the window Perform image integral image calculation to obtain the result of the mean integral image of the window source image; Substitute the calculation result of the mean integral plot of the window source image into the term of the mean square integral plot of the window source image. The result of the mean square integral plot of the source image is obtained; Using the formula for the sum of squares and integrals of the source image in a window For the window source graph square and integral graph items Perform image integral plot calculation to obtain the result of the window source image square sum integral plot calculation.
6. The normalized cross-correlation calculation method based on Fourier transform and integral graph as described in claim 5, characterized in that, The step of performing image integral image calculation on the integral image calculation item to obtain the integral image calculation result further includes: Calculate the pixel mean of the target image The mean value of the target image is calculated. Substitute the result of the target image mean calculation into the target image mean square term. The result of the squared mean of the target image is obtained. Calculate the sum of squares of the pixels in the target image. The result of the sum of squared pixels of the target image is obtained.
7. The normalized cross-correlation calculation method based on Fourier transform and integral graph as described in claim 6, characterized in that, The step of substituting the Fourier calculation result and the integral image calculation result into the relevant formula of the Fourier integral image to obtain the region similarity value of the previous region in the source image is as follows: Substituting the Fourier integral image calculation results, the window source image mean integral image calculation results, the window source image mean square integral image calculation results, the window source image sum of squares integral image calculation results, the target image mean calculation results, the target image mean square calculation results, and the target image pixel sum of squares calculation results into the relevant formula of the Fourier integral image, the region similarity value of the previous region of the source image is obtained.
8. The normalized cross-correlation calculation method based on Fourier transform and integral graph according to any one of claims 1-7, characterized in that, The step of substituting the Fourier calculation result and the integral image calculation result into the relevant formula of the Fourier integral image to obtain the region similarity value of the previous region of the source image further includes: The region similarity value of all regions in the source image is calculated by iterating through the Fourier integral image correlation formula. The position of the target image in the source image is determined based on the magnitude of the region similarity value.
9. The normalized cross-correlation calculation method based on Fourier transform and integral graph as described in claim 1, characterized in that, Also includes: Construct an image pyramid; The target image is downsampled using the image pyramid to obtain a low-resolution target image; The source image is downsampled using the image pyramid to obtain a low-resolution source image; Based on the low-resolution source image, template matching is performed on the low-resolution target image to obtain the low-resolution region to be located. The low-resolution region to be located is magnified to the original resolution to obtain the region to be located in the original source image. Based on the region to be located in the original source image, template matching is performed on the target image to obtain the position of the target image.
10. A normalized cross-correlation calculation system based on Fourier transform and integral graph, characterized in that, The normalized cross-correlation calculation method based on Fourier transform and integral graph as described in any one of claims 1-9 includes: The module is used to construct a normalized cross-correlation formula for calculating the similarity between the target image and the source image; The transformation module is used to perform a Fourier integral graph transformation on the normalized cross-correlation formula to obtain a Fourier integral graph correlation formula including Fourier calculation terms and integral graph calculation terms. The calculation module is used to perform fast Fourier transform calculation on the Fourier calculation terms to obtain the Fourier calculation result; to perform image integral image calculation on the integral image calculation terms to obtain the integral image calculation result; and to substitute the Fourier calculation result and the integral image calculation result into the Fourier integral image related formula to obtain the region similarity value of the previous region of the source image.