menpo/image/boolean.py
def constrain_to_pointcloud(self, pointcloud, trilist=None):
        r"""
        Restricts this mask to be equal to the convex hull around a point cloud.
        This is not a per-pixel convex hull, but instead
        relies on a triangulated approximation.

        Parameters
        ----------
        pointcloud : :map:`PointCloud`
            The pointcloud of points that should be constrained to.
        trilist: ``(t, 3)`` `ndarray`, optional
            Triangle list to be used on the landmarked points in selecting
            the mask region. If None defaults to performing Delaunay
            triangulation on the points.
        """
        from menpo.transform.piecewiseaffine import PiecewiseAffine
        from menpo.transform.piecewiseaffine import TriangleContainmentError

        if self.n_dims != 2:
            raise ValueError("can only constrain mask on 2D images.")

        if trilist is not None:
            from menpo.shape import TriMesh
            pointcloud = TriMesh(pointcloud.points, trilist)

        pwa = PiecewiseAffine(pointcloud, pointcloud)
        try:
            pwa.apply(self.indices())
        except TriangleContainmentError as e:
            self.from_vector_inplace(~e.points_outside_source_domain)
r"""
        Restricts this mask to be equal to the convex hull around a point cloud.
        This is not a per-pixel convex hull, but instead
        relies on a triangulated approximation.

        Parameters
        ----------
        pointcloud : :map:`PointCloud`
            The pointcloud of points that should be constrained to.
        trilist: ``(t, 3)`` `ndarray`, optional
            Triangle list to be used on the landmarked points in selecting
            the mask region. If None defaults to performing Delaunay
            triangulation on the points.
        
r"""
Restricts this mask to be equal to the convex hull around a point cloud.
This is not a per-pixel convex hull, but instead
relies on a triangulated approximation.

Parameters

pointcloud : :map:`PointCloud`
The pointcloud of points that should be constrained to.
r " " " Restricts this mask to be equal to the convex hull around a point cloud . This is not a per - pixel convex hull but instead relies on a triangulated approximation . Parameters pointcloud : : map : ` PointCloud ` The pointcloud of points that should be constrained to .
def constrain_to_pointcloud(self, pointcloud, trilist=None):
        from menpo.transform.piecewiseaffine import PiecewiseAffine
        from menpo.transform.piecewiseaffine import TriangleContainmentError
        if self.n_dims != 2:
            raise ValueError("can only constrain mask on 2D images.")
        if trilist is not None:
            from menpo.shape import TriMesh
            pointcloud = TriMesh(pointcloud.points, trilist)
        pwa = PiecewiseAffine(pointcloud, pointcloud)
        try:
            pwa.apply(self.indices())
        except TriangleContainmentError as e:
            self.from_vector_inplace(~e.points_outside_source_domain)
def constrain_to_pointcloud ( self , pointcloud , trilist = None ) : from menpo . transform . piecewiseaffine import PiecewiseAffine from menpo . transform . piecewiseaffine import TriangleContainmentError if self . n_dims != 2 : raise ValueError ( "can only constrain mask on 2D images." ) if trilist is not None : from menpo . shape import TriMesh pointcloud = TriMesh ( pointcloud . points , trilist ) pwa = PiecewiseAffine ( pointcloud , pointcloud ) try : pwa . apply ( self . indices ( ) ) except TriangleContainmentError as e : self . from_vector_inplace ( ~ e . points_outside_source_domain )
r"""
Restricts this mask to be equal to the convex hull around a point cloud.
r " " " Restricts this mask to be equal to the convex hull around a point cloud .
r"""
        Restricts this mask to be equal to the convex hull around a point cloud.
        This is not a per-pixel convex hull, but instead
        relies on a triangulated approximation.

        Parameters
        ----------
        pointcloud : :map:`PointCloud`
            The pointcloud of points that should be constrained to.
        trilist: ``(t, 3)`` `ndarray`, optional
            Triangle list to be used on the landmarked points in selecting
            the mask region. If None defaults to performing Delaunay
            triangulation on the points.
        """
self
pointcloud
trilist