def setup_application(configuration_filename=None): MFM.init() view = View((500, 500)) model = Model(view) ModelInput(model) if configuration_filename is None: model.start() else: model.start(construct_chain(configuration_filename, model))
fitting_settings = None with open(args.config) as config: fitting_settings = json.load(config) fitters = fitting_settings['fitters'] face_parameters = fitting_settings['input'].get('initial_face', {}) coefficients = face_parameters.get('coefficients', []) directed_light = face_parameters.get('directed_light', (0., 0., 0.)) ambient_light = face_parameters.get('ambient_light', 0.) initial_face = Face(coefficients=coefficients, directed_light=directed_light, ambient_light=ambient_light) model_filename = get_datafile_path(fitting_settings['input']['input_image']) image = Image.open(model_filename).convert('L') original_data = array(image.getdata()).astype('f') / 255 image_data = original_data.reshape(image.size)[::-1, :].flatten() image.close() MFM.init() view = View((500, 500)) model = Model(view) model_input = ModelInput(model) chain = FittersChain(fitters, image_data, model, initial_face=initial_face) model.start(chain)
def test_redraw(): model = Model(View()) model.start(None) model.redraw() model.redraw(lambda: None)
def test_close(): model = Model(View()) model.start() model.close()