Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. """
  2. Python module for use with David Lowe's SIFT code available at:
  3. http://www.cs.ubc.ca/~lowe/keypoints/
  4. adapted from the matlab code examples.
  5.  
  6. import os
  7. from numpy import *
  8. import pylab
  9.  
  10.  
  11. def process_image(imagename, resultname):
  12. """ process an image and save the results in a .key ascii file"""
  13.  
  14. #check if linux or windows
  15. if os.name == "posix":
  16. cmmd = "./sift <"+imagename+">"+resultname
  17. else:
  18. cmmd = "siftWin32 <"+imagename+">"+resultname
  19.  
  20. os.system(cmmd)
  21. print 'processed', imagename
  22.  
  23. import sift
  24. imname = ’empire.jpg’
  25. im1 = array(Image.open(imname).convert(’L’))
  26. sift.process_image(imname,’empire.sift’)
  27. l1,d1 = sift.read_features_from_file(’empire.sift’)
  28. figure()
  29. gray()
  30. sift.plot_features(im1,l1,circle=True)
  31. show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement