picture

Submodule extending the vtkImageActor object functionality.

Picture

class vedo.picture.Picture(obj=None)[source]

Bases: vtkRenderingCorePython.vtkImageActor, vedo.base.Base3DProp

Derived class of vtkImageActor. Used to represent 2D pictures. Can be instantiated with a path file name or with a numpy array.

Use Picture.shape to access the number of pixels in x and y.

rotateImage.py rotateImage.py

alpha(a=None)[source]

Set/get picture’s transparency.

blend(pic, alpha1=0.5, alpha2=0.5)[source]

Take L, LA, RGB, or RGBA images as input and blends them according to the alpha values and/or the opacity setting for each input.

crop(top=None, bottom=None, right=None, left=None)[source]

Crop picture.

Parameters
  • top (float) – fraction to crop from the top margin

  • bottom (float) – fraction to crop from the bottom margin

  • left (float) – fraction to crop from the left margin

  • right (float) – fraction to crop from the right margin

inputdata()[source]

Return the underlying vtkImagaData object.

mirror(axis='x')[source]

Mirror picture along x or y axis.

text(txt, pos=(0, 0, 0), s=1, c=None, alpha=1, bg=None, font='Theemim', dpi=500, justify='bottom-left')[source]

Build an image from a string.

threshold(value=None, flip=False)[source]

Create a polygonal Mesh from a Picture by filling regions with pixels luminosity above a specified value.

Parameters
  • value (float, optional) – The default is None, e.i. 1/3 of the scalar range.

  • flip (bool, optional) – Flip polygon orientations

Returns

A polygonal mesh.

Return type

Mesh

tomesh()[source]

Convert an image to polygonal data (quads), with each polygon vertex assigned a RGBA value.