-
Notifications
You must be signed in to change notification settings - Fork 14

Description
So far, everything seems to be working. I'm converting some OpenCV C++ demos to Julia OpenCV. I'm having problems with the "polylines", in particular the second argument isn't matching.
I'm passing "Vector{Array{Int32, 3}}" but it's not matching with the second argument. Here's the error:
ERROR: LoadError: MethodError: no method matching polylines(::OpenCV.Mat{UInt8}, ::Vector{Array{Int32, 3}}, ::Bool, ::Tuple{Int64, Int64, Int64}; thickness=5)
Closest candidates are:
polylines(::Union{OpenCV.CxxMat, AbstractArray{T, 3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}}, ::Vector{Union{OpenCV.CxxMat, AbstractArray{T, 3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}}}, ::Bool, ::Union{Tuple{}, Tuple{Number}, Tuple{Number, Number}, Tuple{Number, Number, Number}, NTuple{4, Number}}; thickness, lineType, shift) at ~/.julia/artifacts/365b03f782c1e4bef434b771da708a9d46aeb711/OpenCV/src/cv_cxx_wrap.jl:1902
I'm learning Julia and was on the discord server. The comments that I'm getting is that the signature isn't quite right. They're suggesting: "Vector{<:cv.InputArray}".
Here's the source code:
import OpenCV as cv
const NAME = "Open CV Window"
pt(x, y) = cv.Point{Int32}(x, y)
sz(x, y) = cv.Size{Int32}(x, y)
pp(x, y) = begin
reshape([Int32(x), Int32(y)], (1, 1, 2))
end
function demo3()
try
img = cv.Mat(zeros(UInt8, (3, 640, 480)))
cv.line(img, pt(0, 0), pt(100, 200), (255, 0, 0); thickness=5)
cv.rectangle(img, pt(384, 0), pt(510, 128), (0, 0, 255); thickness=-1)
cv.ellipse(img, pt(256, 256), sz(100, 50), 0.0, 0.0, 180.0, (0, 255, 0); thickness=-1)
pts = [ pp(10, 5), pp(20, 30), pp(70, 20), pp(50, 10)]
println(typeof(pts))
cv.polylines(img, pts, false, (0, 255, 255); thickness=5)
cv.imshow(NAME, img)
cv.waitKey(0)
finally
cv.destroyAllWindows()
end
end
demo3()
Was playing around and saw the following
# this works
julia> Array{Int32, 3} <: cv.InputArray
true
# wrapping with "Vector" breaks
julia> Vector{Array{Int32, 3}} <: Vector{cv.InputArray}
false