Commit f0bb6aa8 authored by Richard Torenvliet's avatar Richard Torenvliet

Add support for cutting the amount of shape components

parent 25baa363
......@@ -160,7 +160,7 @@ def reconstruct_shape_texture(dataset_name, shape_model, texture_model,
else:
dst_image = input_image
# get the location of the landmarks in a list of [x,y, ... x_n, y_n]
# get the location of the landmarks in a list of [x, y, ..., x_n, y_n]
output_points = dataset_module.factory(
points_list=input_points.get_points()
)
......@@ -168,7 +168,7 @@ def reconstruct_shape_texture(dataset_name, shape_model, texture_model,
# get the pca components (ie., V^T)
shape_Vt = shape_model.Vt
# if a eigen value multiplier array is given, scale the Vt with this.
# if an eigen value multiplier array is given, scale the Vt with this.
# the chosen PCA components will have more impact then others.
if len(shape_eigenvalues_multiplier):
shape_Vt = scale_eigenvalues(shape_Vt, shape_eigenvalues_multiplier)
......@@ -177,6 +177,7 @@ def reconstruct_shape_texture(dataset_name, shape_model, texture_model,
reconstruct_shape(
output_points,
shape_model,
n_components=shape_components,
shape_Vt=shape_Vt # overwrite by scaled Vt
)
......
......@@ -169,22 +169,6 @@ def fill_triangle_src_dst(np.ndarray[unsigned char, ndim=3] src,
dst_loc, src_loc
)
#max_dim_y: 188 104.592903137 316 True
#max_dim_x: 201 188.147247314 357 True
#IndexError: index 188 is out of bounds for axis 1 with size 188
#print 'max_dim_y: ', max_dim_y, src_loc[1], y, src_loc[1] < max_dim_y
#print 'max_dim_x: ', max_dim_x, src_loc[0], x, src_loc[0] < max_dim_x
#print 'together:', src_loc[1] < max_dim_y and src_loc[0] < max_dim_x
#if src_loc[1] < src_max_dim_y and src_loc[0] < src_max_dim_x:
# print 'yo'
# print src_loc[1], src_loc[0]
# print y, x
# print dst_max_dim_y
# print dst_max_dim_x
# print src_max_dim_y
# print src_max_dim_x
if src_loc[1] < src_max_dim_y and src_loc[0] < src_max_dim_x \
and y < dst_max_dim_y and x < dst_max_dim_x:
dst[y, x, :] = src[src_loc[1], src_loc[0], :]
......
......@@ -68,8 +68,6 @@ class ImageWebSocketHandler(websocket.WebSocketHandler):
image_as_background = message.get('background_image', True)
shape_components = message.get('shape_components', 58)
shape_eigenvalues_multiplier = message.get('shape_eigenvalues')
#image = message.get('image')
#input_image = base64.b64decode(image)
logger.info('using %s shape_components', shape_components)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment