简体   繁体   English

我在为我的 SIFT 算法创建文件时遇到问题

[英]I'm having trouble creating the file for my SIFT algorithm

I'm studying feature extraction and came across Scale-Invariant Feature Transform (SIFT) and I tried it in Pycharm我正在研究特征提取并遇到了尺度不变特征变换 (SIFT),我在 Pycharm 中进行了尝试

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)

img=cv2.drawKeypoints(gray,kp)

cv2.imwrite('sift_keypoints.jpg',img)

The problem is I cannot find 'sift_keypoints.jpg' anywhere in my folders unless I comment out kp = sift.detect(gray,None) then the file is there.问题是我在文件夹中的任何地方都找不到“sift_keypoints.jpg”,除非我注释掉kp = sift.detect(gray,None)然后文件就在那里。

What am I missing / doing wrong?我错过了什么/做错了什么?

When I run the code here is the result:当我在这里运行代码时,结果是:

...Recognition.py

Process finished with exit code -1073741819 (0xC0000005)

it seems my problem was that sift = cv2.SIFT() should be sift = cv2.SIFT_create() .看来我的问题是sift = cv2.SIFT()应该是sift = cv2.SIFT_create() can anyone explain why that was the problem?谁能解释为什么这是问题? i really thought kp = sift.detect(gray,none) was the problem我真的认为kp = sift.detect(gray,none)是问题所在

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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