menpo/image/base.py
def crop_to_landmarks_proportion_inplace(self, boundary_proportion,
                                             group=None, label=None,
                                             minimum=True,
                                             constrain_to_boundary=True):
        r"""
        Crop this image to be bounded around a set of landmarks with a
        border proportional to the landmark spread or range.

        Parameters
        ----------
        boundary_proportion : `float`
            Additional padding to be added all around the landmarks
            bounds defined as a proportion of the landmarks range. See
            the minimum parameter for a definition of how the range is
            calculated.
        group : `str`, optional
            The key of the landmark set that should be used. If ``None``
            and if there is only one set of landmarks, this set will be used.
        label : `str`, optional
            The label of of the landmark manager that you wish to use. If
           ``None`` all landmarks in the group are used.
        minimum : `bool`, optional
            If ``True`` the specified proportion is relative to the minimum
            value of the landmarks' per-dimension range; if ``False`` w.r.t. the
            maximum value of the landmarks' per-dimension range.
        constrain_to_boundary : `bool`, optional
            If ``True``, the crop will be snapped to not go beyond this images
            boundary. If ``False``, an :map:`ImageBoundaryError` will be raised
            if an attempt is made to go beyond the edge of the image.

        Returns
        -------
        image : :map:`Image`
            This image, cropped to its landmarks with a border proportional to
            the landmark spread or range.

        Raises
        ------
        ImageBoundaryError
            Raised if ``constrain_to_boundary=False``, and an attempt is made
            to crop the image in a way that violates the image bounds.
        """
        pc = self.landmarks[group][label]
        if minimum:
            boundary = boundary_proportion * np.min(pc.range())
        else:
            boundary = boundary_proportion * np.max(pc.range())
        return self.crop_to_landmarks_inplace(
            group=group, label=label, boundary=boundary,
            constrain_to_boundary=constrain_to_boundary)
r"""
        Crop this image to be bounded around a set of landmarks with a
        border proportional to the landmark spread or range.

        Parameters
        ----------
        boundary_proportion : `float`
            Additional padding to be added all around the landmarks
            bounds defined as a proportion of the landmarks range. See
            the minimum parameter for a definition of how the range is
            calculated.
        group : `str`, optional
            The key of the landmark set that should be used. If ``None``
            and if there is only one set of landmarks, this set will be used.
        label : `str`, optional
            The label of of the landmark manager that you wish to use. If
           ``None`` all landmarks in the group are used.
        minimum : `bool`, optional
            If ``True`` the specified proportion is relative to the minimum
            value of the landmarks' per-dimension range; if ``False`` w.r.t. the
            maximum value of the landmarks' per-dimension range.
        constrain_to_boundary : `bool`, optional
            If ``True``, the crop will be snapped to not go beyond this images
            boundary. If ``False``, an :map:`ImageBoundaryError` will be raised
            if an attempt is made to go beyond the edge of the image.

        Returns
        -------
        image : :map:`Image`
            This image, cropped to its landmarks with a border proportional to
            the landmark spread or range.

        Raises
        ------
        ImageBoundaryError
            Raised if ``constrain_to_boundary=False``, and an attempt is made
            to crop the image in a way that violates the image bounds.
        
r"""
Crop this image to be bounded around a set of landmarks with a
border proportional to the landmark spread or range.

Parameters

boundary_proportion : `float`
Additional padding to be added all around the landmarks
bounds defined as a proportion of the landmarks range. See
the minimum parameter for a definition of how the range is
calculated.
group : `str`, optional
The key of the landmark set that should be used. If ``None``
and if there is only one set of landmarks, this set will be used.
label : `str`, optional
The label of of the landmark manager that you wish to use. If
``None`` all landmarks in the group are used.

Returns

image : :map:`Image`
This image, cropped to its landmarks with a border proportional to
the landmark spread or range.

Raises

ImageBoundaryError
Raised if ``constrain_to_boundary=False``, and an attempt is made
to crop the image in a way that violates the image bounds.
r " " " Crop this image to be bounded around a set of landmarks with a border proportional to the landmark spread or range . Parameters boundary_proportion : ` float ` Additional padding to be added all around the landmarks bounds defined as a proportion of the landmarks range . See the minimum parameter for a definition of how the range is calculated . group : ` str ` optional The key of the landmark set that should be used . If ` ` None ` ` and if there is only one set of landmarks this set will be used . label : ` str ` optional The label of of the landmark manager that you wish to use . If ` ` None ` ` all landmarks in the group are used . Returns image : : map : ` Image ` This image cropped to its landmarks with a border proportional to the landmark spread or range . Raises ImageBoundaryError Raised if ` ` constrain_to_boundary = False ` ` and an attempt is made to crop the image in a way that violates the image bounds .
def crop_to_landmarks_proportion_inplace(self, boundary_proportion,
                                             group=None, label=None,
                                             minimum=True,
                                             constrain_to_boundary=True):
        pc = self.landmarks[group][label]
        if minimum:
            boundary = boundary_proportion * np.min(pc.range())
        else:
            boundary = boundary_proportion * np.max(pc.range())
        return self.crop_to_landmarks_inplace(
            group=group, label=label, boundary=boundary,
            constrain_to_boundary=constrain_to_boundary)
def crop_to_landmarks_proportion_inplace ( self , boundary_proportion , group = None , label = None , minimum = True , constrain_to_boundary = True ) : pc = self . landmarks [ group ] [ label ] if minimum : boundary = boundary_proportion * np . min ( pc . range ( ) ) else : boundary = boundary_proportion * np . max ( pc . range ( ) ) return self . crop_to_landmarks_inplace ( group = group , label = label , boundary = boundary , constrain_to_boundary = constrain_to_boundary )
r"""
Crop this image to be bounded around a set of landmarks with a
border proportional to the landmark spread or range.
r " " " Crop this image to be bounded around a set of landmarks with a border proportional to the landmark spread or range .
r"""
        Crop this image to be bounded around a set of landmarks with a
        border proportional to the landmark spread or range.

        Parameters
        ----------
        boundary_proportion : `float`
            Additional padding to be added all around the landmarks
            bounds defined as a proportion of the landmarks range. See
            the minimum parameter for a definition of how the range is
            calculated.
        group : `str`, optional
            The key of the landmark set that should be used. If ``None``
            and if there is only one set of landmarks, this set will be used.
        label : `str`, optional
            The label of of the landmark manager that you wish to use. If
           ``None`` all landmarks in the group are used.
        minimum : `bool`, optional
            If ``True`` the specified proportion is relative to the minimum
            value of the landmarks' per-dimension range; if ``False`` w.r.t. the
            maximum value of the landmarks' per-dimension range.
        constrain_to_boundary : `bool`, optional
            If ``True``, the crop will be snapped to not go beyond this images
            boundary. If ``False``, an :map:`ImageBoundaryError` will be raised
            if an attempt is made to go beyond the edge of the image.

        Returns
        -------
        image : :map:`Image`
            This image, cropped to its landmarks with a border proportional to
            the landmark spread or range.

        Raises
        ------
        ImageBoundaryError
            Raised if ``constrain_to_boundary=False``, and an attempt is made
            to crop the image in a way that violates the image bounds.
        """
self
boundary_proportion
group
label
minimum
constrain_to_boundary