1 Affine region detectors
2 -----------------------
4 What is being detected?
5 ~~~~~~~~~~~~~~~~~~~~~~~
7 Affine region is basically any region of the image
8 that is stable under affine transformations. It can be
9 edges under affinity conditions, corners (small patch of an image)
10 or any other stable features.
17 At the moment, the following detectors are implemented
31 Both are derived from a concept called Moravec window. Lets have a look
34 .. figure:: ./Moravec-window-corner.png
35 :alt: Moravec window corner case
37 Moravec window corner case
39 As can be noticed, moving the yellow window in any direction will cause
40 very big change in intensity. Now, lets have a look at the edge case:
42 .. figure:: ./Moravec-window-edge.png
43 :alt: Moravec window edge case
45 Moravec window edge case
47 In this case, intensity change will happen only when moving in
50 This is the key concept in understanding how the two corner detectors
53 The algorithms have the same structure:
55 1. Compute image derivatives
57 2. Compute Weighted sum
61 4. Threshold (optional)
63 Harris and Hessian differ in what **derivatives they compute**. Harris
64 computes the following derivatives:
66 ``HarrisMatrix = [(dx)^2, dxdy], [dxdy, (dy)^2]``
68 (note that ``d(x^2)`` and ``(dy^2)`` are **numerical** powers, not gradient again).
70 The three distinct terms of a matrix can be separated into three images,
71 to simplify implementation. Hessian, on the other hand, computes second
74 ``HessianMatrix = [dxdx, dxdy][dxdy, dydy]``
76 **Weighted sum** is the same for both. Usually Gaussian blur
77 matrix is used as weights, because corners should have hill like
78 curvature in gradients, and other weights might be noisy.
79 Basically overlay weights matrix over a corner, compute sum of
80 ``s[i,j]=image[x + i, y + j] * weights[i, j]`` for ``i, j``
81 from zero to weight matrix dimensions, then move the window
82 and compute again until all of the image is covered.
84 **Response computation** is a matter of choice. Given the general form
85 of both matrices above
89 One of the response functions is
91 ``response = det - k * trace^2 = a * c - b * d - k * (a + d)^2``
93 ``k`` is called discrimination constant. Usual values are ``0.04`` -
96 The other is simply determinant
98 ``response = det = a * c - b * d``
100 **Thresholding** is optional, but without it the result will be
101 extremely noisy. For complex images, like the ones of outdoors, for
102 Harris it will be in order of 100000000 and for Hessian will be in order
103 of 10000. For simpler images values in order of 100s and 1000s should be
104 enough. The numbers assume ``uint8_t`` gray image.
106 To get deeper explanation please refer to following **paper**:
108 `Harris, Christopher G., and Mike Stephens. "A combined corner and edge
109 detector." In Alvey vision conference, vol. 15, no. 50, pp. 10-5244.
110 1988. <http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.434.4816&rep=rep1&type=pdf>`__
112 `Mikolajczyk, Krystian, and Cordelia Schmid. "An affine invariant interest point detector." In European conference on computer vision, pp. 128-142. Springer, Berlin, Heidelberg, 2002. <https://hal.inria.fr/inria-00548252/document>`__
114 `Mikolajczyk, Krystian, Tinne Tuytelaars, Cordelia Schmid, Andrew Zisserman, Jiri Matas, Frederik Schaffalitzky, Timor Kadir, and Luc Van Gool. "A comparison of affine region detectors." International journal of computer vision 65, no. 1-2 (2005): 43-72. <https://hal.inria.fr/inria-00548528/document>`__