You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
685 B
23 lines
685 B
# test simple blob detector |
|
img_gray = OpenCV.imread(joinpath(test_dir, "shared", "pic1.png"), OpenCV.IMREAD_GRAYSCALE) |
|
|
|
detector = OpenCV.SimpleBlobDetector_create() |
|
|
|
# Compare centers of keypoints and se how many of them match, |
|
kps = OpenCV.detect(detector, img_gray) |
|
|
|
kps_expect = [OpenCV.Point{Float32}(174.9114f0, 227.75146f0),OpenCV.Point{Float32}(106.925545f0, 179.5765f0)] |
|
for kp in kps |
|
closest_match = 100000 |
|
for kpe in kps_expect |
|
dx = kpe.x - kp.pt.x |
|
dy = kpe.y - kp.pt.y |
|
if sqrt(dx*dx+dy*dy) < closest_match |
|
closest_match = sqrt(dx*dx+dy*dy) |
|
end |
|
end |
|
|
|
@test closest_match < 10 |
|
end |
|
|
|
println("feature2d test passed")
|
|
|