def example_calculate_mean_image_and_display():
    res = collect_vectors('../data/Landmarks/original', '5', 80)
    referent = ActiveShapeModel.ReferentModel(res)
    data_coll = DataCollector(None)
    res = referent.mean_model()
    data_coll.read_vector(referent.mean_model())

    Plotter.render_landmarks(data_coll)
def example_calculate_mean_image_and_display():
    res = collect_vectors('../data/Landmarks/original', '5', 80)
    referent = ActiveShapeModel.ReferentModel(res)
    data_coll = DataCollector(None)
    res = referent.mean_model()
    data_coll.read_vector(referent.mean_model())

    Plotter.render_landmarks(data_coll)
def example_examine_principal_components():

    res = collect_vectors('../data/Landmarks/original', '1', 80)

    referent = ActiveShapeModel.ReferentModel(res)
    referent.align()
    referent.rescale_and_realign()

    variance = ActiveShapeModel.VarianceModel(referent)
    variance.obtain_components()

    components = variance.get_components()
    eigenvals = variance.get_eigenvalues()

    shapes = utils.vary_component(referent.mean_shape, components.transpose(), eigenvals, 1, 10)

    tmpObj = DataCollector(None)
    Plotter.render_landmarks(referent.mean_shape)

    for ind in range(len(shapes)):
        tmpObj.read_vector(shapes[ind, :])
        Plotter.render_landmarks(tmpObj)
def example_examine_principal_components():

    res = collect_vectors('../data/Landmarks/original', '1', 80)

    referent = ActiveShapeModel.ReferentModel(res)
    referent.align()
    referent.rescale_and_realign()

    variance = ActiveShapeModel.VarianceModel(referent)
    variance.obtain_components()

    components = variance.get_components()
    eigenvals = variance.get_eigenvalues()

    shapes = utils.vary_component(referent.mean_shape, components.transpose(),
                                  eigenvals, 1, 10)

    tmpObj = DataCollector(None)
    Plotter.render_landmarks(referent.mean_shape)

    for ind in range(len(shapes)):
        tmpObj.read_vector(shapes[ind, :])
        Plotter.render_landmarks(tmpObj)