Created
October 9, 2012 13:06
-
-
Save anonymous/3858703 to your computer and use it in GitHub Desktop.
Entrada 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#Importamos las librerias necesarias | |
import Image, sys | |
#Creamos un nuevo archivo para guardas los datos binarios | |
f = open("huella1.txt", "w") | |
#Variables | |
x = 1 | |
y = 1 | |
#Abrimos la huella que ocupamos | |
im = Image.open("img1.png") | |
#Hacemos un recorrido en largo y ancho de la imagen por pixeles | |
for y in range(0,209): #Largo | |
for x in range(0,180): #Ancho | |
pix = im.load() | |
pix[x, y] | |
if pix[x,y] == (255,255,255): #Si se encuentra un punto blanco se guarda 1 | |
c= 1 | |
else: | |
c= 0 #Si no es blanco entonces se guarda 0 | |
f.write(str(c)) #Escribimos en el archivo | |
f.write('\n') | |
f.close() #Cerramos el archivo | |
print "Huella grabada con exito" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment