Skip to content

Latest commit

 

History

History
60 lines (39 loc) · 1.63 KB

README.org.md

File metadata and controls

60 lines (39 loc) · 1.63 KB

OpenCV

A Julia wrapper for OpenCV based on Cxx.jl

Note that OpenCV.jl was started as an experimental project and not full-featured.

Features

  • core
  • Mat, UMat, MatExpr and matrix operations.
  • Mat and Julia array conversions
  • highgui
  • imgcodecs
  • imgproc
  • videoio

Dependencies

  • Cxx.jl
  • opencv v3.0.0 (automatically detected or installed).

Installation

You fist need to install Cxx.jl. And then, you can install OpenCV.jl by:

Pkg.clone("https://github.com/r9y9/OpenCV.jl.git")
Pkg.build("OpenCV")

This should install OpenCV.jl and resolve its binary dependency property. If you do not have opencv installed, Pkg.build("OpenCV") will try to install opencv v3.0.0 in the package directory.

Before using OpenCV.jl, you will need to add the opencv libraries path to LD_LIBRARY_PATH or DYLD_LIBRARY_PATH.

osx

export DYLD_LIBRARY_PATH=$HOME/.julia/v0.5/OpenCV/deps/usr/lib:$DYLD_LIBRARY_PATH

A minimum example

using OpenCV

img = cv2.imread("test.jpg")
img = cv2.UMat(img)
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
bin = cv2.threshold(gray, 170, 255, cv2.THRESH_OTSU)

cv2.imwrite("test_bin.jpg", bin)

See examples directory for more examples.

Note

You might know there already exists a Julia wrapper for opencv: OpenCV.jl. The reason why I created a new one is that I wanted to start with a small code base and re-design the interface.