GLRasterizer

class menpo.rasterize.opengl.GLRasterizer[source]

Bases: CyRasterizerBase

rasterize_mesh(rasterizable)[source]

Rasterize the object to an image and generate an interpolated 3-float image from the shape information on the rasterizable object.

Parameters:

rasterizable : object implementing the Rasterizable interface.

Will be queried for some state to rasterize via the Rasterizable interface. Note that currently, color mesh rasterizations are not supported.

Returns:

rgb_image : 3 channel MaskedImage of shape (width, height)

The result of the rasterization. Mask is true iff the pixel was rendered to by OpenGL.

shape_image: 3 channel MaskedImage of shape (width, height) :

The result of interpolating the spatial information of each vertex across the visible primitives. Note that the shape information is NOT adjusted by the P,V,M matrices, and so the resulting shape image is always in the original objects reference shape (i.e. the z value will not necessarily correspond to a depth buffer).

rasterize_mesh_with_f3v_interpolant(rasterizable, per_vertex_f3v=None)[source]

Rasterize the object to an image and generate an interpolated 3-float image from a per vertex float 3 vector.

If no per_vertex_f3v is provided, the model’s shape is used (making this method equivalent to rasterize_mesh_with_shape_image)

Parameters:

rasterizable : object implementing the Rasterizable interface.

Will be queried for some state to rasterize via the Rasterizable interface. Note that currently, color mesh rasterizations are not supported.

per_vertex_f3v : optional, ndarray (n_points, 3)

A per-vertex 3 vector of floats that will be interpolated across the image.

Returns:

rgb_image : 3 channel MaskedImage of shape (width, height)

The result of the rasterization. Mask is true iff the pixel was rendered to by OpenGL.

interp_image: 3 channel MaskedImage of shape (width, height) :

The result of interpolating the per_vertex_f3v across the visible primitives.

rasterize_mesh_with_shape_image(rasterizable)[source]

Rasterize the object to an image and generate an interpolated 3-float image from the shape information on the rasterizable object.

Parameters:

rasterizable : object implementing the Rasterizable interface.

Will be queried for some state to rasterize via the Rasterizable interface. Note that currently, color mesh rasterizations are not supported.

Returns:

rgb_image : 3 channel MaskedImage of shape (width, height)

The result of the rasterization. Mask is true iff the pixel was rendered to by OpenGL.

shape_image: 3 channel MaskedImage of shape (width, height) :

The result of interpolating the spatial information of each vertex across the visible primitives. Note that the shape information is NOT adjusted by the P,V,M matrices, and so the resulting shape image is always in the original objects reference shape (i.e. the z value will not necessarily correspond to a depth buffer).