Created
July 2, 2013 02:35
-
-
Save vane90/5906403 to your computer and use it in GitHub Desktop.
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
import sys,pygame | |
import Image | |
from math import* | |
from time import* | |
import math | |
from PIL import Image | |
from sys import argv # Importe para tabajar con argumentos | |
def main(): | |
foto1 = binarizar () | |
def binarizar(): | |
image1 = Image.open("nueva.png") | |
pixels = image1.load() | |
ancho,alto = image1.size | |
minimo = int(argv[2]) | |
for i in range(ancho): | |
for j in range(alto): | |
if pixels[i,j][1] < minimo: | |
p=0 | |
else: | |
p= 255 | |
pixels[i,j]=(p,p,p) | |
#fin = time() | |
#tiempo_t = fin - inicio | |
#print "Tiempo que tardo en ejecutarse binzarizar = "+str(tiempo_t)+" segundos" | |
new = 'binarizas.jpg' | |
image1.save(new) | |
#return new | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment