CVCore.jl

CVCoreModule.

Core functionality

Basic usage

The primary export of the package is Mat{T,N}, which is the Julia type for cv::Mat. Mat{T,N} is designed to be a subtype of AbstractArray{T,N}. It has element type (T) and dimension (N) as type parameters, whereas cv::Mat doesn't. Note that matrix construction interface is different between Julia and C++. cv::Mat(3,3,CV_8U) in C++ can be translated in Julia as Mat{UInt8}(3,3).

Create uninitialized matrix:

using CVCore

julia> A = Mat{Float64}(3,3)
3×3 CVCore.Mat{Float64,2}:
   3.39519e-313  4.94066e-324   2.122e-314
 NaN             1.72723e-77   -2.32036e77
   1.97626e-323  0.0            0.0

Create matrix filled with Scalar (cv::Scalar)

julia> A = Mat{Float64}(3,3,Scalar(1))
3×3 CVCore.Mat{Float64,2}:
 1.0  1.0  1.0
 1.0  1.0  1.0
 1.0  1.0  1.0

Matirx operations

julia> A * A
CVCore.MatExpr{Float64,2}
3×3 CVCore.Mat{Float64,2}:
 3.0  3.0  3.0
 3.0  3.0  3.0
 3.0  3.0  3.0

julia> A + A
CVCore.MatExpr{Float64,2}
3×3 CVCore.Mat{Float64,2}:
 2.0  2.0  2.0
 2.0  2.0  2.0
 2.0  2.0  2.0

julia> A - A
CVCore.MatExpr{Float64,2}
3×3 CVCore.Mat{Float64,2}:
 0.0  0.0  0.0
 0.0  0.0  0.0
 0.0  0.0  0.0

Create multi-channel matrix

julia> A = Mat{Float64}(3,3,3,Scalar(1,2,3))
3×3×3 CVCore.Mat{Float64,3}:
[:, :, 1] =
 1.0  1.0  1.0
 1.0  1.0  1.0
 1.0  1.0  1.0

[:, :, 2] =
 2.0  2.0  2.0
 2.0  2.0  2.0
 2.0  2.0  2.0

[:, :, 3] =
 3.0  3.0  3.0
 3.0  3.0  3.0
 3.0  3.0  3.0

Conversion between Mat{T,N} and Array{T,N}

julia> B = Array(A)
3×3 Array{Float64,2}:
 1.0  1.0  1.0
 1.0  1.0  1.0
 1.0  1.0  1.0

julia> C = Mat(B)
3×3 CVCore.Mat{Float64,2}:
 1.0  1.0  1.0
 1.0  1.0  1.0
 1.0  1.0  1.0

Note that Mat(B) where B is an array shares the underlying data.

source

Index

Reference

AbstractCvMat{T,N} represents N-dimentional arrays in OpenCV (cv::Mat, cv::UMat, etc), which element type are bound to T.

source
CVCore.MatType.

Mat{T,N} represents cv::Mat with encoded type information

Mat{T,N} keeps cv::Mat instance with: element type T and dimention N. Hence, in fact it behaves like cv::Mat_<T>. Note that Mat stores its internal data in column-major order, while Julia's arrays are in row-major.

NOTE: Mat{T,N} supports multi-channel 2-dimentional matrices and single-channel 2-dimentional matrices for now. Should be extended for N-dimentional cases.

source
CVCore.MatExprType.

MatExpr{T,N} represents cv::MatExpr with encoded type information

T and N represents the element type and the dimension of Mat, respectively.

TODO: should consder wherther I make this a subtype of AbstractCvMat{T,N}

source
CVCore.UMatType.

UMat{T,N} represents cv::UMat with encoded type information

T and N represents the element type and the dimension of Mat, respectively.

source
CVCore.cvdepthMethod.

Determine cv::Mat depth from Julia type

source
CVCore.handleFunction.

Returns a refrence of the interal structure

source
CVCore.jltypeMethod.

Determine julia type from the depth of cv::Mat

source
Core.TypeType.

Single-channel 2-dimentaionl mat constructor with user provided data

source
Core.TypeType.

Multi-channel 2-dimentaionl mat constructor with user provided data

source
Core.TypeMethod.

Generic constructor

source
Core.TypeMethod.

Multi-chanel 2-dimentional mat constructor

source
Core.TypeMethod.

Single-channel 2-dimentional mat constructor

source
Core.TypeMethod.

Generic constructor

source
Core.TypeMethod.

Empty mat constructor

source