PCV icon indicating copy to clipboard operation
PCV copied to clipboard

computer vision with python - sift example error

Open kimhwanyoung opened this issue 7 years ago • 2 comments

hello i'm trying examples in programming computer vision with python. when I try sift example in page 95, I have error as follow

Traceback (most recent call last): File "C:\Users\admin\Desktop\tasdfasdfasfd\ch3_panorama.py", line 25, in l[i],d[i] = sift.read_features_from_file(featname[i]) File "C:\Users\admin\Desktop\tasdfasdfasfd\sift.py", line 25, in read_features_from_file f = loadtxt(filename) File "C:\Python27\lib\site-packages\numpy\lib\npyio.py", line 896, in loadtxt fh = iter(open(fname, 'U')) IOError: [Errno 2] No such file or directory: 'Univ1.sift'

how can I solve this problem???

kimhwanyoung avatar Nov 12 '17 10:11 kimhwanyoung

You can use sift demo binary to generate it, as described in the book page 37 titled "SIFT".

1 -> http://www.cs.ubc.ca/~lowe/keypoints/siftDemoV4.zip

2 -> convert the image file into pgm format,

3 - > use the command "./sift <Univ1.pgm >Univ1.sift"

bradraj avatar Aug 28 '20 08:08 bradraj

try this with opencv3.4 and opencv contrilb python detector = cv2.xfeatures2d_SIFT.create()

im1 = array(Image.open('C:\0007.png')) keypoints1 = detector.detect(im1,None) kp1,des1 = detector.detectAndCompute(im1, None) # get all info of feature points. points2fA = cv2.KeyPoint_convert(keypoints1) # transfer all the xy coordinates to decimal

In this way you can get the xy location and other feature info.

Rand0409 avatar Oct 20 '20 04:10 Rand0409