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.

clone(transform=False)[source]

Return an exact copy of the input Picture. If transform is True, it is given the same scaling and position.

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

extract(component)[source]

Extract one component of the rgb image

fft(mode='magnitude', logscale=12, center=True)[source]

Fast Fourier transform of a picture.

Parameters
  • logscale (float) – if non-zero, take the logarithm of the intensity and scale it by this factor.

  • mode (str) – either [magnitude, real, imaginary, complex], compute the point array data accordingly.

  • center (bool) – shift constant zero-frequency to the center of the image for display. (FFT converts spatial images into frequency space, but puts the zero frequency at the origin)

inputdata()[source]

Return the underlying vtkImagaData object.

mirror(axis='x')[source]

Mirror picture along x or y axis.

resize(newsize)[source]

Resize the image by specifying the number of pixels in width and height. If left to zero, it will be automatically calculated to keep the original aspect ratio.

Parameters

newsize (list) – shape of picture as [npx, npy]

rfft(mode='magnitude')[source]

Reverse Fast Fourier transform of a picture.

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.

write(filename)[source]

Write picture to file as png or jpg.