在哪里可以找到解释 FFT 相位相关评分的良好信息来源

发布于 2024-10-10 21:51:18 字数 545 浏览 9 评论 0原文

我一直在寻找 OpenCV 的优秀源代码来了解分数计算。您可能已经注意到,该库可以在具有置信度分数的图像中找到模板。 cvMatchTemplate 函数给出模板在图像中的概率和位置。

由于 DFT 很慢,我决定使用 FFTW 库进行相位相关。我得到图像,扩展到2的幂的大小,然后对模板执行相同的操作,首先计算两者的FFT,将两个数组相乘,计算逆FFT,最后对结果进行归一化。

如果我在位图上显示此结果,它会清楚地显示模板的位置,但是,我在计算相关性分数时遇到困难。我尝试在调试器下逐行运行 cvMatchTemplate 方法,但它没有帮助,因为该库使用 DFT 和任意图像大小。该方法中使用的所有表(sum、sqsum 等)都是为相应的任意大小创建的,并且 FFT 使用 2 的幂。

如果您提供有关如何根据相位相关结果计算分数的任何信息,我将不胜感激。有许多资料来源描述了“拿这个,拿那个,将它们相乘,你看到图像上的白点,是的,你找到了”的方式。我需要一个分数,就像 cvMatchTemplate 一样。

我恳请您给我指出一个包含该计算逻辑的网站或论文或一本书。源代码将是完美的,但无论如何我对此不抱希望。

I've been looking to the OpenCV's magnificent source code to understand the score calculation. As you may have noticed the library can find a template in an image with a confidence score. cvMatchTemplate function gives the probability and location of the template in image.

Since DFT is slow, I decided to use FFTW library for phase correlation. I get the image, expanded to a size which is a power of 2, then did the same to the template, first calculated the FFT for both, multiplied the two array, calculated the inverse FFT, finally normalized the result.

If I show this result on a bitmap it clearly shows the location of template, however, I have difficulties calculating the correlation score. I tried to run cvMatchTemplate method line by line under debugger, it didn't help since the library uses DFT and arbitrary image sizes. All the tables used in that method (sum, sqsum etc) created for corresponding arbitrary sizes and FFT uses powers of two.

I would be grateful for any information on how to calculate the score from that result of phase correlation. There are many sources describing "take this, take that, multiply them, you see the white point on the image, yeah you find it" way. I need a score just like cvMatchTemplate did.

I'm kindly asking you to point me to a site or to a paper containing the logic of that calculation or to a book. Source code would be perfect but I have no hope on that anyway.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

盗梦空间 2024-10-17 21:51:18

1) FFTW 可以使用非 2 幂大小的数组。

2) 您可能要搜索/研究的主题领域是 FFT 互相关定理:

“两个函数互相关的傅里​​叶变换相当于各个傅里叶变换的乘积,其中其中一个是复数共轭”

1) FFTW can work with non-power-of-2 size arrays.

2) The subject area you might to search/study in is the FFT cross-correlation theorem:

"the Fourier transform of the cross-correlation of two functions is equivalent to the product of the individual Fourier transforms, where one of them has been complex conjugated"

南风起 2024-10-17 21:51:18

首先,确保您没有“将图像展开为 2 的幂”。我确信你不是这个意思,但无论如何使用 FFTW 你可以计算任意大小的 FT。

我不明白你用 OpenCV 做什么。如果您有FFT,那么您可以很容易地自己计算归一化互功率谱,即“相位相关公式”。

尽可能获得最大尺寸的图像 FFT,不要忘记加窗。计算 CPS。一旦有了相关面,就可以寻找峰值。

我不知道 OpenCV 除了 FT 之外还提供什么相位相关功能,但您想要的论文是

GA Thomas,DATV 和其他应用的电视运动测量,1987 年,BBC 研究部。

First, make sure you are not "expanding the image to a power of 2". I'm sure you didn't mean this, but anyway with FFTW you can calculate an arbitrary size FT.

I don't understand what you are using OpenCV for. If you have the FFT then it is quite easy to calculate the normalised cross power spectrum by yourself, in other words the "phase correlation formula".

Get the largest size FFT of the images that you can, not forgetting to window. Calculate the CPS. Once you have the correlation surface look for the peak.

I don't know what OpenCV offers for Phase Correlation apart from FT, but the paper you want is

G.A. Thomas, Television Motion Measurement for DATV and Other Applications, 1987, BBC Research Department.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文