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
from PIL import Image | |
import sys | |
def dosdimension(lista, nniveles=1): | |
# Realizar la transformada CDF 9/7 en matriz 2D | |
# donde nniveles es el numero de veces deseado para transformar recursivamente la senal'' | |
w = len(lista[0]) | |
h = len(lista) | |
for i in range(nniveles): |
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
from PIL import Image | |
import sys | |
def dosdimension(lista, nniveles=1): | |
# Realizar la transformada CDF 9/7 en matriz 2D | |
# donde nniveles es el numero de veces deseado para transformar recursivamente la senal'' | |
w = len(lista[0]) | |
h = len(lista) | |
for i in range(nniveles): |
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 cuadrante(image, movimient, tamano = 15): | |
enX = ancho / tamano | |
enY = altura / tamano | |
cuadrado = tamano*tamano | |
pixeles = cv2_array(movimiento).copy() | |
color, h=None,1 | |
for x in range(enX): | |
for y in range(enY): | |
primerp1 = x*tamano, y*tamano | |
segundop2 = (x + 1)*tamano, (y + 1)*tamano |
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 math | |
import sys | |
import os | |
import Image, ImageDraw, ImageFont | |
import random | |
import pygame | |
from pygame.locals import * | |
import Image | |
import math | |
import pygame |
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 Image | |
import math | |
#CONVOLUCION A ESCALA DE GRISES Y FILTRADA | |
image = Image.open("convo1.png") | |
pixeles = image.load() | |
ancho, altura =image.size | |
msobelX = ([-1, 0, 1], [-2, 0, 2], [-1, 0, 1]) #Para gradiente de x. |
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 Image | |
import numpy as np | |
def detect_painting(image): | |
image = filtro(image) | |
#img = mascara(image) | |
def mascara(self,image): | |
inicio = 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
varTamanobolita=30 | |
promedio = (figura[0]*var[0] / len(figura[i]), promedio[1]*var[1] / len(figura[i])) | |
for i in range(len(figura)): | |
for j in range(len(figura[i])): | |
x = figura[i][j][0]*var[0] | |
y = figura[i][j][1]*var[1] | |
draw.text((x, y), str(j+1), fill=(0, 0, 255), font=font) | |
draw.ellipse((promedio[0]-varTamanobolita, promedio[1]-varTamanobolita, prom[0]+varTamanobolita, promedio[1]+varTamanobolita), fill=(0, 0, 0)) | |
draw.text((promedio[0]+10, promedio[1]), 'figura # '+str(i+1), fill=(0, 255, 255), font=font) | |
print 'figura numero '+str(i+1), 'numero de lados =', str(len(figura[i])) |
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
from sys import argv, exit | |
from os import path | |
import Image, ImageDraw | |
import math | |
def convolucion(image,gResultant): | |
ancho, altura = image.size | |
pixeles = image.load() | |
imageN = Image.new('RGB', (ancho,altura)) |
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 * | |
from PIL import Image, ImageDraw,ImageFont | |
import sys, random | |
from math import sqrt,fabs,sin,cos,atan2, pow | |
def convolucion(image,gResultant): | |
ancho, altura = image.size | |
pixeles = image.load() | |
imageN = Image.new('RGB', (ancho,altura)) |
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 binarizar(image, umbral): | |
ancho, altura = im.size | |
pixeles = image.load() | |
salida = Image.new('RGB', (w, h)) | |
salidapixeles = out.load() | |
for i in range(ancho): | |
for j in range(altura): | |
r, g, b = pixeles[i, j] | |
if r > umbral: | |
salidapixeles[i, j] = (255, 255, 255) |
NewerOlder