Skip to content

Instantly share code, notes, and snippets.

@vane90
Last active December 16, 2015 21:59
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 vane90/5503484 to your computer and use it in GitHub Desktop.
Save vane90/5503484 to your computer and use it in GitHub Desktop.
def toma_pendiente(imagen): # obtenemos la pendiente
Gx=gx
Gy=gy
print Gx
print Gy
imagen=imagen.load()
ancho,alto=imagen.size
pendiente=numpy.empty((ancho, alto))
for i in range(ancho):
for j in range(alto):
if Gx[i,j]!=0 and Gy[i,j]!=0:
m=0
elif Gx[i,j]==0 and Gy[i,j]==0:
m=1
elif Gy[i,j]<=0 and Gx[i,j]==0:
m=2
elif Gy[i,j]>=0 and Gx[i,j]==0:
m=3
elif Gx[i,j]<=0 and Gy[i,j]==0:
m=4
elif Gx[i,j]>=0 and Gy[i,j]==0:
m=5
pendiente[i,j]=m
print 'termino'
return pendiente
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment