maxruby / OpenCV.jl

The OpenCV (C++) interface for Julia
Other
104 stars 28 forks source link

Method Error related to unsafe_load #25

Closed kvmanohar22 closed 7 years ago

kvmanohar22 commented 7 years ago

Having resolved this issue, when I try to run any of the commands related to OpenCV.jl, I get this warning while importing OpenCV and

julia> using OpenCV
WARNING: requiring "OpenCV" in module "Main" did not define a corresponding module.

then this error :

julia> img = Mat()
(class cv::Mat) {
 .flags = (int &) 1124007936
 .dims = (int &) 0
 .rows = (int &) 0
 .cols = (int &) 0
 .data = (char *&) Ptr{UInt8} @0x0000000000000000
 .datastart = (char *&) Ptr{UInt8} @0x0000000000000000
 .dataend = (char *&) Ptr{UInt8} @0x0000000000000000
 .datalimit = (char *&) Ptr{UInt8} @0x0000000000000000
 .allocator = (class cv::MatAllocator *&) (class cv::MatAllocator *) @0x0000000000000000

 .u = (struct cv::UMatData *&) (struct cv::UMatData *) @0x0000000000000000

 .size = (struct cv::MatSize &) {
 .p = (int *&) Ptr{Int32} @0x00007f6c4ef9cfd8
}

 .step = (struct cv::MatStep &) {
 .p = (unsigned long *&) Ptr{UInt64} @0x00007f6c4ef9d020
 .buf = (unsigned long (&)[]) Error showing value of type Cxx.CppValue{Cxx.CxxQualType{Cxx.CppBaseType{Symbol("cv::Mat")},(false, false, false)},96}:
ERROR: MethodError: no method matching unsafe_load(::Cxx.CppRef{Cxx.CxxArrayType{UInt64},(false, false, false)})
Closest candidates are:
  unsafe_load(::Ptr) at pointer.jl:83
  unsafe_load(::Ptr, ::Integer) at pointer.jl:83
  unsafe_load(::Cxx.CppRef{T<:Union{Bool, Float32, Float64, Int16, Int32, Int64, Int8, Ptr, UInt16, UInt32, UInt64, UInt8},CVR} where CVR) where T<:Union{Bool, Float32, Float64, Int16, Int32, Int64, Int8, Ptr, UInt16, UInt32, UInt64, UInt8} at /home/kv/.julia/v0.6/Cxx/src/cxxtypes.jl:108
  ...
Stacktrace:
 [1] show(::IOContext{Base.Terminals.TTYTerminal}, ::Cxx.CppRef{Cxx.CppBaseType{Symbol("cv::MatStep")},(false, false, false)}) at /home/kv/.julia/v0.6/Cxx/src/show.jl:9 (repeats 2 times)
 [2] display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::MIME{Symbol("text/plain")}, ::Cxx.CppValue{Cxx.CxxQualType{Cxx.CppBaseType{Symbol("cv::Mat")},(false, false, false)},96}) at ./REPL.jl:122
 [3] display(::Base.REPL.REPLDisplay{Base.REPL.LineEditREPL}, ::Cxx.CppValue{Cxx.CxxQualType{Cxx.CppBaseType{Symbol("cv::Mat")},(false, false, false)},96}) at ./REPL.jl:125
 [4] display(::Cxx.CppValue{Cxx.CxxQualType{Cxx.CppBaseType{Symbol("cv::Mat")},(false, false, false)},96}) at ./multimedia.jl:194

julia> 

Setup details :

$ uname -a
Linux kv 3.19.0-78-generic #86~14.04.1-Ubuntu SMP Tue Dec 6 17:58:35 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$  

$ julia --version
julia version 0.6.0-pre.alpha
maxruby commented 7 years ago

Yes, unfortunately I saw this too on OSX 10.12.3, so I filed it already at Cxx.jl, see https://github.com/Keno/Cxx.jl/issues/327

Forutnately, this is only a Base.show Error and it will not affect the output of the OpenCV.jl functions. It means that unfortunately, we do not get the correct output of our function invocations. Having said that, I previously turned off all this output from Cxx.jlas I found it too verbose and unnecessary for regular work with OpenCV.jl.

The simple way to silence this error is to comment out every line with println in show.jl.

maxruby commented 7 years ago

FYI - the WARNING: requiring "OpenCV" in module "Main" did not define a corresponding module. has nothing to do with this error. This has to do with the fact that we are not exporting OpenCVas a module and will be fixed once it is added to the JuliaImages project.

Because this is strictly not an OpenCV.jl error but rather a Cxx.jl issue, I will close this issue. If you want further updates on it, please follow Keno/Cxx.jl#327