Advertisement
Guest User

Untitled

a guest
Apr 16th, 2013
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. def detectarcentros(image):
  2.     lista_ellipses = list()
  3.     pixeles = image.load()
  4.     for x in range(ancho):
  5.         for y in range(altura):
  6.             if pixeles[x,y] == 255:
  7.                 lista_ellipses.append((x,y))
  8.    
  9.     lista_ellipses = group(lista_ellipses)
  10.     centros = list()
  11.     print len(lista_ellipses)
  12.     for i in lista_ellipses:
  13.         x, y = (0, 0)
  14.         for j in i:
  15.             x += j[0]
  16.             y += j[1]
  17.         x = int(float(x)/len(i))
  18.         y = int(float(y)/len(i))
  19.         centros.append((x, y))
  20.     return centros
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement