mirror of
https://github.com/jlengrand/Ivolution.git
synced 2026-03-10 08:21:18 +00:00
starts refactoring
This commit is contained in:
@@ -226,11 +226,8 @@ class FaceMovie(object):
|
||||
"""
|
||||
# FIXME: badly done !
|
||||
for a_guy in self.guys:
|
||||
# TODO : change to a_guy.get_def_dims
|
||||
xc = int(a_guy.ratio * a_guy.x_center)
|
||||
yc = int(a_guy.ratio * a_guy.y_center)
|
||||
inx = int(a_guy.ratio * a_guy.in_x)
|
||||
iny = int(a_guy.ratio * a_guy.in_y)
|
||||
(xc, yc) = a_guy.resized_center()
|
||||
(inx, iny) = a_guy.resized_dims()
|
||||
|
||||
# update center
|
||||
if xc > self.x_center:
|
||||
|
||||
@@ -52,6 +52,24 @@ class Guy(object):
|
||||
self.normalize = False
|
||||
self.ratio = 1.0
|
||||
|
||||
def resized_dims(self):
|
||||
"""
|
||||
Calculates the dimensions of the full image after having been resized using ratio.
|
||||
:returns list of int - list of two integers, being (resized_x, resized_y)
|
||||
"""
|
||||
inx = int(self.ratio * self.in_x)
|
||||
iny = int(self.ratio * self.in_y)
|
||||
return (inx, iny)
|
||||
|
||||
def resized_center(self):
|
||||
"""
|
||||
Calculates the center position of the full image after having been resized using ratio.
|
||||
:returns list of int - list of two integers, being (new_center_x, new_center_y)
|
||||
"""
|
||||
inx = int(self.ratio * self.x_center)
|
||||
iny = int(self.ratio * self.y_center)
|
||||
return (inx, iny)
|
||||
|
||||
def load_image(self):
|
||||
"""
|
||||
This function is used to load the image when needed. To reduce memory load, only its location is saved in real time
|
||||
|
||||
Reference in New Issue
Block a user