cv_cxx.jl 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # using StaticArrays
  2. include("typestructs.jl")
  3. include("Vec.jl")
  4. const dtypes = Union{UInt8, Int8, UInt16, Int16, Int32, Float32, Float64}
  5. size_t = UInt64
  6. using CxxWrap
  7. @wrapmodule(joinpath(@__DIR__,"lib","libopencv_julia"), :cv_wrap)
  8. function __init__()
  9. @initcxx
  10. if jlopencv_core_get_sizet()==4
  11. size_t = UInt32
  12. end
  13. end
  14. const Scalar = Union{Tuple{}, Tuple{Number}, Tuple{Number, Number}, Tuple{Number, Number, Number}, NTuple{4, Number}}
  15. include("Mat.jl")
  16. const InputArray = Union{AbstractArray{T, 3} where {T <: dtypes}, CxxMat}
  17. include("mat_conversion.jl")
  18. include("types_conversion.jl")
  19. function cpp_to_julia(var)
  20. return var
  21. end
  22. function julia_to_cpp(var)
  23. return var
  24. end
  25. function cpp_to_julia(var::Tuple)
  26. ret_arr = Array{Any, 1}()
  27. for it in var
  28. push!(ret_arr, cpp_to_julia(it))
  29. end
  30. return tuple(ret_arr...)
  31. end
  32. function cpp_to_julia(var::CxxBool)
  33. return Bool(var)
  34. end
  35. function julia_to_cpp(var::Bool)
  36. return CxxBool(var)
  37. end
  38. include("cv_cxx_wrap.jl")
  39. include("cv_manual_wrap.jl")