Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ORB detector Segmentation Fault - Python

Hi,

Whenever I try to use the ORB detector like described in the tutorial I get a segmentation fault. To be exact, when I start this small script:

import cv2 as cv
im = cv.imread('butterfly.jpg', 0)
orb = cv.ORB()
kps = orb.detect(im, None)

I get this error in PyCharm:

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

and this if I start in shell:

Segmentation fault (core dumped)

I am using Python 3.6.1, OpenCV 4.1.1 (built from source) and Ubuntu 16.04 LTS.

I also tried running it in gdb and backtraced it with these commands:

gdb -ex r --args python3 test.py
bt

and got the following output:

Thread 1 "python3" received signal SIGSEGV, Segmentation fault.
0x00007fffe7a4c360 in pyopencv_cv_Feature2D_detect(_object*, _object*, _object*) () from /usr/local/lib/python3.6/site-packages/cv2/python-3.6/cv2.cpython-36m-x86_64-linux-gnu.so
(gdb) bt
#0  0x00007fffe7a4c360 in pyopencv_cv_Feature2D_detect(_object*, _object*, _object*) () from /usr/local/lib/python3.6/site-packages/cv2/python-3.6/cv2.cpython-36m-x86_64-linux-gnu.so
#1  0x00000000004addfc in _PyCFunction_FastCallDict (kwargs=0x0, nargs=<optimized out>, args=0x7ffff7f71ba0, func_obj=0x7fffd61f9048) at Objects/methodobject.c:231
#2  _PyCFunction_FastCallKeywords (func=func@entry=0x7fffd61f9048, stack=stack@entry=0x7ffff7f71ba0, nargs=<optimized out>, kwnames=kwnames@entry=0x0) at Objects/methodobject.c:295
#3  0x000000000053e3ae in call_function (pp_stack=pp_stack@entry=0x7fffffffd920, oparg=oparg@entry=2, kwnames=kwnames@entry=0x0) at Python/ceval.c:4798
#4  0x0000000000542c17 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3284
#5  0x000000000053e015 in PyEval_EvalFrameEx (throwflag=0, f=0x7ffff7f71a20) at Python/ceval.c:718
#6  _PyEval_EvalCodeWithName (_co=_co@entry=0x7ffff7efca50, globals=globals@entry=0x7ffff7f5a078, locals=locals@entry=0x7ffff7efca50, args=args@entry=0x0, argcount=argcount@entry=0, 
    kwnames=kwnames@entry=0x0, kwargs=0x8, kwcount=0, kwstep=2, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x0, qualname=0x0) at Python/ceval.c:4128
#7  0x000000000053ee43 in PyEval_EvalCodeEx (closure=0x0, kwdefs=0x0, defcount=0, defs=0x0, kwcount=0, kws=0x0, argcount=0, args=0x0, locals=locals@entry=0x7ffff7efca50, 
    globals=globals@entry=0x7ffff7f5a078, _co=_co@entry=0x7ffff7efca50) at Python/ceval.c:4149
#8  PyEval_EvalCode (co=co@entry=0x7ffff7efca50, globals=globals@entry=0x7ffff7f42288, locals=locals@entry=0x7ffff7f42288) at Python/ceval.c:695
#9  0x000000000042740f in run_mod (arena=0x7ffff7f5a078, flags=0x7fffffffdc00, locals=0x7ffff7f42288, globals=0x7ffff7f42288, filename=0x7ffff7e843e8, mod=0x933048) at Python/pythonrun.c:980
#10 PyRun_FileExFlags (fp=0x983f20, filename_str=<optimized out>, start=<optimized out>, globals=0x7ffff7f42288, locals=0x7ffff7f42288, closeit=1, flags=0x7fffffffdc00) at Python/pythonrun.c:933
#11 0x000000000042763c in PyRun_SimpleFileExFlags (fp=0x983f20, filename=<optimized out>, closeit=1, flags=0x7fffffffdc00) at Python/pythonrun.c:396
#12 0x000000000043b975 in run_file (p_cf=0x7fffffffdc00, filename=0x8f91e0 L"test.py", fp=0x983f20) at Modules/main.c:338
#13 Py_Main (argc=argc@entry=2, argv=argv@entry=0x8f7010) at Modules/main.c:809
#14 0x000000000041dc52 in main (argc=2, argv=<optimized out>) at ./Programs/python.c:69

I do not understand much of it. I read that for debugging python you can use py-bt, but it did not seem to work for my version. If someone can tell me a workaround, I would be glad, too.

I really hope someone can help me with this. Thank you!