test_feature2d.jl 685 B

1234567891011121314151617181920212223
  1. # test simple blob detector
  2. img_gray = OpenCV.imread(joinpath(test_dir, "shared", "pic1.png"), OpenCV.IMREAD_GRAYSCALE)
  3. detector = OpenCV.SimpleBlobDetector_create()
  4. # Compare centers of keypoints and se how many of them match,
  5. kps = OpenCV.detect(detector, img_gray)
  6. kps_expect = [OpenCV.Point{Float32}(174.9114f0, 227.75146f0),OpenCV.Point{Float32}(106.925545f0, 179.5765f0)]
  7. for kp in kps
  8. closest_match = 100000
  9. for kpe in kps_expect
  10. dx = kpe.x - kp.pt.x
  11. dy = kpe.y - kp.pt.y
  12. if sqrt(dx*dx+dy*dy) < closest_match
  13. closest_match = sqrt(dx*dx+dy*dy)
  14. end
  15. end
  16. @test closest_match < 10
  17. end
  18. println("feature2d test passed")