Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no method matching jlopencv_core_Mat_mutable_data(::OpenCV.CxxMatDereferenced) #5

Open
timholy opened this issue Sep 12, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@timholy
Copy link
Member

timholy commented Sep 12, 2021

julia> img = OpenCV.Mat(rand(UInt8, 3, 32, 32));

julia> ym = OpenCV.cvtColor(img, OpenCV.COLOR_BGR2LAB);

julia> vm = OpenCV.split(ym)
ERROR: MethodError: no method matching jlopencv_core_Mat_mutable_data(::OpenCV.CxxMatDereferenced)
Closest candidates are:
  jlopencv_core_Mat_mutable_data(::Union{CxxWrap.CxxWrapCore.SmartPointer{T2}, T2} where T2<:OpenCV.CxxMatAllocated) at /home/tim/.julia/packages/CxxWrap/OcN1Z/src/CxxWrap.jl:618
Stacktrace:
 [1] cpp_to_julia(mat::OpenCV.CxxMatDereferenced)
   @ OpenCV ~/.julia/artifacts/7f7ecae944127299b78b8a360c8b5a5f94df8b2f/OpenCV/src/mat_conversion.jl:20
 [2] cpp_to_julia
   @ ~/.julia/artifacts/7f7ecae944127299b78b8a360c8b5a5f94df8b2f/OpenCV/src/mat_conversion.jl:103 [inlined]
 [3] split(m::OpenCV.Mat{UInt8}, mv::Vector{Union{OpenCV.CxxMat, AbstractArray{T, 3} where T<:Union{Float32, Float64, Int16, Int32, Int8, UInt16, UInt8}}})
   @ OpenCV ~/.julia/artifacts/7f7ecae944127299b78b8a360c8b5a5f94df8b2f/OpenCV/src/cv_cxx_wrap.jl:2305
 [4] #split#239
   @ ~/.julia/artifacts/7f7ecae944127299b78b8a360c8b5a5f94df8b2f/OpenCV/src/cv_cxx_wrap.jl:2307 [inlined]
 [5] split(m::OpenCV.Mat{UInt8})
   @ OpenCV ~/.julia/artifacts/7f7ecae944127299b78b8a360c8b5a5f94df8b2f/OpenCV/src/cv_cxx_wrap.jl:2307
 [6] top-level scope
   @ REPL[27]:1

Also noted in https://discourse.julialang.org/t/julia-opencv-binding-no-method-matching-jlopencv-core-mat-mutable-data-in-split-function/58284 (with the same split function).

@archit120
Copy link
Member

This seems to cause many other functions to fail aswell. I am not sure how to fix this. jlopencv_core_Mat_mutable_data is defined like this and CxxMat is the Julia type for C++ Mat

    mod.method("jlopencv_core_Mat_mutable_data", [](Mat m) {
        return make_tuple(m.data, m.type(), m.channels(), m.size[1], m.size[0], m.step[1], m.step[0]);
    });

@timholy
Copy link
Member Author

timholy commented Sep 17, 2021

But it's a CxxMatDereferenced, not a CxxMat. Where does that come from?

julia> OpenCV.CxxMatDereferenced <: OpenCV.CxxMatAllocated
false

julia> OpenCV.CxxMatDereferenced <: OpenCV.CxxWrap.CxxWrapCore.SmartPointer{OpenCV.CxxMatAllocated}
false

Is this a CxxWrap issue, or something else?

@codedocpp
Copy link

I try to add a copy with x in this function (filename "mat_conversion.jl") and it successfully run, but I'm not sure if that will make the code less efficient.
function cpp_to_julia(var::CxxWrap.StdVector{T}) where {T <: CxxMat}
ret = Array{Mat, 1}()
for x in var
y=copy(x)
push!(ret, cpp_to_julia(y))
end
return ret
end

@rakeshksr
Copy link
Member

@timholy Does this issue still valid with latest version?

@rakeshksr rakeshksr added the bug Something isn't working label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants