Skip to content

Instantly share code, notes, and snippets.

View AdriC1705's full-sized avatar
😃
Working from home

Adri Contreras AdriC1705

😃
Working from home
View GitHub Profile
def diferencia(img1,img2):
ancho,alto = foto.size
ancho,alto = foto2.size
foto3 = Image.new("RGB",(ancho1,alto1))
pix = foto.load()
pixel = foto2.load()
pixeles = foto3.load()
for i in range(alto-1):
for j in range(ancho-1):
diferen = abs(pixeles[i,j][0] - pixeles2[i,j][0])
#---------------------------------------------#
def dif_esq(img,img2,ancho,alto):
pic = Image.open('eg.png')
pix = pic.load()
pix2 = img2.load()
for i in range(ancho):
for j in range(alto):
(r,g,b)=img.getpixel((i,j))
(r,g,b) = img2.getpixel((i,j))
nw = pix2[i,j][0]
#----------------------------------------------------#
def filtro_esquinas(img,ancho,alto):
#pic = Image.open('eg.jpg')
pixeles = img.load()
for i in range(ancho):
for j in range(alto):
l = []
(r,g,b) = img.getpixel((i,j))
try:
if (pixeles[i+1,j]): #derecha
@AdriC1705
AdriC1705 / mm.py
Last active December 16, 2015 21:59
def frecuentes(histo, cantidad):
frec = list()
for valor in histo:
if valor is None:
continue
frecuencia = histo[valor]
acepta = False
if len(frec) <= cantidad:
acepta = True
if not acepta:
def bfs(img,ancho,alto,color,posa):
pixel= img.load()
cont=0
cen1=[]
cen2=[]
cola=[] #creamos la cola
puntos = []
cola.append(posa) #posicion actual se agrega a la cola
bla = posa
inicio = pixel[posa]
set title "HISTOGRAMA"
st grid
plot "hzt.dat", "vert.dat"
pause mouse
reset
def horizontalh(image):
h = list()
im = image.load()
fl = open('hzt.dat','w')
#prom = 0
for x in range(image.size[0]):
suma= 0
for y in range(image.size[1]):
suma += im[x,y]
fl.write(str(x)+' '+str(suma)+'\n')
@AdriC1705
AdriC1705 / hist.py
Last active December 16, 2015 13:38
#histograma del lado horizontal
def horizontalh(image):
h = list()
im = image.load()
fl = open('hzt.dat','w')
#prom = 0
for x in range(image.size[0]):
suma= 0
for y in range(image.size[1]):
suma += im[x,y]
from time import *
import sys
import Tkinter
from PIL import Image, ImageTk
import random
import math
from math import *
def img():
image = Image.open("conv.png")
import sys
def contar(cadena):
letras = dict()
for l in cadena: #l = letras en cadena
if l in letras:
letras[l] +=1
else:
letras[l] = 1
print letras