예제 #1
0
파일: io_test.py 프로젝트: ikassi/menpo
def test_custom_landmark_logic_bunny():
    def f(mesh):
        return {
            'no_nose': os.path.join(mesh.ioinfo.dir, 'bunny_no_nose.json'),
            'full_set': os.path.join(mesh.ioinfo.dir, 'bunny.json')
        }
    mesh = pio.import_mesh(pio.data_path_to('bunny.obj'), landmark_resolver=f)
    assert('no_nose' in mesh.landmarks.group_labels)
    lms = mesh.landmarks['no_nose']
    labels = {'r_eye', 'mouth', 'l_eye'}
    assert(len(set(lms.labels) - labels) == 0)
    assert_allclose(lms['l_eye'].lms.points, bunny_l_eye, atol=1e-7)
    assert_allclose(lms['r_eye'].lms.points, bunny_r_eye, atol=1e-7)
    assert_allclose(lms['mouth'].lms.points, bunny_mouth, atol=1e-7)

    assert('full_set' in mesh.landmarks.group_labels)
    lms = mesh.landmarks['full_set']
    labels = {'r_eye', 'mouth', 'nose', 'l_eye'}
    assert(len(set(lms.labels) - labels) == 0)
    assert_allclose(lms['l_eye'].lms.points, bunny_l_eye, atol=1e-7)
    assert_allclose(lms['r_eye'].lms.points, bunny_r_eye, atol=1e-7)
    assert_allclose(lms['nose'].lms.points, bunny_nose, atol=1e-7)
    assert_allclose(lms['mouth'].lms.points, bunny_mouth, atol=1e-7)
예제 #2
0
def test_custom_landmark_logic_bunny():
    def f(mesh):
        return {
            'no_nose': os.path.join(mesh.ioinfo.dir, 'bunny_no_nose.ljson'),
            'full_set': os.path.join(mesh.ioinfo.dir, 'bunny.ljson')
        }
    mesh = mio.import_mesh(mio.data_path_to('bunny.obj'), landmark_resolver=f)
    assert('no_nose' in mesh.landmarks.group_labels)
    lms = mesh.landmarks['no_nose']
    labels = {'reye', 'mouth', 'leye'}
    assert(len(set(lms.labels) - labels) == 0)
    assert_allclose(lms['leye'].points, bunny_leye, atol=1e-7)
    assert_allclose(lms['reye'].points, bunny_reye, atol=1e-7)
    assert_allclose(lms['mouth'].points, bunny_mouth, atol=1e-7)

    assert('full_set' in mesh.landmarks.group_labels)
    lms = mesh.landmarks['full_set']
    labels = {'reye', 'mouth', 'nose', 'leye'}
    assert(len(set(lms.labels) - labels) == 0)
    assert_allclose(lms['leye'].points, bunny_leye, atol=1e-7)
    assert_allclose(lms['reye'].points, bunny_reye, atol=1e-7)
    assert_allclose(lms['nose'].points, bunny_nose, atol=1e-7)
    assert_allclose(lms['mouth'].points, bunny_mouth, atol=1e-7)
예제 #3
0
파일: io_test.py 프로젝트: ikassi/menpo
def test_custom_landmark_logic_None_bunny():
    def f(mesh):
        return None
    mesh = pio.import_mesh(pio.data_path_to('bunny.obj'), landmark_resolver=f)
    assert(mesh.landmarks.n_groups == 0)
예제 #4
0
def test_custom_landmark_logic_None_bunny():
    def f(mesh):
        return None

    mesh = pio.import_mesh(pio.data_path_to('bunny.obj'), landmark_resolver=f)
    assert (mesh.landmarks.n_groups == 0)