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(): |
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 pywt, numpy | |
import Image | |
from sys import argv | |
import time | |
def crear_imagen(cef,esg): #Pasa los coeficientes a un filtro | |
for cs,i in enumerate(cef): | |
binariza(i,cs) | |
# raw_input() | |
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
for i in range(ancho): | |
for j in range(alto): | |
if array[i,j]<0: | |
val = 0 | |
elif array[i,j]>255: | |
val= 255 | |
else: | |
val=int(array[i,j]) | |
imagen[i,j]=(val,val,val) | |
im.save('coef'+str(cs)+'.png') |
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
def crear_imagen(cef,esg): #Pasa los coeficientes a un filtro | |
for cs,i in enumerate(cef): | |
binariza(i,cs) |
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
def cef(array): # Funcion para aplicar dwt | |
data = array | |
#print 'data', data | |
coeffs = pywt.dwt2(data, 'Haar') | |
csA, (csH, csV, csD) = coeffs | |
print 'Coefic 1' | |
print csA | |
print 'Coefic 2' | |
print csH | |
print 'Coefic 3' |
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
def conversion_array(image): | |
matriz = numpy.fromstring(image.tostring(), numpy.uint8) | |
matriz.shape = (image.size[1], image.size[0], len(image.getbands())) | |
return matriz |
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
def escala_g(image): #convierte la imagen a escala de grises | |
imagen = image.load() | |
ancho,alto = image.size | |
for i in range(ancho): | |
for j in range(alto): | |
(r,g,b) = image.getpixel((i,j)) | |
esg = (r+g+b)/3 | |
imagen[i,j] = (esg,esg,esg) | |
df = image.save('escala.png') |
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
ima='nuevo.png' | |
ancho=300 | |
alto=400 | |
a_ventana=None | |
def open_i(): #imagenconmovimiento | |
imagen=Image.open('nuevo.png') | |
pixels=imagen.load() | |
return pixels | |
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
baja_izq = 1 #direcciones | |
baja_der = 5 | |
sube_izq = 7 | |
sube_der = 9 | |
mueverect = 4 | |
negro = (0, 0, 0) #colores del rectangulo | |
rojo = (255, 0, 0) |
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
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): |
NewerOlder