From 4ceeed55d53a0b9da3a6f093951ecf54d26e2282 Mon Sep 17 00:00:00 2001 From: mathieu17g <72861595+mathieu17g@users.noreply.github.com> Date: Sat, 5 Aug 2023 09:45:42 +0200 Subject: [PATCH] Added tests failing without the fix --- test/brisk.jl | 7 +++++++ test/freak.jl | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/test/brisk.jl b/test/brisk.jl index 913be83..766a47e 100644 --- a/test/brisk.jl +++ b/test/brisk.jl @@ -75,3 +75,10 @@ end reverse_keypoints_1 = [_reverserotate(m[1], pi / 4, (256, 256)) + CartesianIndex(10, 20) for m in matches] @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)) end + +@testset "Testing descriptor creation with an image leading to sampled intensities > 1.0" begin + img = Gray.(testimage("autumn_leaves")) + # Number of contiguous pixels parameter in fastcorner needs to be low, to yield enough corners to hit a sample intensity > 1 + brisk_params = BRISK() + @test_nowarn create_descriptor(img, feats, brisk_params) +end diff --git a/test/freak.jl b/test/freak.jl index ed5f12c..892f781 100644 --- a/test/freak.jl +++ b/test/freak.jl @@ -74,3 +74,11 @@ end reverse_keypoints_1 = [_reverserotate(m[1], pi / 4, (256, 256)) + CartesianIndex(10, 20) for m in matches] @test isapprox(sum(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)), length(matches), atol = 2) end + +@testset "Testing descriptor creation with an image leading to sampled intensities > 1.0" begin + img = Gray.(testimage("autumn_leaves")) + # Number of contiguous pixels parametre in fastcorner needs to be low, to yield enough corners to hit a sample intensity > 1 + keypoints = Keypoints(fastcorners(img, 5, 0.3)) + freak_params = FREAK() + @test_nowarn create_descriptor(img, keypoints, freak_params) +end