OpenCV function signatures

I’m trying to use the camera calibration functions in 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:

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

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

1 Like