コード例 #1
0
ファイル: landmark_test.py プロジェクト: grigorisg9gr/menpo
def test_LandmarkManager_get():
    lgroup = LabelledPointUndirectedGraph(points, adjacency_matrix, mask_dict)

    man = LandmarkManager()
    man._landmark_groups['test_set'] = lgroup

    assert(man['test_set'] is lgroup)
    assert is_same_array(man['test_set'].points, lgroup.points)
コード例 #2
0
def test_LandmarkManager_str():
    pcloud = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud

    out_str = man.__str__()
    assert len(out_str) > 0
コード例 #3
0
ファイル: landmark_test.py プロジェクト: grigorisg9gr/menpo
def test_LandmarkManager_str():
    pcloud = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud

    out_str = man.__str__()
    assert len(out_str) > 0
コード例 #4
0
def test_LandmarkManager_get():
    lgroup = LabelledPointUndirectedGraph(points, adjacency_matrix, mask_dict)

    man = LandmarkManager()
    man._landmark_groups['test_set'] = lgroup

    assert (man['test_set'] is lgroup)
    assert is_same_array(man['test_set'].points, lgroup.points)
コード例 #5
0
def test_LandmarkManager_str():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)

    man = LandmarkManager()
    man['test_set'] = pcloud

    out_str = man.__str__()
    assert (len(out_str) > 0)
コード例 #6
0
ファイル: landmark_test.py プロジェクト: yymath/menpo
def test_LandmarkManager_str():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)

    man = LandmarkManager()
    man['test_set'] = pcloud

    out_str = man.__str__()
    assert (len(out_str) > 0)
コード例 #7
0
ファイル: test_landmark.py プロジェクト: jiaxiangshang/menpo
def test_LandmarkManager_copy_method():
    pcloud = PointCloud(points)

    man = LandmarkManager()
    man["test_set"] = pcloud
    man_copy = man.copy()

    assert man_copy["test_set"] is not man["test_set"]
    assert not is_same_array(man_copy["test_set"].points, man["test_set"].points)
コード例 #8
0
ファイル: landmark_test.py プロジェクト: grigorisg9gr/menpo
def test_LandmarkManager_copy_method():
    pcloud = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud
    man_copy = man.copy()

    assert man_copy['test_set'] is not man['test_set']
    assert not is_same_array(man_copy['test_set'].points,
                             man['test_set'].points)
コード例 #9
0
ファイル: landmark_test.py プロジェクト: yymath/menpo
def test_LandmarkManager_copy_method():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)

    man = LandmarkManager()
    man['test_set'] = pcloud
    man_copy = man.copy()

    assert (man_copy['test_set'] is not man['test_set'])
    assert (not is_same_array(man_copy['test_set'].lms.points,
                              man['test_set'].lms.points))
コード例 #10
0
def test_LandmarkManager_get():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)
    mask_dict = OrderedDict([('all', np.ones(10, dtype=np.bool))])

    lgroup = LandmarkGroup(pcloud, mask_dict, copy=False)

    man = LandmarkManager()
    man._landmark_groups['test_set'] = lgroup

    assert(man['test_set'] is lgroup)
コード例 #11
0
ファイル: landmark_test.py プロジェクト: yymath/menpo
def test_LandmarkManager_get():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)
    mask_dict = OrderedDict([('all', np.ones(10, dtype=np.bool))])

    lgroup = LandmarkGroup(pcloud, mask_dict, copy=False)

    man = LandmarkManager()
    man._landmark_groups['test_set'] = lgroup

    assert(man['test_set'] is lgroup)
コード例 #12
0
def test_LandmarkManager_copy_method():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)

    man = LandmarkManager()
    man['test_set'] = pcloud
    man_copy = man.copy()

    assert (man_copy['test_set'] is not man['test_set'])
    assert (not is_same_array(man_copy['test_set'].lms.points,
                              man['test_set'].lms.points))
コード例 #13
0
ファイル: landmark_test.py プロジェクト: dubzzz/menpo
def test_LandmarkManager_get():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)
    target = PointCloud(points)
    mask_dict = {'all': np.ones(10, dtype=np.bool)}

    lgroup = LandmarkGroup(target, 'label', pcloud, mask_dict, copy=False)

    man = LandmarkManager(target)
    man._landmark_groups['test_set'] = lgroup

    assert_equal(man['test_set'], lgroup)
コード例 #14
0
ファイル: landmark_test.py プロジェクト: dubzzz/menpo
def test_LandmarkManager_copy_method():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)
    target = PointCloud(points, copy=True)

    man = LandmarkManager(target)
    man['test_set'] = pcloud
    man_copy = man.copy()

    assert (man_copy._target is man._target)
    assert (man_copy['test_set'] is not man['test_set'])
    assert (not is_same_array(man_copy['test_set'].lms.points,
                              man['test_set'].lms.points))
    assert_equal(man['test_set'].group_label, 'test_set')
コード例 #15
0
def test_LandmarkManager_set_None_key():
    lgroup = LabelledPointUndirectedGraph.init_with_all_label(
        points, adjacency_matrix)

    man = LandmarkManager()
    with raises(ValueError):
        man[None] = lgroup
コード例 #16
0
def test_LandmarkManager_set_LabelledPointUndirectedGraph():
    lgroup = LabelledPointUndirectedGraph(points, adjacency_matrix, mask_dict)

    man = LandmarkManager()
    man['test_set'] = lgroup
    assert not is_same_array(man['test_set'].points, lgroup.points)
    assert man['test_set']._labels_to_masks is not lgroup._labels_to_masks
コード例 #17
0
def test_LandmarkManager_in():
    pcloud = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud

    assert 'test_set' in man
コード例 #18
0
def test_LandmarkManager_in():
    pcloud = PointCloud(points)

    man = LandmarkManager()
    man["test_set"] = pcloud

    assert "test_set" in man
コード例 #19
0
def test_LandmarkManager_set_PointCloud_not_copy_target():
    pcloud = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud
    assert not is_same_array(man['test_set'].points, pcloud.points)
    assert_allclose(man['test_set'].points, np.ones([10, 3]))
コード例 #20
0
def test_LandmarkManager_in():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)

    man = LandmarkManager()
    man['test_set'] = pcloud

    assert ('test_set' in man)
コード例 #21
0
def test_LandmarkManager_set_PointCloud_not_copy_target():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)

    man = LandmarkManager()
    man['test_set'] = pcloud
    assert (not is_same_array(man['test_set'].lms.points, pcloud.points))
    assert_allclose(man['test_set']['all'].points, np.ones([10, 3]))
コード例 #22
0
def test_LandmarkManager_set():
    lgroup = LabelledPointUndirectedGraph(points, adjacency_matrix, mask_dict)

    man = LandmarkManager()
    man['test_set'] = lgroup

    assert_allclose(man._landmark_groups['test_set'].points, lgroup.points)
    assert man._landmark_groups['test_set'].n_labels == 1
コード例 #23
0
def test_LandmarkManager_set_pointcloud():
    pcloud = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud

    new_pcloud = man['test_set']
    assert new_pcloud is not pcloud
    assert isinstance(new_pcloud, PointCloud)
コード例 #24
0
def test_LandmarkManager_del():
    pcloud = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud

    del man['test_set']

    assert man.n_groups == 0
コード例 #25
0
def test_LandmarkManager_set_pointcloud():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)

    man = LandmarkManager()
    man['test_set'] = pcloud

    lgroup = man['test_set']
    assert (lgroup.lms is not pcloud)
    assert_allclose(lgroup._labels_to_masks['all'], np.ones(10, dtype=np.bool))
コード例 #26
0
def test_LandmarkManager_iterate():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)
    target = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud

    for l in man:
        assert_equal(l, 'test_set')
コード例 #27
0
def test_LandmarkManager_del():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)
    target = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud

    del man['test_set']

    assert_equal(man.n_groups, 0)
コード例 #28
0
def test_LandmarkManager_iterate():
    pcloud = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud
    man['test_set2'] = pcloud
    man['test_set3'] = pcloud

    for l in man:
        assert not is_same_array(man[l].points, pcloud.points)
    assert len(man) == 3
コード例 #29
0
def test_LandmarkManager_set_LandmarkGroup():
    points = np.ones((10, 3))
    mask_dict = OrderedDict([('all', np.ones(10, dtype=np.bool))])
    pcloud = PointCloud(points, copy=False)
    lgroup = LandmarkGroup(pcloud, mask_dict, copy=False)

    man = LandmarkManager()
    man['test_set'] = lgroup
    assert (not is_same_array(man['test_set'].lms.points, lgroup.lms.points))
    assert_allclose(man['test_set']['all'].points, np.ones([10, 3]))
    assert (man['test_set']._labels_to_masks is not lgroup._labels_to_masks)
コード例 #30
0
def test_LandmarkManager_set():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)
    mask_dict = OrderedDict([('all', np.ones(10, dtype=np.bool))])

    lgroup = LandmarkGroup(pcloud, mask_dict, copy=False)

    man = LandmarkManager()
    man['test_set'] = lgroup

    assert_allclose(man._landmark_groups['test_set'].lms.points,
                    lgroup.lms.points)
    assert_equal(man._landmark_groups['test_set'].n_labels, 1)
コード例 #31
0
def test_LandmarkManager_group_order():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)
    target = PointCloud(points)

    man = LandmarkManager()
    man["test_set"] = pcloud.copy()
    man["abc"] = pcloud.copy()
    man["def"] = pcloud.copy()
    assert_equal(list(man._landmark_groups.keys()), ["test_set", "abc", "def"])
    # check that after deleting and inserting the order will remain the same.
    del man["test_set"]
    man["tt"] = pcloud.copy()
    assert_equal(list(man._landmark_groups.keys()), ["abc", "def", "tt"])
コード例 #32
0
def test_LandmarkManager_group_order():
    points = np.ones((10, 3))
    pcloud = PointCloud(points, copy=False)
    target = PointCloud(points)

    man = LandmarkManager()
    man['test_set'] = pcloud.copy()
    man['abc'] = pcloud.copy()
    man['def'] = pcloud.copy()
    assert_equal(list(man._landmark_groups.keys()), ['test_set', 'abc', 'def'])
    # check that after deleting and inserting the order will remain the same.
    del man['test_set']
    man['tt'] = pcloud.copy()
    assert_equal(list(man._landmark_groups.keys()), ['abc', 'def', 'tt'])
コード例 #33
0
    def as_menpo_img(self):
        """
        Converts image to menpo image

        Returns
        -------
        menpo.image.Image: current image as menpo image
        """
        menpo_img = Image(self.img)
        lmk = self.lmk
        menpo_lmk = PointCloud(self.lmk)
        lmk_manager = LandmarkManager()
        lmk_manager["LMK"] = menpo_lmk
        menpo_img.landmarks = lmk_manager

        return menpo_img
コード例 #34
0
def test_landmarkmanager_view_widget():
    l = LandmarkManager()
    l['test'] = PointCloud(pcloud2d)
    with raises(MenpowidgetsMissingError):
        l.view_widget()
コード例 #35
0
def landmarkmanager_view_widget_test():
    LandmarkManager().view_widget()
    assert 1
コード例 #36
0
def landmarkmanager_view_widget_test():
    l = LandmarkManager()
    l['test'] = PointCloud(pcloud2d)
    l.view_widget()
    assert 1
コード例 #37
0
def test_LandmarkManager_set_None_key():
    pcloud = PointCloud(np.ones((10, 3)), copy=False)
    lgroup = LandmarkGroup.init_with_all_label(pcloud)

    man = LandmarkManager()
    man[None] = lgroup