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 pygame | |
import sys | |
import math | |
import time | |
import random | |
class Baliada(): ##clase de nodos principales | |
def __init__(self, posx,posy,life,ran): | |
self.posx = posx ##posicion en x | |
self.posy = posy ##posicion en y |
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 cv | |
import pygame | |
import time | |
from pygame.locals import * | |
import math | |
from PIL import Image, ImageDraw,ImageFont | |
#from Tkinter import * | |
cv.NamedWindow("Deteccion", 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
escala("test0.jpg") | |
filtro("test0.jpg") | |
convolucion("test0.jpg") | |
normalisacion("test0.jpg") | |
escala("test1.jpg") | |
filtro("test1.jpg") | |
convolucion("test1.jpg") | |
normalisacion("test1.jpg") | |
print "sacando diferencia" |
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 mov(viejo,diferencia): | |
ancho1,altura1,pixels1,im1 = cargar(viejo) | |
ancho2,altura2,pixels2,im2 = cargar(diferencia) | |
nueva = Image.new("RGB", (ancho1, altura1)) | |
npixels = nueva.load() | |
for i in range(altura1): | |
for j in range(ancho1): | |
if pixels2[j,i][0] != 0: | |
if pixels1[j,i] == pixels2[j,i]: | |
npixels[j,i] = (0,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 diferencia(imagen1,imagen2): | |
ancho1,altura1,pixels1,im1 = cargar(imagen1) | |
ancho2,altura2,pixels2,im2 = cargar(imagen2) | |
nueva = Image.new("RGB", (ancho1, altura1)) | |
npixels = nueva.load() | |
for i in range(altura1): | |
for j in range(ancho1): | |
#diferencia = abs(pixels1[j,i][0] - pixels2[j,i][0]) | |
cont = 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
import pygame | |
from pygame.locals import * | |
import sys | |
import random | |
import math | |
archivo = open('cordenadas.dat','r') | |
lineas=archivo.readlines() | |
cordenadas = [] |
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/python | |
##importamos las librerias necesarias | |
import pygame ##interfaz | |
from pygame.locals import * ##Para los botones y presion del raton | |
import Image ##para cargar imagenes, matriz de los pixeles | |
from math import * ##operaciones | |
import sys ##cosas de sistema como para terminar el programa | |
import numpy ##arreglos | |
import time |
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 union(imagen,cord): | |
ancho,altura,pixels,im = cargar(imagen) | |
ancho1,altura1,pixels1,im1 = cargar("esquina.png") | |
pro = [] | |
draw = ImageDraw.Draw(im1) | |
#pro.append((0,0)) | |
visitados = [] | |
pintar = [] | |
visitados = [] |
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
ancho1,altura1,pixels1,im1 = cargar(imagen) | |
cordenadas = [] | |
for i in range(ancho): | |
for j in range(altura): | |
diferencia = pixels[i,j][1] - pixels1[i,j][1] | |
if diferencia < 0: | |
diferencia = 0 | |
if diferencia > 255: | |
diferencia = 255 | |
if diferencia > 30: ##pequeño filtro |
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 esquinas(imagen): | |
ancho,altura,pixels,im = cargar(imagen) | |
for i in range(ancho): | |
for j in range(altura): | |
lista = [] | |
for k in range(-1,2): | |
for l in range(-1,2): | |
if i+k >= 0 and j+l >= 0 and i+k < ancho and j+l < altura: | |
lista.append(pixels[i+k,j+l][1]) | |
lista.sort() |