Hi!
I followed this tutorial to build an OpenCV binding for Julia. Now I am stuck with some functions I do not know how to use. I would like to use the OpenCV.split
function whose definition is below in cv_cxx_wrap.jl
:
function split(m::InputArray, mv::Array{InputArray, 1})
return cpp_to_julia(jlopencv_cv_cv_split(julia_to_cpp(m),julia_to_cpp(mv)))
end
split(m::InputArray; mv::Array{InputArray, 1} = (Array{InputArray, 1}())) = split(m, mv)
where InputArray = Union{OpenCV.CxxMat, AbstractArray{T,3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}}
.
My issue is that I get a no method matching
error, I think I do not pass the right argument type as the second argument of split
.
Here is a MWE with all the types I tried:
using OpenCV
noisy_img = rand(collect(UInt8, 0:255), (3, 320, 210))
out = Array{OpenCV.InputArray}[]
out = Array{OpenCV.Mat{UInt8}, 1}[]
out = Array{Array{UInt8,1}, 1}[]
out = OpenCV.CxxMat[]
out = AbstractArray{UInt8,3}[]
out = OpenCV.Mat{UInt8}[]
out = Array{UInt8,1}[]
out = Array{Array{UInt8,1}}(undef, 3)
out = Array{OpenCV.InputArray}(undef, 3)
out = Array{OpenCV.Mat{UInt8}}(undef, 3)
out = Array{OpenCV.Mat{UInt8}, 1}()
OpenCV.split(noisy_img, out) # Split RGB channels
Here is the error I get:
MethodError: no method matching split(::Array{UInt8,3}, ::Array{OpenCV.Mat{UInt8},1})
Closest candidates are:
split(::Union{OpenCV.CxxMat, AbstractArray{T,3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}}; mv) at /home/wahara/build/OpenCV/src/cv_cxx_wrap.jl:2307
split(::Union{OpenCV.CxxMat, AbstractArray{T,3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}}, !Matched::Array{Union{OpenCV.CxxMat, AbstractArray{T,3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}},1}) at /home/wahara/build/OpenCV/src/cv_cxx_wrap.jl:2304
top-level scope at functions.jl:138
I am new to Julia and my issues with OpenCV could come from the fact that I do not really know to handle types in Julia. Any help would be appreciated!