Skip to content

Julia binding findContours not work #2788

@peng1999

Description

@peng1999
System information (version)
  • OpenCV => 4.5.0
  • Operating System / Platform => Manjaro Linux 20.2
  • Compiler => GCC 10.2.0
  • Julia => 1.5.3
Detailed description

When using OpenCV.findContours, a MethodError is thrown instead of returning results.

Steps to reproduce
using OpenCV

const cv = OpenCV

# chess1.png is at https://github.com/opencv/opencv_extra/raw/master/testdata/cv/cameracalibration/chess1.png
img = cv.imread("chess1.png",cv.IMREAD_GRAYSCALE)
_, bin = cv.threshold(img, 100., 256., cv.THRESH_BINARY)

cv.findContours(bin, cv.RETR_EXTERNAL, cv.CHAIN_APPROX_SIMPLE)

an error is thorwn:

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/user/.julia/packages/CxxWrap/ZOkSN/src/CxxWrap.jl:590
Stacktrace:
 [1] cpp_to_julia(::OpenCV.CxxMatDereferenced) at /home/user/.cache/yay/opencv-git/src/build/OpenCV/src/mat_conversion.jl:20
 [2] cpp_to_julia at /home/user/.cache/yay/opencv-git/src/build/OpenCV/src/mat_conversion.jl:103 [inlined]
 [3] cpp_to_julia at /home/user/.cache/yay/opencv-git/src/build/OpenCV/src/cv_cxx.jl:36 [inlined]
 [4] findContours at /home/user/.cache/yay/opencv-git/src/build/OpenCV/src/cv_cxx_wrap.jl:2207 [inlined]
 [5] #findContours#225 at /home/user/.cache/yay/opencv-git/src/build/OpenCV/src/cv_cxx_wrap.jl:2209 [inlined]
 [6] findContours(::OpenCV.Mat{UInt8}, ::Int32, ::Int32) at /home/user/.cache/yay/opencv-git/src/build/OpenCV/src/cv_cxx_wrap.jl:2209
 [7] top-level scope at REPL[9]:1
 [8] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions