如何在整体图像上应用盒式滤镜? (冲浪) [英] How to apply box filter on integral image? (SURF)

查看:147
本文介绍了如何在整体图像上应用盒式滤镜? (冲浪)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个灰度(8位)图像,并假设我有一个从同一图像创建的积分图像。
图像分辨率为 720x576 。根据SURF算法,每个八度由4个框式滤波器组成,它们由侧面的像素数定义。


第一个八度使用滤镜的像素为 9x9、15x15、21x21和27x27

第二个八度使用滤镜 15x15、27x27、39x39和51x51 像素。
第三个八度使用使用 27x27、51x51、75x75和99x99 像素。如果图像足够大,并且我猜 720x576足够大(对?!!!),则会添加第四个八度,分别为 51x51、99x99、147x147和195x195 。这些
倍频程彼此部分重叠以提高插值结果的质量。

  //因此,我们有: 
//
// 9x9 15x15 21x21 27x27
// 15x15 27x27 39x39 51x51
// 27x27 51x51 75x75 99x99
// 51x51 99x99 147x147 195x195

问题是:
每个过滤器中的值是多少?我应该对这些值进行硬编码还是应该对其进行计算?
如何(在数值上)精确地将滤镜应用于积分图像?



计算Hessian行列式时,我发现了两个近似值:

det(HessianApprox)= DxxDyy −(0.9Dxy)^ 2
det(HessianApprox)= DxxDyy −(0.81Dxy)^ 2

哪个是正确的?
(Dxx,Dyy和Dxy是高斯二阶导数)。

解决方案

我不得不回到原始文件,以找到问题的确切答案。



某些背景优先



SURF利用常见的图像分析方法对感兴趣区域进行检测,即斑点检测。
斑点检测的典型方法是高斯差分。
的原因有很多,第一个是模仿人脑视觉皮层中发生的事情。



高斯差分的缺点( DoG)的计算时间过于昂贵,无法应用于大图像区域。 DoG只是两个高斯平均值的计算(或等效地,应用高斯模糊),然后取它们的差。
一个快速而脏的近似(对于小区域来说不太脏)是通过框模糊来近似高斯模糊。



框模糊是给定矩形中所有图像的平均值。可以通过积分图像有效地进行计算。



使用积分图像



在整幅图像中,每个像素值是位于上方且位于其左侧的所有像素的总和在原始图像中。
因此,积分图像的左上像素值为0,因此积分图像的右下像素具有所有原始像素的和。



然后,您只需要说明框模糊等于给定矩形内的所有像素的总和(不起源于图像的最上面的像素),然后应用以下简单的几何推理。



如果您有一个带有四角ABCD的矩形(左上,右上,左下,右下),则框过滤器的值由下式给出:

  boxFilter(ABCD)= A + D-B-C,

其中A,B,C,D是IntegralImagePixelAt(A)的快捷方式(分别是B,C,D)。



SURF中的整体图像



SURF不直接使用大小为9x9等的框模糊。
它使用的是几个高斯导数或类似Haar的特征。



让我们举个例子。假设您要计算9x9过滤器输出。这对应于给定的sigma,因此是固定的比例/八度。



固定sigma后,您将9x9窗口居中放在感兴趣的像素上。然后,您可以计算每个方向(水平,垂直,对角线)的二阶高斯导数的输出。本文中的图1给出了垂直和对角线滤镜的图示。



Hessian行列式



有一个因素要考虑规模差异。让我们相信该行列式等于的纸张:

  Det = DxxDyy-(0.9 * Dxy)^ 2。 

最后,行列式为: Det = DxxDyy-0.81 * Dxy ^ 2


Assuming that I have a grayscale (8-bit) image and assume that I have an integral image created from that same image. Image resolution is 720x576. According to SURF algorithm, each octave is composed of 4 box filters, which are defined by the number of pixels on their side.

The first octave uses filters with 9x9, 15x15, 21x21 and 27x27 pixels.
The second octave uses filters with 15x15, 27x27, 39x39 and 51x51 pixels.
The third octave uses filters with 27x27, 51x51, 75x75 and 99x99 pixels. If the image is sufficiently large and I guess 720x576 is big enough (right??!!), a fourth octave is added, 51x51, 99x99, 147x147 and 195x195. These octaves partially overlap one another to improve the quality of the interpolated results.

// so, we have:
//
// 9x9   15x15  21x21   27x27
// 15x15 27x27  39x39   51x51
// 27x27 51x51  75x75   99x99
// 51x51 99x99 147x147 195x195

The questions are:
What are the values in each of these filters? Should I hardcode these values, or should I calculate them?
How exactly (numerically) to apply filters to the integral image?

Also, for calculating the Hessian determinant I found two approximations:
det(HessianApprox) = DxxDyy − (0.9Dxy)^2 and
det(HessianApprox) = DxxDyy − (0.81Dxy)^2

Which one is correct? (Dxx, Dyy, and Dxy are Gaussian second order derivatives).

解决方案

I had to go back to the original paper to find the precise answers to your questions.

Some background first

SURF leverages a common Image Analysis approach for regions-of-interest detection that is called blob detection. The typical approach for blob detection is a difference of Gaussians. There are several reasons for this, the first one being to mimic what happens in the visual cortex of the human brains.

The drawback to difference of Gaussians (DoG) is the computation time that is too expensive to be applied to large image areas.

In order to bypass this issue, SURF takes a simple approach. A DoG is simply the computation of two Gaussian averages (or equivalently, apply a Gaussian blur) followed by taking their difference. A quick-and-dirty approximation (not so dirty for small regions) is to approximate the Gaussian blur by a box blur.

A box blur is the average value of all the images values in a given rectangle. It can be computed efficiently via integral images.

Using integral images

Inside an integral image, each pixel value is the sum of all the pixels that were above it and on its left in the original image. The top-left pixel value in the integral image is thus 0, and the bottom-rightmost pixel of the integral image has thus the sum of all the original pixels for value.

Then, you just need to remark that the box blur is equal to the sum of all the pixels inside a given rectangle (not originating in the top-lefmost pixel of the image) and apply the following simple geometric reasoning.

If you have a rectangle with corners ABCD (top left, top right, bottom left, bottom right), then the value of the box filter is given by:

boxFilter(ABCD) = A + D - B - C,

where A, B, C, D is a shortcut for IntegralImagePixelAt(A) (B, C, D respectively).

Integral images in SURF

SURF is not using box blurs of sizes 9x9, etc. directly. What it uses instead is several orders of Gaussian derivatives, or Haar-like features.

Let's take an example. Suppose you are to compute the 9x9 filters output. This corresponds to a given sigma, hence a fixed scale/octave.

The sigma being fixed, you center your 9x9 window on the pixel of interest. Then, you compute the output of the 2nd order Gaussian derivative in each direction (horizontal, vertical, diagonal). The Fig. 1 in the paper gives you an illustration of the vertical and diagonal filters.

The Hessian determinant

There is a factor to take into account the scale differences. Let's believe the paper that the determinant is equal to:

Det = DxxDyy - (0.9 * Dxy)^2. 

Finally, the determinant is given by: Det = DxxDyy - 0.81*Dxy^2.

这篇关于如何在整体图像上应用盒式滤镜? (冲浪)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆