# OpenCV function signatures

**URL:** <https://discourse.julialang.org/t/opencv-function-signatures/123145>\
**Category:** Signal and Image Processing\
**Tags:** opencv\
**Created:** [November 27, 2024, 6:02am UTC](https://discourse.julialang.org/t/opencv-function-signatures/123145 "2024-11-27T06:02:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [November 27, 2024, 6:02am UTC](https://discourse.julialang.org/t/opencv-function-signatures/123145/1 "2024-11-27T06:02:36Z")

</div>

I’m trying to use the camera calibration functions in [OpenCV.jl](https://github.com/JuliaImages/OpenCV.jl), but I can’t create arguments that would fit some of the functions’ signatures.

For example one of `OpenCV.calibrateCamera`’s method signatures is:

```julia
OpenCV.calibrateCamera(objectPoints::Vector{Union{OpenCV.CxxMat, AbstractArray{T, 3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}}},
                       imagePoints::Vector{Union{OpenCV.CxxMat, AbstractArray{T, 3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}}},
                       imageSize::OpenCV.Size{Int32},
                       cameraMatrix::Union{OpenCV.CxxMat, AbstractArray{T, 3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}},
                       distCoeffs::Union{OpenCV.CxxMat, AbstractArray{T, 3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}})

```

How can I, just to begin with, create an `objectPoints` vector that would fit that bill…? Naively I’d think that `[rand(Float32, 3, 1, 40) for _ in 1:5]` would work, but it doesn’t. Not even the unnecessarily complicated `Union{OpenCV.CxxMat, AbstractArray{Float32, 3}}[rand(Float32, 3, 1, 40) for _ in 1:5]` works.

Relevant issue: [OpenCV.projectPoints input type are confusing (maybe incorrect?) · Issue #40 · JuliaImages/OpenCV.jl · GitHub](https://github.com/JuliaImages/OpenCV.jl/issues/40)

---

<div class="post-metadata">

**Author:** ![yakir12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yakir12/32/297_2.png) [@yakir12](https://discourse.julialang.org/u/yakir12)\
**Post date:** [December 3, 2024, 12:10pm UTC](https://discourse.julialang.org/t/opencv-function-signatures/123145/2 "2024-12-03T12:10:02Z")

</div>

I needed to use `OpenCV.InputArray` on vectors of 3D arrays, and `OpenCV.Mat` on 3D arrays. See here for more details: [opencv\_contrib/modules/julia at 4.x · opencv/opencv\_contrib · GitHub](https://github.com/opencv/opencv_contrib/tree/4.x/modules/julia#usage)
