예제 #1
0
파일: __main__.py 프로젝트: fossabot/mfm
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))
예제 #2
0
파일: __main__.py 프로젝트: char-lie/mfm
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))
예제 #3
0
파일: __main__.py 프로젝트: waffle-iron/mfm
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)
예제 #4
0
파일: Model.py 프로젝트: fossabot/mfm
def test_redraw():
    model = Model(View())
    model.start(None)
    model.redraw()
    model.redraw(lambda: None)
예제 #5
0
파일: Model.py 프로젝트: fossabot/mfm
def test_close():
    model = Model(View())
    model.start()
    model.close()