Skip to content

Instantly share code, notes, and snippets.

@ramonesteban
Created May 24, 2013 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramonesteban/5644605 to your computer and use it in GitHub Desktop.
Save ramonesteban/5644605 to your computer and use it in GitHub Desktop.
Obtener los bordes de una imagen usando PyWavelets
import sys, pylab, numpy, Image, pywt
def edges(path):
im = Image.open(path).convert('L')
arr = numpy.fromstring(im.tostring(), numpy.uint8)
arr.shape = (im.size[1], im.size[0])
data = pywt.swt2(arr, 'haar', level=3, start_level=0)
LL, (LH, HL, HH) = data[2]
pylab.imshow(LH, interpolation='nearest', cmap=pylab.cm.gray)
pylab.show()
def main():
if len(sys.argv) > 1:
path = str(sys.argv[1])
edges(path)
else:
print 'Image file needed'
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment