I am using opencv 4.5.0-pre and python 3.7.3 on a raspberry pi 3b. I'm trying to find the best matched features for image-stitching using SIFT. I built opencv from source using this guide https://www.pyimagesearch.com/2019/09/16/install-opencv-4-on-raspberry-pi-4-and-raspbian-buster/.
import cv2
img1 = cv2.imread('image1.jpg')
gray1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)
img2 = cv2.imread('image2.jpg')
gray2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
sift = cv2.SIFT()
kp1, des1 = sift.detectAndCompute(gray1, None)
kp2, des2 = sift.detectAndCompute(gray2, None)
On running the script throws this error:
/bin/bash: line 1: 1101 Segmentation fault python3 stitch_imgs.py
shell returned 139
Press ENTER or type command to continue
I have already tried to use cv2.xfeatures2d.SIFT_create() as @Ahx recommended. But this also doesn't work for me. I get the following output:
[ WARN:0 ] global /home/pi/opencv_contrib/modules/xfeatures2d/misc/python/shadow_shift.hpp
(15) SIFT_create DEPRECATED: cv.xfeatures2d.SIFT_create() is deprecated due to
the main repository. https://github.com/opencv/opencv/issues/16736
Killed
Does anyone have an idea how I could fix this?
Thanks