简体   繁体   中英

Dead Kernel : sift.detect(gray,None) The kernel appears to have died. It will restart automatically

import cv2
import numpy as np
img = cv2.imread('home.jpg')
gray= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
sift = cv2.SIFT()
**kp = sift.detect(gray,None)**  #Kernel dies here
img=cv2.drawKeypoints(gray,kp)
cv2.imwrite('sift_keypoints.jpg',img)

Just want to learn SIFT but Mr.Kernel dies while executing sift.detect.

You have to install opencv-contrib-python:

pip install opencv-contrib-python --user

I had a similar problem and fixed it by using cv2.SIFT_create() instead of cv2.SIFT() .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM