1- using FactCheck, Images, ImageFeatures , TestImages, Distributions, ColorTypes
1+ using Base . Test, ImageFeatures, Images , TestImages, Distributions, ColorTypes
22
3- facts (" BRISK" ) do
4-
5- brisk_params = BRISK (pattern_scale = 2.0 )
6- @fact brisk_params. pattern_scale --> 2.0
7- pt, st = ImageFeatures. _brisk_tables (2.0 )
8- @fact brisk_params. pattern_table --> pt
9- @fact brisk_params. smoothing_table --> st
3+ brisk_params = BRISK (pattern_scale = 2.0 )
4+ @test brisk_params. pattern_scale == 2.0
5+ pt, st = ImageFeatures. _brisk_tables (2.0 )
6+ @test brisk_params. pattern_table == pt
7+ @test brisk_params. smoothing_table == st
108
11- context ( " Testing with Standard Images - Lighthouse (Rotation 45)" ) do
12- img = testimage (" lighthouse" )
13- img_array_1 = convert (Array{Gray}, img)
14- img_array_2 = _warp (img_array_1, pi / 4 )
9+ @testset " Testing with Standard Images - Lighthouse (Rotation 45)" begin
10+ img = testimage (" lighthouse" )
11+ img_array_1 = convert (Array{Gray}, img)
12+ img_array_2 = _warp (img_array_1, pi / 4 )
1513
16- features_1 = Features (fastcorners (img_array_1, 12 , 0.35 ))
17- features_2 = Features (fastcorners (img_array_2, 12 , 0.35 ))
18- brisk_params = BRISK ()
14+ features_1 = Features (fastcorners (img_array_1, 12 , 0.35 ))
15+ features_2 = Features (fastcorners (img_array_2, 12 , 0.35 ))
16+ brisk_params = BRISK ()
1917
20- desc_1, ret_features_1 = create_descriptor (img_array_1, features_1, brisk_params)
21- desc_2, ret_features_2 = create_descriptor (img_array_2, features_2, brisk_params)
22-
23- matches = match_keypoints (Keypoints (ret_features_1), Keypoints (ret_features_2), desc_1, desc_2, 0.1 )
24- reverse_keypoints_1 = [_reverserotate (m[1 ], pi / 4 , (256 , 384 )) for m in matches]
25- @fact all (isapprox (rk[1 ], m[2 ][1 ], atol = 4 ) && isapprox (rk[2 ], m[2 ][2 ], atol = 4 ) for (rk, m) in zip (reverse_keypoints_1, matches)) --> true
26- end
18+ desc_1, ret_features_1 = create_descriptor (img_array_1, features_1, brisk_params)
19+ desc_2, ret_features_2 = create_descriptor (img_array_2, features_2, brisk_params)
2720
28- context (" Testing with Standard Images - Lighthouse (Rotation 45, Translation (50, 40))" ) do
29- img = testimage (" lighthouse" )
30- img_array_1 = convert (Array{Gray}, img)
31- img_temp_2 = _warp (img_array_1, pi / 4 )
32- img_array_2 = _warp (img_temp_2, 50 , 40 )
21+ matches = match_keypoints (Keypoints (ret_features_1), Keypoints (ret_features_2), desc_1, desc_2, 0.1 )
22+ reverse_keypoints_1 = [_reverserotate (m[1 ], pi / 4 , (256 , 384 )) for m in matches]
23+ @test all (isapprox (rk[1 ], m[2 ][1 ], atol = 4 ) && isapprox (rk[2 ], m[2 ][2 ], atol = 4 ) for (rk, m) in zip (reverse_keypoints_1, matches))
24+ end
25+
26+ @testset " Testing with Standard Images - Lighthouse (Rotation 45, Translation (50, 40))" begin
27+ img = testimage (" lighthouse" )
28+ img_array_1 = convert (Array{Gray}, img)
29+ img_temp_2 = _warp (img_array_1, pi / 4 )
30+ img_array_2 = _warp (img_temp_2, 50 , 40 )
3331
34- features_1 = Features (fastcorners (img_array_1, 12 , 0.35 ))
35- features_2 = Features (fastcorners (img_array_2, 12 , 0.35 ))
36- brisk_params = BRISK ()
32+ features_1 = Features (fastcorners (img_array_1, 12 , 0.35 ))
33+ features_2 = Features (fastcorners (img_array_2, 12 , 0.35 ))
34+ brisk_params = BRISK ()
3735
38- desc_1, ret_features_1 = create_descriptor (img_array_1, features_1, brisk_params)
39- desc_2, ret_features_2 = create_descriptor (img_array_2, features_2, brisk_params)
40- matches = match_keypoints (Keypoints (ret_features_1), Keypoints (ret_features_2), desc_1, desc_2, 0.1 )
41- reverse_keypoints_1 = [_reverserotate (m[1 ], pi / 4 , (256 , 384 )) + CartesianIndex (50 , 40 ) for m in matches]
42- @fact all (isapprox (rk[1 ], m[2 ][1 ], atol = 3 ) && isapprox (rk[2 ], m[2 ][2 ], atol = 3 ) for (rk, m) in zip (reverse_keypoints_1, matches)) --> true
36+ desc_1, ret_features_1 = create_descriptor (img_array_1, features_1, brisk_params)
37+ desc_2, ret_features_2 = create_descriptor (img_array_2, features_2, brisk_params)
38+ matches = match_keypoints (Keypoints (ret_features_1), Keypoints (ret_features_2), desc_1, desc_2, 0.1 )
39+ reverse_keypoints_1 = [_reverserotate (m[1 ], pi / 4 , (256 , 384 )) + CartesianIndex (50 , 40 ) for m in matches]
40+ @test all (isapprox (rk[1 ], m[2 ][1 ], atol = 3 ) && isapprox (rk[2 ], m[2 ][2 ], atol = 3 ) for (rk, m) in zip (reverse_keypoints_1, matches))
4341end
4442
45- context ( " Testing with Standard Images - Lighthouse (Rotation 75, Translation (50, 40))" ) do
46- img = testimage (" lighthouse" )
47- img_array_1 = convert (Array{Gray}, img)
48- img_temp_2 = _warp (img_array_1, 5 * pi / 6 )
49- img_array_2 = _warp (img_temp_2, 50 , 40 )
43+ @testset " Testing with Standard Images - Lighthouse (Rotation 75, Translation (50, 40))" begin
44+ img = testimage (" lighthouse" )
45+ img_array_1 = convert (Array{Gray}, img)
46+ img_temp_2 = _warp (img_array_1, 5 * pi / 6 )
47+ img_array_2 = _warp (img_temp_2, 50 , 40 )
5048
51- features_1 = Features (fastcorners (img_array_1, 12 , 0.35 ))
52- features_2 = Features (fastcorners (img_array_2, 12 , 0.35 ))
53- brisk_params = BRISK ()
49+ features_1 = Features (fastcorners (img_array_1, 12 , 0.35 ))
50+ features_2 = Features (fastcorners (img_array_2, 12 , 0.35 ))
51+ brisk_params = BRISK ()
5452
55- desc_1, ret_features_1 = create_descriptor (img_array_1, features_1, brisk_params)
56- desc_2, ret_features_2 = create_descriptor (img_array_2, features_2, brisk_params)
57- matches = match_keypoints (Keypoints (ret_features_1), Keypoints (ret_features_2), desc_1, desc_2, 0.1 )
58- reverse_keypoints_1 = [_reverserotate (m[1 ], 5 * pi / 6 , (256 , 384 )) + CartesianIndex (50 , 40 ) for m in matches]
59- @fact all (isapprox (rk[1 ], m[2 ][1 ], atol = 4 ) && isapprox (rk[2 ], m[2 ][2 ], atol = 4 ) for (rk, m) in zip (reverse_keypoints_1, matches)) --> true
60- end
53+ desc_1, ret_features_1 = create_descriptor (img_array_1, features_1, brisk_params)
54+ desc_2, ret_features_2 = create_descriptor (img_array_2, features_2, brisk_params)
55+ matches = match_keypoints (Keypoints (ret_features_1), Keypoints (ret_features_2), desc_1, desc_2, 0.1 )
56+ reverse_keypoints_1 = [_reverserotate (m[1 ], 5 * pi / 6 , (256 , 384 )) + CartesianIndex (50 , 40 ) for m in matches]
57+ @test all (isapprox (rk[1 ], m[2 ][1 ], atol = 4 ) && isapprox (rk[2 ], m[2 ][2 ], atol = 4 ) for (rk, m) in zip (reverse_keypoints_1, matches))
58+ end
6159
62- context ( " Testing with Standard Images - Lena (Rotation 45, Translation (10, 20))" ) do
63- img = testimage (" lena_gray_512" )
64- img_array_1 = convert (Array{Gray}, img)
65- img_temp_2 = _warp (img_array_1, pi / 4 )
66- img_array_2 = _warp (img_temp_2, 10 , 20 )
60+ @testset " Testing with Standard Images - Lena (Rotation 45, Translation (10, 20))" begin
61+ img = testimage (" lena_gray_512" )
62+ img_array_1 = convert (Array{Gray}, img)
63+ img_temp_2 = _warp (img_array_1, pi / 4 )
64+ img_array_2 = _warp (img_temp_2, 10 , 20 )
6765
68- features_1 = Features (fastcorners (img_array_1, 12 , 0.2 ))
69- features_2 = Features (fastcorners (img_array_2, 12 , 0.2 ))
70- brisk_params = BRISK ()
66+ features_1 = Features (fastcorners (img_array_1, 12 , 0.2 ))
67+ features_2 = Features (fastcorners (img_array_2, 12 , 0.2 ))
68+ brisk_params = BRISK ()
7169
72- desc_1, ret_features_1 = create_descriptor (img_array_1, features_1, brisk_params)
73- desc_2, ret_features_2 = create_descriptor (img_array_2, features_2, brisk_params)
74- matches = match_keypoints (Keypoints (ret_features_1), Keypoints (ret_features_2), desc_1, desc_2, 0.1 )
75- reverse_keypoints_1 = [_reverserotate (m[1 ], pi / 4 , (256 , 256 )) + CartesianIndex (10 , 20 ) for m in matches]
76- @fact all (isapprox (rk[1 ], m[2 ][1 ], atol = 4 ) && isapprox (rk[2 ], m[2 ][2 ], atol = 4 ) for (rk, m) in zip (reverse_keypoints_1, matches)) --> true
77- end
78- end
70+ desc_1, ret_features_1 = create_descriptor (img_array_1, features_1, brisk_params)
71+ desc_2, ret_features_2 = create_descriptor (img_array_2, features_2, brisk_params)
72+ matches = match_keypoints (Keypoints (ret_features_1), Keypoints (ret_features_2), desc_1, desc_2, 0.1 )
73+ reverse_keypoints_1 = [_reverserotate (m[1 ], pi / 4 , (256 , 256 )) + CartesianIndex (10 , 20 ) for m in matches]
74+ @test all (isapprox (rk[1 ], m[2 ][1 ], atol = 4 ) && isapprox (rk[2 ], m[2 ][2 ], atol = 4 ) for (rk, m) in zip (reverse_keypoints_1, matches))
75+ end
0 commit comments