simpleBlobDetector_test.jl 630 B

1234567891011121314151617181920212223242526272829
  1. using OpenCV
  2. println("")
  3. println("This is a simple exmample demonstrating the use of SimpleBlobDetector")
  4. println("")
  5. print("Path to image: ")
  6. img_dir = readline()
  7. img = OpenCV.imread(img_dir)
  8. img_gray = OpenCV.cvtColor(img, OpenCV.COLOR_BGR2GRAY)
  9. OpenCV.namedWindow("Img - Color")
  10. OpenCV.namedWindow("Img - Gray")
  11. OpenCV.imshow("Img - Color", img)
  12. OpenCV.imshow("Img - Gray", img_gray)
  13. OpenCV.waitKey(Int32(0))
  14. OpenCV.destroyAllWindows()
  15. detector = OpenCV.SimpleBlobDetector_create()
  16. kps = OpenCV.detect(detector, img_gray)
  17. println("Number of keypoints: ", size(kps))
  18. for kp in kps
  19. println(kp.pt, "\t", kp.size)
  20. end