chessboard_corners.jl 583 B

1234567891011121314151617181920
  1. using OpenCV
  2. const cv = OpenCV
  3. # chess1.png is at https://raw.githubusercontent.com/opencv/opencv_extra/master/testdata/cv/cameracalibration/chess1.png
  4. img = cv.imread("chess1.png",cv.IMREAD_GRAYSCALE)
  5. climg = cv.cvtColor(img, cv.COLOR_GRAY2BGR)
  6. # Find the chess board corners
  7. ret, corners = cv.findChessboardCorners(img, cv.Size{Int32}(7,5))
  8. # If found, add object points, image points (after refining them)
  9. if ret
  10. climg = cv.drawChessboardCorners(climg, cv.Size{Int32}(7,5), corners,ret)
  11. cv.imshow("img",climg)
  12. cv.waitKey(Int32(0))
  13. cv.destroyAllWindows()
  14. end