First step of thumbmail feature finished. TODO: Allow user input

This commit is contained in:
AirballTest
2012-05-11 17:57:17 +02:00
parent 3252956e2b
commit 95f66ae519
2 changed files with 25 additions and 6 deletions

View File

@@ -156,6 +156,25 @@ class FaceMovie(object):
"""
If needed, crops the image to avoid having black borders.
"""
# TODO : implement
width = self.width#[0, 0]
height = self.height#[0, 0]
out_im = cv.CreateImage((width[0] + width[1], height[0] + height[1]),cv.IPL_DEPTH_8U, image.nChannels)
cv.Zero(out_im)
xtl = self.x_center - width[0]
ytl = self.y_center - height[0]
w = width[0] + width[1]
h = height[0] + height[1]
rect = (xtl, ytl, w, h)
cv.SetImageROI(image, rect)
print cv.GetSize(out_im), cv.GetSize(image)
cv.Copy(image, out_im)
cv.ResetImageROI(image)
return out_im
def show_faces(self, mytime=1000, equalize=True):
"""

View File

@@ -92,12 +92,12 @@ class Facemoviefier():
self.facemovie.find_crop_dims() # finds output minimal size to get all eyes in the same place
#choose your final step
#if self.args['type'] == 's':
# self.facemovie.show_faces(1000)
#elif self.args['type'] == 'i':
# self.facemovie.save_faces(self.args['output'])
#elif self.args['type'] == 'v':
# self.facemovie.save_movie(self.args['output'])
if self.args['type'] == 's':
self.facemovie.show_faces(1000)
elif self.args['type'] == 'i':
self.facemovie.save_faces(self.args['output'])
elif self.args['type'] == 'v':
self.facemovie.save_movie(self.args['output'])
if __name__ == '__main__':
my_job = Facemoviefier()