def test_copy_landmarks_and_path(): img = mio.import_builtin_asset.lenna_png() new_img = Image.init_blank(img.shape) copy_landmarks_and_path(img, new_img) assert new_img.path == img.path assert new_img.landmarks.keys() == img.landmarks.keys() assert new_img.landmarks is not img.landmarks
def test_copy_landmarks_and_path_with_no_lms_path(): img = Image.init_blank((5, 5)) new_img = Image.init_blank((5, 5)) copy_landmarks_and_path(img, new_img) assert not hasattr(img, "path") assert not hasattr(new_img, "path") assert not img.has_landmarks assert not new_img.has_landmarks
def as_colouredtrimesh(self, colours=None, copy=True): """ Converts this to a :map:`ColouredTriMesh`. Parameters ---------- colours : ``(N, 3)`` `ndarray`, optional The floating point RGB colour per vertex. If not given, grey will be assigned to each vertex. copy : `bool`, optional If ``True``, the graph will be a copy. Returns ------- coloured : :map:`ColouredTriMesh` A version of this mesh with per-vertex colour assigned. """ ctm = ColouredTriMesh(self.points, trilist=self.trilist, colours=colours, copy=copy) return copy_landmarks_and_path(self, ctm)
def test_copy_landmarks_and_path_returns_target(): img = mio.import_builtin_asset.lenna_png() new_img = Image.init_blank(img.shape) new_img_ret = copy_landmarks_and_path(img, new_img) assert new_img_ret is new_img