Commit 2e70ee46 authored by Richard Torenvliet's avatar Richard Torenvliet

Moved imm to datasets module, all in preperation of dynamic loading of module,...

Moved imm to datasets module, all in preperation of dynamic loading of module, see issues #1, #2, #3
parent 347a71c3
This contains all code specific to reading datasets. The imm dataset is
different from the I-BUG data format. To able to implement transparency between
datasets, we keep all specific code in this seperate module and immplement
specific code to read-in this data here.
More about the implementation details should be defined here, so more about
this later.
...@@ -10,7 +10,7 @@ import cv2 ...@@ -10,7 +10,7 @@ import cv2
# local imports # local imports
import pca import pca
import aam import aam
import imm # import imm
from reconstruction import reconstruction from reconstruction import reconstruction
...@@ -102,6 +102,9 @@ def save_pca_model_texture(args): ...@@ -102,6 +102,9 @@ def save_pca_model_texture(args):
assert args.model_texture_file, '--model_texture_file needs to be provided to save the pca model' assert args.model_texture_file, '--model_texture_file needs to be provided to save the pca model'
shape_model = pca.PcaModel(args.model_shape_file) shape_model = pca.PcaModel(args.model_shape_file)
from datasets import imm
mean_points = imm.IMMPoints(points_list=shape_model.mean_values) mean_points = imm.IMMPoints(points_list=shape_model.mean_values)
textures = aam.build_texture_feature_vectors( textures = aam.build_texture_feature_vectors(
...@@ -138,6 +141,7 @@ def save_pca_model_shape(args): ...@@ -138,6 +141,7 @@ def save_pca_model_shape(args):
""" """
assert args.files, '--files should be given' assert args.files, '--files should be given'
assert args.model_shape_file, '--model_shape_file needs to be provided to save the pca model' assert args.model_shape_file, '--model_shape_file needs to be provided to save the pca model'
from datasets import imm
points = aam.build_shape_feature_vectors( points = aam.build_shape_feature_vectors(
args.files, imm.get_imm_points, flattened=True args.files, imm.get_imm_points, flattened=True
...@@ -253,6 +257,7 @@ def show_reconstruction(args): ...@@ -253,6 +257,7 @@ def show_reconstruction(args):
# Vt_shape, s, n_shape_components, mean_value_points, triangles = pca.load(args.model_shape_file) # Vt_shape, s, n_shape_components, mean_value_points, triangles = pca.load(args.model_shape_file)
# Vt_texture, s_texture, n_texture_components, mean_values_texture, _ = pca.load(args.model_texture_file) # Vt_texture, s_texture, n_texture_components, mean_values_texture, _ = pca.load(args.model_texture_file)
from datasets import imm
shape_model = pca.PcaModel(args.model_shape_file) shape_model = pca.PcaModel(args.model_shape_file)
texture_model = pca.PcaModel(args.model_texture_file) texture_model = pca.PcaModel(args.model_texture_file)
......
...@@ -8,7 +8,7 @@ import cv2 ...@@ -8,7 +8,7 @@ import cv2
from tornado import websocket, web, ioloop, autoreload from tornado import websocket, web, ioloop, autoreload
import pca import pca
import imm_points as imm from datasets import imm
from reconstruction import reconstruction from reconstruction import reconstruction
BASE = '../viewer/app' BASE = '../viewer/app'
...@@ -128,7 +128,7 @@ class FaceHandler(ApiHandler): ...@@ -128,7 +128,7 @@ class FaceHandler(ApiHandler):
'id': id, 'id': id,
'attributes': { 'attributes': {
'filename': '{}/{}'.format(FACE_DB_NAME, os.path.basename(self.images[id])), 'filename': '{}/{}'.format(FACE_DB_NAME, os.path.basename(self.images[id])),
'shape': Points.get_scaled_points(shape=(480, 640)).tolist() 'shape': Points.get_scaled_points((480, 640)).tolist()
} }
}) })
......
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