[SURF] segfault Algorithm::* methods for DescriptorExtractor (Bug #2325)


Added by Mr. Luk over 12 years ago. Updated over 12 years ago.


Status:Done Start date:2012-08-30
Priority:High Due date:
Assignee:Vadim Pisarevsky % Done:

0%

Category:python bindings
Target version:2.4.3
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

The Algorithm interface for Surf seems to be broken: Creating a FeatureDetector works as expected.
Accessing Algorithm methods through DescriptorExtractor gives segfaults (see below).

Platform: 64bit debian squeeze, official opencv 2.4.2 release, python 2.7.3

Python 2.7.3 (default, Jul 17 2012, 14:26:15) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> s1 = cv2.FeatureDetector_create('SURF')
>>> s1.paramHelp('extended')
''
>>> s2 = cv2.DescriptorExtractor_create('SURF')
>>> s2.paramHelp('extended')

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff5cd871d in cv::Algorithm::paramHelp(std::string const&) const ()
   from /home/luk/apps/opencv-2.4/lib/libopencv_core.so.2.4
#2  0x00007ffff60bf881 in pyopencv_Algorithm_paramHelp(_object*, _object*, _object*) ()
   from /home/luk/extra/python-2.7/lib/python2.7/site-packages/cv2.so
#3  0x00007ffff7afeef0 in call_function (f=0xd17a80, throwflag=<value optimized out>) at Python/ceval.c:4021
#4  PyEval_EvalFrameEx (f=0xd17a80, throwflag=<value optimized out>) at Python/ceval.c:2666
#5  0x00007ffff7b00728 in PyEval_EvalCodeEx (co=0x69f830, globals=<value optimized out>, locals=<value optimized out>, args=0x0, 
    argcount=13730368, kws=<value optimized out>, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
#6  0x00007ffff7b00842 in PyEval_EvalCode (co=0xc85748, globals=0xc85748, locals=0x7fffffffddb0) at Python/ceval.c:667
#7  0x00007ffff7b20275 in run_mod (fp=<value optimized out>, filename=0x7ffff7b6a73f "<stdin>", flags=0x7fffffffe1f0)
    at Python/pythonrun.c:1353
#8  PyRun_InteractiveOneFlags (fp=<value optimized out>, filename=0x7ffff7b6a73f "<stdin>", flags=0x7fffffffe1f0)
    at Python/pythonrun.c:852
#9  0x00007ffff7b2049e in PyRun_InteractiveLoopFlags (fp=0x7ffff77e36a0, filename=0x7ffff7b6a73f "<stdin>", flags=0x7fffffffe1f0)
    at Python/pythonrun.c:772
#10 0x00007ffff7b20bac in PyRun_AnyFileExFlags (fp=0x7ffff77e36a0, filename=0x7ffff7b6a73f "<stdin>", closeit=0, 
    flags=0x7fffffffe1f0) at Python/pythonrun.c:741
#11 0x00007ffff7b36431 in Py_Main (argc=0, argv=<value optimized out>) at Modules/main.c:639
#12 0x00007ffff74a5c8d in __libc_start_main (main=<value optimized out>, argc=<value optimized out>, ubp_av=<value optimized out>, 
    init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, stack_end=0x7fffffffe308)
    at libc-start.c:228
#13 0x00000000004006a9 in _start ()
(gdb) 


bug-2325-surf.diff - patch for surf (14.4 kB) Mr. Luk, 2012-08-31 02:09 pm


Associated revisions

Revision 84087a85
Added by Vadim Pisarevsky over 12 years ago

fixed crash in Python's SURF wrapper (bug #2325)

Revision 61976b84
Added by Roman Donchenko about 11 years ago

Merge pull request #2325 from alalek:perf_fix

History

Updated by Mr. Luk over 12 years ago

Update: Affects all classes that inherit from cv::Feature2D, particularly SURF, SIFT and ORB (i.e. classes that implement the feature detector and descriptor extractor in the same class).

Updated by Andrey Kamaev over 12 years ago

I think it is related to build warning:

[335/873] Generating pyopencv_generated_funcs.h, pyopencv_generated_func_tab.h, pyopencv_generated_types.h, pyopencv_generated_type_reg.h, pyopencv_generated_const_reg.h
Warning: class Feature2D has more than 1 base class (not supported by Python C extensions)
Bases:  cv::FeatureDetector, cv::DescriptorExtractor
Only the first base class will be used

Updated by Mr. Luk over 12 years ago

I attached a patch for surf by splitting SURF into SurfFeatureDetector and SurfDescriptorExtractor, which only inherit from one class each.
creating an detector/extractor is now easy and options can be easily changed:

_surf_detecor = cv2.FeatureDetector_create('SurfDetector')
_surf_extractor = cv2.DescriptorExtractor_create('SurfExtractor')
_surf_extractor.setBool('extended', False)

Updated by Diego Varese over 12 years ago

When will this patch be integrated? It's causing OpenCV 2.4.2 Feature detection to be unusable.

Updated by Vadim Pisarevsky over 12 years ago

thanks for the report! the problem is fixed in 84087a

  • Target version set to 2.4.3
  • Status changed from Open to Done

Updated by Mr. Luk over 12 years ago

cool, thank you!

Also available in: Atom PDF