Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEGFAULT using SIFT in Linux 5.4.53, Python 3.8.5 #17988

Closed
4 tasks done
blakev opened this issue Jul 30, 2020 · 2 comments
Closed
4 tasks done

SEGFAULT using SIFT in Linux 5.4.53, Python 3.8.5 #17988

blakev opened this issue Jul 30, 2020 · 2 comments
Labels
category: features2d question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org

Comments

@blakev
Copy link

blakev commented Jul 30, 2020

System information (version)
OS: Arch Linux x86_64
Kernel: 5.4.53-1-lts
Uptime: 3 hours, 16 mins
Packages: 2145 (pacman)
Shell: bash 5.0.17
Resolution: 2048x1152, 2048x1152, 3840x2160, 2560x1440
DE: Xfce
WM: Xfwm4
WM Theme: Numix-Frost-Light
Theme: Adwaita-dark [GTK2], Numix-Frost-Light [GTK3]
Icons: elementary-xfce-dark [GTK2], Numix-Square [GTK3]
Terminal: alacritty
CPU: AMD Ryzen Threadripper 2950X (24) @ 3.500GHz
GPU: NVIDIA GeForce GTX 1080 Ti
GPU: NVIDIA GeForce GTX 1070 Ti
Memory: 13031MiB / 31972MiB
Python 3.8.5
gcc version 10.1.0 (GCC)
opencv-contrib-python==4.3.0.36
opencv-contrib-python-headless==4.3.0.36
Detailed description

SEGFAULT when trying to use SIFT algorithm, detectAndCompute.

Steps to reproduce
  • a.png
  • b.png
import cv2

a = cv2.imread('/tmp/a.png')
b = cv2.imread('/tmp/b.png')

sift = cv2.xfeatures2d_SIFT()
k_a, d_a = sift.detectAndCompute(a, None)
k_b, d_b = sift.detectAndCompute(b, None)
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    answers.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc
@asmorkalov
Copy link
Contributor

SIFT algorithm migrated back to core OpenCV repository and you do not need to use contrib since release 4.4. Also the Algorithm is implemented subclass of cv::Algorithm in C++ code and you need to use create() call to initialize it correctly. Proper code:

import cv2

a = cv2.imread('a.png')
b = cv2.imread('b.png')

sift = cv2.SIFT().create()
k_a, d_a = sift.detectAndCompute(a, None)
print(k_a, d_a)
k_b, d_b = sift.detectAndCompute(b, None)
print(k_b, d_b)

@asmorkalov asmorkalov added the question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org label Jul 30, 2020
@blakev
Copy link
Author

blakev commented Jul 30, 2020

@asmorkalov thanks for the advice. Calling create() didn't seem to help, since opencv-python is still targetting 4.3.0 the cv2.SIFT() isn't there.

@blakev blakev closed this as completed Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: features2d question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org
Projects
None yet
Development

No branches or pull requests

2 participants