menpo/visualize/base.py
def view_image_landmarks(image, channels, masked, group,
                         with_labels, without_labels, figure_id, new_figure,
                         interpolation, alpha, render_lines, line_colour,
                         line_style, line_width, render_markers, marker_style,
                         marker_size, marker_face_colour, marker_edge_colour,
                         marker_edge_width, render_numbering,
                         numbers_horizontal_align, numbers_vertical_align,
                         numbers_font_name, numbers_font_size,
                         numbers_font_style, numbers_font_weight,
                         numbers_font_colour, render_legend, legend_title,
                         legend_font_name, legend_font_style, legend_font_size,
                         legend_font_weight, legend_marker_scale,
                         legend_location, legend_bbox_to_anchor,
                         legend_border_axes_pad, legend_n_columns,
                         legend_horizontal_spacing, legend_vertical_spacing,
                         legend_border, legend_border_padding, legend_shadow,
                         legend_rounded_corners, render_axes, axes_font_name,
                         axes_font_size, axes_font_style, axes_font_weight,
                         axes_x_limits, axes_y_limits, figure_size):
    r"""
    This is a helper method that abstracts away the fact that viewing
    images and masked images is identical apart from the mask. Therefore,
    we do the class check in this method and then proceed identically whether
    the image is masked or not.

    See the documentation for _view_2d on Image or _view_2d on MaskedImage
    for information about the parameters.
    """
    import matplotlib.pyplot as plt

    if not image.has_landmarks:
        raise ValueError('Image does not have landmarks attached, unable '
                         'to view landmarks.')

    # Render self
    from menpo.image import MaskedImage
    if isinstance(image, MaskedImage):
        self_view = image.view(figure_id=figure_id, new_figure=new_figure,
                               channels=channels, masked=masked,
                               interpolation=interpolation, alpha=alpha)
    else:
        self_view = image.view(figure_id=figure_id, new_figure=new_figure,
                               channels=channels,
                               interpolation=interpolation, alpha=alpha)

    # Make sure axes are constrained to the image size
    if axes_x_limits is None:
        axes_x_limits = [0, image.width - 1]
    if axes_y_limits is None:
        axes_y_limits = [0, image.height - 1]

    # Render landmarks
    landmark_view = None  # initialize viewer object
    # useful in order to visualize the legend only for the last axis object
    render_legend_tmp = False
    for i, ax in enumerate(self_view.axes_list):
        # set current axis
        plt.sca(ax)
        # show legend only for the last axis object
        if i == len(self_view.axes_list) - 1:
            render_legend_tmp = render_legend

        # viewer
        landmark_view = image.landmarks[group].view(
            with_labels=with_labels, without_labels=without_labels,
            figure_id=self_view.figure_id, new_figure=False,
            image_view=True, render_lines=render_lines,
            line_colour=line_colour, line_style=line_style,
            line_width=line_width, render_markers=render_markers,
            marker_style=marker_style, marker_size=marker_size,
            marker_face_colour=marker_face_colour,
            marker_edge_colour=marker_edge_colour,
            marker_edge_width=marker_edge_width,
            render_numbering=render_numbering,
            numbers_horizontal_align=numbers_horizontal_align,
            numbers_vertical_align=numbers_vertical_align,
            numbers_font_name=numbers_font_name,
            numbers_font_size=numbers_font_size,
            numbers_font_style=numbers_font_style,
            numbers_font_weight=numbers_font_weight,
            numbers_font_colour=numbers_font_colour,
            render_legend=render_legend_tmp, legend_title=legend_title,
            legend_font_name=legend_font_name,
            legend_font_style=legend_font_style,
            legend_font_size=legend_font_size,
            legend_font_weight=legend_font_weight,
            legend_marker_scale=legend_marker_scale,
            legend_location=legend_location,
            legend_bbox_to_anchor=legend_bbox_to_anchor,
            legend_border_axes_pad=legend_border_axes_pad,
            legend_n_columns=legend_n_columns,
            legend_horizontal_spacing=legend_horizontal_spacing,
            legend_vertical_spacing=legend_vertical_spacing,
            legend_border=legend_border,
            legend_border_padding=legend_border_padding,
            legend_shadow=legend_shadow,
            legend_rounded_corners=legend_rounded_corners,
            render_axes=render_axes, axes_font_name=axes_font_name,
            axes_font_size=axes_font_size, axes_font_style=axes_font_style,
            axes_font_weight=axes_font_weight, axes_x_limits=axes_x_limits,
            axes_y_limits=axes_y_limits, figure_size=figure_size)

    return landmark_view
r"""
    This is a helper method that abstracts away the fact that viewing
    images and masked images is identical apart from the mask. Therefore,
    we do the class check in this method and then proceed identically whether
    the image is masked or not.

    See the documentation for _view_2d on Image or _view_2d on MaskedImage
    for information about the parameters.
    
r"""
This is a helper method that abstracts away the fact that viewing
images and masked images is identical apart from the mask. Therefore,
we do the class check in this method and then proceed identically whether
the image is masked or not.

See the documentation for _view_2d on Image or _view_2d on MaskedImage
for information about the parameters.
r " " " This is a helper method that abstracts away the fact that viewing images and masked images is identical apart from the mask . Therefore we do the class check in this method and then proceed identically whether the image is masked or not . See the documentation for _view_2d on Image or _view_2d on MaskedImage for information about the parameters .
def view_image_landmarks(image, channels, masked, group,
                         with_labels, without_labels, figure_id, new_figure,
                         interpolation, alpha, render_lines, line_colour,
                         line_style, line_width, render_markers, marker_style,
                         marker_size, marker_face_colour, marker_edge_colour,
                         marker_edge_width, render_numbering,
                         numbers_horizontal_align, numbers_vertical_align,
                         numbers_font_name, numbers_font_size,
                         numbers_font_style, numbers_font_weight,
                         numbers_font_colour, render_legend, legend_title,
                         legend_font_name, legend_font_style, legend_font_size,
                         legend_font_weight, legend_marker_scale,
                         legend_location, legend_bbox_to_anchor,
                         legend_border_axes_pad, legend_n_columns,
                         legend_horizontal_spacing, legend_vertical_spacing,
                         legend_border, legend_border_padding, legend_shadow,
                         legend_rounded_corners, render_axes, axes_font_name,
                         axes_font_size, axes_font_style, axes_font_weight,
                         axes_x_limits, axes_y_limits, figure_size):
    import matplotlib.pyplot as plt
    if not image.has_landmarks:
        raise ValueError('Image does not have landmarks attached, unable '
                         'to view landmarks.')
    from menpo.image import MaskedImage
    if isinstance(image, MaskedImage):
        self_view = image.view(figure_id=figure_id, new_figure=new_figure,
                               channels=channels, masked=masked,
                               interpolation=interpolation, alpha=alpha)
    else:
        self_view = image.view(figure_id=figure_id, new_figure=new_figure,
                               channels=channels,
                               interpolation=interpolation, alpha=alpha)
    if axes_x_limits is None:
        axes_x_limits = [0, image.width - 1]
    if axes_y_limits is None:
        axes_y_limits = [0, image.height - 1]
    landmark_view = None  
    render_legend_tmp = False
    for i, ax in enumerate(self_view.axes_list):
        plt.sca(ax)
        if i == len(self_view.axes_list) - 1:
            render_legend_tmp = render_legend
        landmark_view = image.landmarks[group].view(
            with_labels=with_labels, without_labels=without_labels,
            figure_id=self_view.figure_id, new_figure=False,
            image_view=True, render_lines=render_lines,
            line_colour=line_colour, line_style=line_style,
            line_width=line_width, render_markers=render_markers,
            marker_style=marker_style, marker_size=marker_size,
            marker_face_colour=marker_face_colour,
            marker_edge_colour=marker_edge_colour,
            marker_edge_width=marker_edge_width,
            render_numbering=render_numbering,
            numbers_horizontal_align=numbers_horizontal_align,
            numbers_vertical_align=numbers_vertical_align,
            numbers_font_name=numbers_font_name,
            numbers_font_size=numbers_font_size,
            numbers_font_style=numbers_font_style,
            numbers_font_weight=numbers_font_weight,
            numbers_font_colour=numbers_font_colour,
            render_legend=render_legend_tmp, legend_title=legend_title,
            legend_font_name=legend_font_name,
            legend_font_style=legend_font_style,
            legend_font_size=legend_font_size,
            legend_font_weight=legend_font_weight,
            legend_marker_scale=legend_marker_scale,
            legend_location=legend_location,
            legend_bbox_to_anchor=legend_bbox_to_anchor,
            legend_border_axes_pad=legend_border_axes_pad,
            legend_n_columns=legend_n_columns,
            legend_horizontal_spacing=legend_horizontal_spacing,
            legend_vertical_spacing=legend_vertical_spacing,
            legend_border=legend_border,
            legend_border_padding=legend_border_padding,
            legend_shadow=legend_shadow,
            legend_rounded_corners=legend_rounded_corners,
            render_axes=render_axes, axes_font_name=axes_font_name,
            axes_font_size=axes_font_size, axes_font_style=axes_font_style,
            axes_font_weight=axes_font_weight, axes_x_limits=axes_x_limits,
            axes_y_limits=axes_y_limits, figure_size=figure_size)
    return landmark_view
def view_image_landmarks ( image , channels , masked , group , with_labels , without_labels , figure_id , new_figure , interpolation , alpha , render_lines , line_colour , line_style , line_width , render_markers , marker_style , marker_size , marker_face_colour , marker_edge_colour , marker_edge_width , render_numbering , numbers_horizontal_align , numbers_vertical_align , numbers_font_name , numbers_font_size , numbers_font_style , numbers_font_weight , numbers_font_colour , render_legend , legend_title , legend_font_name , legend_font_style , legend_font_size , legend_font_weight , legend_marker_scale , legend_location , legend_bbox_to_anchor , legend_border_axes_pad , legend_n_columns , legend_horizontal_spacing , legend_vertical_spacing , legend_border , legend_border_padding , legend_shadow , legend_rounded_corners , render_axes , axes_font_name , axes_font_size , axes_font_style , axes_font_weight , axes_x_limits , axes_y_limits , figure_size ) : import matplotlib . pyplot as plt if not image . has_landmarks : raise ValueError ( 'Image does not have landmarks attached, unable ' 'to view landmarks.' ) from menpo . image import MaskedImage if isinstance ( image , MaskedImage ) : self_view = image . view ( figure_id = figure_id , new_figure = new_figure , channels = channels , masked = masked , interpolation = interpolation , alpha = alpha ) else : self_view = image . view ( figure_id = figure_id , new_figure = new_figure , channels = channels , interpolation = interpolation , alpha = alpha ) if axes_x_limits is None : axes_x_limits = [ 0 , image . width - 1 ] if axes_y_limits is None : axes_y_limits = [ 0 , image . height - 1 ] landmark_view = None render_legend_tmp = False for i , ax in enumerate ( self_view . axes_list ) : plt . sca ( ax ) if i == len ( self_view . axes_list ) - 1 : render_legend_tmp = render_legend landmark_view = image . landmarks [ group ] . view ( with_labels = with_labels , without_labels = without_labels , figure_id = self_view . figure_id , new_figure = False , image_view = True , render_lines = render_lines , line_colour = line_colour , line_style = line_style , line_width = line_width , render_markers = render_markers , marker_style = marker_style , marker_size = marker_size , marker_face_colour = marker_face_colour , marker_edge_colour = marker_edge_colour , marker_edge_width = marker_edge_width , render_numbering = render_numbering , numbers_horizontal_align = numbers_horizontal_align , numbers_vertical_align = numbers_vertical_align , numbers_font_name = numbers_font_name , numbers_font_size = numbers_font_size , numbers_font_style = numbers_font_style , numbers_font_weight = numbers_font_weight , numbers_font_colour = numbers_font_colour , render_legend = render_legend_tmp , legend_title = legend_title , legend_font_name = legend_font_name , legend_font_style = legend_font_style , legend_font_size = legend_font_size , legend_font_weight = legend_font_weight , legend_marker_scale = legend_marker_scale , legend_location = legend_location , legend_bbox_to_anchor = legend_bbox_to_anchor , legend_border_axes_pad = legend_border_axes_pad , legend_n_columns = legend_n_columns , legend_horizontal_spacing = legend_horizontal_spacing , legend_vertical_spacing = legend_vertical_spacing , legend_border = legend_border , legend_border_padding = legend_border_padding , legend_shadow = legend_shadow , legend_rounded_corners = legend_rounded_corners , render_axes = render_axes , axes_font_name = axes_font_name , axes_font_size = axes_font_size , axes_font_style = axes_font_style , axes_font_weight = axes_font_weight , axes_x_limits = axes_x_limits , axes_y_limits = axes_y_limits , figure_size = figure_size ) return landmark_view
r"""
This is a helper method that abstracts away the fact that viewing
images and masked images is identical apart from the mask.
r " " " This is a helper method that abstracts away the fact that viewing images and masked images is identical apart from the mask .
r"""
    This is a helper method that abstracts away the fact that viewing
    images and masked images is identical apart from the mask. Therefore,
    we do the class check in this method and then proceed identically whether
    the image is masked or not.

    See the documentation for _view_2d on Image or _view_2d on MaskedImage
    for information about the parameters.
    """ # Render self # Make sure axes are constrained to the image size # Render landmarks # initialize viewer object # useful in order to visualize the legend only for the last axis object # set current axis # show legend only for the last axis object # viewer
image
channels
masked
group
with_labels
without_labels
figure_id
new_figure
interpolation
alpha
render_lines
line_colour
line_style
line_width
render_markers
marker_style
marker_size
marker_face_colour
marker_edge_colour
marker_edge_width
render_numbering
numbers_horizontal_align
numbers_vertical_align
numbers_font_name
numbers_font_size
numbers_font_style
numbers_font_weight
numbers_font_colour
render_legend
legend_title
legend_font_name
legend_font_style
legend_font_size
legend_font_weight
legend_marker_scale
legend_location
legend_bbox_to_anchor
legend_border_axes_pad
legend_n_columns
legend_horizontal_spacing
legend_vertical_spacing
legend_border
legend_border_padding
legend_shadow
legend_rounded_corners
render_axes
axes_font_name
axes_font_size
axes_font_style
axes_font_weight
axes_x_limits
axes_y_limits
figure_size