lines.append(self.angle_distance((x, y)))
return lines
- def find_angle_distance(self, image):
- image_l = image.load()
-
- points = []
-
- count = 0
- point_x = 0
- point_y = 0
- for x in xrange(image.size[0] / 2):
- for y in xrange(image.size[1] / 2, image.size[1]):
- if image_l[x, y]:
- count += 1
- point_x += x
- point_y += y
- points.append((float(point_x) / count, float(point_y) / count))
-
- count = 0
- point_x = 0
- point_y = 0
- for x in xrange(image.size[0] / 2, image.size[0]):
- for y in xrange(image.size[1] / 2, image.size[1]):
- if image_l[x, y]:
- count += 1
- point_x += x
- point_y += y
- points.append((float(point_x) / count, float(point_y) / count))
-
- return [self.angle_distance(p) for p in points]
-
def angle_distance(self, point):
return (self.dt * point[1] + self.initial_angle, point[0] - self.size[0] / 2)