Closed ibadami closed 7 years ago
Glad to hear it works. Just send me a PR with proposed changes and we decide then whether it makes send to make global changes to the naming of the functions. I did this project as a "fun" project on the side, so I am sure there is much room for improvement and extension of the current wrappers. . .
Cool. I'll do that. Thanks!
Hello again,
The name conflict I mentioned above is occurring in OpenCV_core.jl line 562.
After using OpenCV
I can no longer use size(array) function in Julia.
If I have used the size(array) function before I import OpenCV, and then write using OpenCV
I get following error:
julia> a = zeros(6,10)
6x10 Array{Float64,2}:
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
julia> using Cxx
julia> size(a)
(6,10)
julia> using OpenCV
WARNING: Base.Uint32 is deprecated, use UInt32 instead.
WARNING: Base.Uint32 is deprecated, use UInt32 instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: New definition
convert(Any, Any, Int64) at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_core.jl:448
is ambiguous with:
convert(Type{Base.SparseMatrix.CHOLMOD.Sparse}, Base.SparseMatrix.SparseMatrixCSC{#Tv<:Union{Base.Complex{Float64}, Float64}, Int64}, Integer) at sparse/cholmod.jl:842.
To fix, define
convert(Type{Base.SparseMatrix.CHOLMOD.Sparse}, Base.SparseMatrix.SparseMatrixCSC{#Tv<:Union{Base.Complex{Float64}, Float64}, Int64}, Int64)
before the new definition.
WARNING: New definition
convert(Any, Any, Int64) at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_core.jl:448
is ambiguous with:
convert(Type{Base.SparseMatrix.CHOLMOD.Sparse}, Union{Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}, Base.LinAlg.Hermitian{#T<:Any, Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}}, Base.LinAlg.Symmetric{#T<:Any, Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}}}, Any...) at sparse/cholmod.jl:872.
To fix, define
convert(Type{Base.SparseMatrix.CHOLMOD.Sparse}, Union{Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}, Base.LinAlg.Hermitian{#T<:Any, Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}}, Base.LinAlg.Symmetric{#T<:Any, Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}}}, Int64)
before the new definition.
WARNING: module Main should explicitly import transpose from Base
ERROR: LoadError: LoadError: LoadError: error in method definition: function Base.size must be explicitly imported to be extended
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
in include at ./boot.jl:261
in include_from_node1 at ./loading.jl:304
in require at ./loading.jl:243
while loading /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_core.jl, in expression starting on line 562
while loading /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_modules.jl, in expression starting on line 68
while loading /home/badami/.julia/v0.5/OpenCV/src/OpenCV.jl, in expression starting on line 136
I can reproduce this error every time.
I first tried to rename size(img) in OpenCV_core.jl to sizeof(img) to avoid the conflict. At first that worked, but later it start trowing me segmentation fault and exit from the Julia REPL.
Can you give me quick pointer if there are more things needed to be changed here?
If I change the order of using OpenCV
and size(array)
function I get following error:
julia> using OpenCV
WARNING: Base.Uint32 is deprecated, use UInt32 instead.
WARNING: Base.Uint32 is deprecated, use UInt32 instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: New definition
convert(Any, Any, Int64) at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_core.jl:448
is ambiguous with:
convert(Type{Base.SparseMatrix.CHOLMOD.Sparse}, Base.SparseMatrix.SparseMatrixCSC{#Tv<:Union{Base.Complex{Float64}, Float64}, Int64}, Integer) at sparse/cholmod.jl:842.
To fix, define
convert(Type{Base.SparseMatrix.CHOLMOD.Sparse}, Base.SparseMatrix.SparseMatrixCSC{#Tv<:Union{Base.Complex{Float64}, Float64}, Int64}, Int64)
before the new definition.
WARNING: New definition
convert(Any, Any, Int64) at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_core.jl:448
is ambiguous with:
convert(Type{Base.SparseMatrix.CHOLMOD.Sparse}, Union{Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}, Base.LinAlg.Hermitian{#T<:Any, Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}}, Base.LinAlg.Symmetric{#T<:Any, Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}}}, Any...) at sparse/cholmod.jl:872.
To fix, define
convert(Type{Base.SparseMatrix.CHOLMOD.Sparse}, Union{Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}, Base.LinAlg.Hermitian{#T<:Any, Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}}, Base.LinAlg.Symmetric{#T<:Any, Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Int64}}}, Int64)
before the new definition.
WARNING: module Main should explicitly import transpose from Base
WARNING: Base.Uint8 is deprecated, use UInt8 instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.Uint64 is deprecated, use UInt64 instead.
WARNING: Base.Uint64 is deprecated, use UInt64 instead.
WARNING: Base.Uint64 is deprecated, use UInt64 instead.
WARNING: Base.Uint64 is deprecated, use UInt64 instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: deprecated syntax "println (" at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_Mat.jl:158.
Use "println(" instead.
WARNING: deprecated syntax "println (" at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_Mat.jl:161.
Use "println(" instead.
WARNING: deprecated syntax "println (" at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_Mat.jl:164.
Use "println(" instead.
WARNING: deprecated syntax "println (" at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_Mat.jl:167.
Use "println(" instead.
WARNING: deprecated syntax "println (" at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_Mat.jl:170.
Use "println(" instead.
WARNING: deprecated syntax "println (" at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_Mat.jl:173.
Use "println(" instead.
WARNING: deprecated syntax "println (" at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_Mat.jl:176.
Use "println(" instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: deprecated syntax "videocam (" at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_util.jl:223.
Use "videocam(" instead.
WARNING: deprecated syntax "webstream (" at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_util.jl:249.
Use "webstream(" instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: deprecated syntax "videoWrite (" at /home/badami/.julia/v0.5/OpenCV/./src/OpenCV_util.jl:273.
Use "videoWrite(" instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: Base.String is deprecated, use AbstractString instead.
WARNING: requiring "OpenCV" in module "Main" did not define a corresponding module.
julia> a = zeros(6,10)
6x10 Array{Float64,2}:
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
julia> size(a)
ERROR: Got bad type information while compiling Cxx.CppNNS{Tuple{:size}} (got Array{Float64,2} for argument 1)
in error at ./error.jl:21
in check_args at /home/badami/.julia/v0.5/Cxx/src/codegen.jl:427
Errr I think the sizeof() function also exist in C++ library. After changing the name to sizeofimage(), there is no conflict or compiling error.
This issue was not reproduced with size(Mat)
with the latest julia master 0.6.0, but using sizeofimage()
is well justified - so it will be added in an upcoming commit.
I am currently using the OpenCV.jl quite successfully. There is one minor problem though the size() function of julia is overloaded by the size() function of OpenCV after
using OpenCV
. I guess the reason is the size function of OpenCV is defined as size() instead of cvSize(). Do you think it would be a good idea to use cv prefix for all the opencv functions/datatypes forI can keep changing them as I use them and send you the pull request if you like.