You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/tutorials/brief.md
+81-6Lines changed: 81 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,87 @@ To build a BRIEF descriptor of length `n`, we need to determine `n` pairs `(Xi,Y
4
4
5
5
In ImageFeatures.jl we have five methods to determine the vectors `X` and `Y` :
6
6
7
-
-[random_uniform](`random_uniform`) : `X` and `Y` are randomly uniformly sampled
8
-
-[gaussian](`gaussian`) : `X` and `Y` are randomly sampled using a Gaussian distribution, meaning that locations that are closer to the center of the patch are preferred
9
-
-[gaussian_local](`gaussian_local`) : `X` and `Y` are randomly sampled using a Gaussian distribution where first `X` is sampled with a standard deviation of `0.04*S^2` and then the `Yi’s` are sampled using a Gaussian distribution – Each `Yi` is sampled with mean `Xi` and standard deviation of `0.01 * S^2`
10
-
-[random_coarse](`random_coarse`) : `X` and `Y` are randomly sampled from discrete location of a coarse polar grid
11
-
-[centered](`centered`) : For each `i`, `Xi` is `(0, 0)` and `Yi` takes all possible values on a coarse polar grid
7
+
-[`random_uniform`](@ref) : `X` and `Y` are randomly uniformly sampled
8
+
-[`gaussian`](@ref) : `X` and `Y` are randomly sampled using a Gaussian distribution, meaning that locations that are closer to the center of the patch are preferred
9
+
-[`gaussian_local`](@ref) : `X` and `Y` are randomly sampled using a Gaussian distribution where first `X` is sampled with a standard deviation of `0.04*S^2` and then the `Yi’s` are sampled using a Gaussian distribution – Each `Yi` is sampled with mean `Xi` and standard deviation of `0.01 * S^2`
10
+
-[`random_coarse`](@ref) : `X` and `Y` are randomly sampled from discrete location of a coarse polar grid
11
+
-[`centered`](@ref) : For each `i`, `Xi` is `(0, 0)` and `Yi` takes all possible values on a coarse polar grid
12
12
13
13
As with all the binary descriptors, BRIEF’s distance measure is the number of different bits between two binary strings which can also be computed as the sum of the XOR operation between the strings.
14
14
15
-
BRIEF is a very simple feature descriptor and does not provide scale, translation or rotation invariance. To achieve those, see [ORB](orb), [BRISK](brisk) and [FREAK](freak).
15
+
BRIEF is a very simple feature descriptor and does not provide scale or rotation invariance (only translation invariance). To achieve those, see [ORB](orb), [BRISK](brisk) and [FREAK](freak).
16
+
17
+
## Example
18
+
19
+
Let us take a look at a simple example where the BRIEF descriptor is used to match two images where one has been translated by `(10, 20)` pixels.
20
+
21
+
First, let us define a warping function to transform the image.
22
+
23
+
```@example 1
24
+
function _warp(img, transx, transy)
25
+
res = zeros(eltype(img), size(img))
26
+
for i in 1:size(img, 1) - transx
27
+
for j in 1:size(img, 2) - transy
28
+
res[i + transx, j + transy] = img[i, j]
29
+
end
30
+
end
31
+
res = shareproperties(img, res)
32
+
res
33
+
end
34
+
nothing # hide
35
+
```
36
+
37
+
Now, let us create the two images we will match using BRIEF.
38
+
39
+
```@example 1
40
+
41
+
using ImageFeatures, TestImages, Images, ImageDraw
42
+
43
+
img = testimage("lena_gray_512")
44
+
img_array_1 = convert(Array{Images.Gray}, img)
45
+
img_array_2 = _warp(img_array_1, 10, 20)
46
+
nothing # hide
47
+
```
48
+
49
+
To calculate the descriptors, we first need to get the keypoints. For this tutorial, we will use the FAST corners to generate keypoints (see [`fastcorners`](@ref).
0 commit comments