Simd Library Documentation.

Home | Release Notes | Download | Documentation | Issues | GitHub
ImageFrame Class Reference

The ImageFrame class provides storage and manipulation of frames (multiplanar images). More...

Public Member Functions

def __init__ (self, format=Simd.FrameFormat.Empty, width=0, height=0, timestamp=0.0, yuvType=YuvType.Unknown)
 Creates a new frame. More...
 
def Clear (self)
 Clears frame. More...
 
def Recreate (self, Simd.FrameFormat format, int width, int height, yuvType=YuvType.Unknown)
 Recreates the imagee. More...
 
Simd.FrameFormat Format (self)
 Gets frame format. More...
 
int Width (self)
 Gets frame width. More...
 
int Height (self)
 Gets frame height. More...
 
float Timestamp (self)
 Gets frame timestamp. More...
 
Simd.YuvType GetYuvType (self)
 Gets frame YUV format type. More...
 
def Planes (self)
 Gets plane images. More...
 
bool Compatible (self, other)
 Check if current and other image frame have the same size and pixel format. More...
 
bool EqualSize (self, other)
 Check if current and other image frame have the same size. More...
 
def Copy (self, dst=None)
 Copies current image frame. More...
 
def Convert (self, dst, alpha=255)
 Converts current image frame to output image frame. More...
 
def Converted (self, FrameFormat format, alpha=255, yuvType=YuvType.Unknown)
 Gets converted current image frame in given format. More...
 
bool Save (self, str path, file=Simd.ImageFile.Undefined, quality=100)
 Saves the image frame to file in given image file format. More...
 
bool Load (self, str path, desiredFormat=Simd.FrameFormat.Empty)
 Loads an image frame from file. More...
 

Detailed Description

The ImageFrame class provides storage and manipulation of frames (multiplanar images).

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  format = Simd.FrameFormat.Empty,
  width = 0,
  height = 0,
  timestamp = 0.0,
  yuvType = YuvType.Unknown 
)

Creates a new frame.

Parameters
format- a frame format.
width- a frame width.
height- a frame height.
timestamp- a timestamp of created frame.
yuvType- a YUV format type of created frame.

Member Function Documentation

◆ Clear()

def Clear (   self)

Clears frame.

Releases plane images, sets to zero all fields.

◆ Recreate()

def Recreate (   self,
Simd.FrameFormat  format,
int  width,
int  height,
  yuvType = YuvType.Unknown 
)

Recreates the imagee.

Parameters
format- a new frame format.
width- a new frame width.
height- a new frame height.
yuvType- a new frame YUV format type.

◆ Format()

Simd.FrameFormat Format (   self)

Gets frame format.

Returns
frame format.

◆ Width()

int Width (   self)

Gets frame width.

Returns
frame width.

◆ Height()

int Height (   self)

Gets frame height.

Returns
frame height.

◆ Timestamp()

float Timestamp (   self)

Gets frame timestamp.

Returns
frame timestamp.

◆ GetYuvType()

Simd.YuvType GetYuvType (   self)

Gets frame YUV format type.

Returns
frame YUV format type.

◆ Planes()

def Planes (   self)

Gets plane images.

Returns
plane images.

◆ Compatible()

bool Compatible (   self,
  other 
)

Check if current and other image frame have the same size and pixel format.

Parameters
other- other image frame.
Returns
result of checking.

◆ EqualSize()

bool EqualSize (   self,
  other 
)

Check if current and other image frame have the same size.

Parameters
other- other image frame.
Returns
result of checking.

◆ Copy()

def Copy (   self,
  dst = None 
)

Copies current image frame.

Parameters
dst- an output image frame. It can be empty.
Returns
copied image frame.

◆ Convert()

def Convert (   self,
  dst,
  alpha = 255 
)

Converts current image frame to output image frame.

Parameters
dst- an output image frame.
alpha- a value of output alpha channel (optional).

◆ Converted()

def Converted (   self,
FrameFormat  format,
  alpha = 255,
  yuvType = YuvType.Unknown 
)

Gets converted current image frame in given format.

Parameters
format- a format of output image frame.
alpha- a value of output alpha channel (optional).
yuvType- a type of output YUV image (optional).
Returns
- converted output image frame in given format.

◆ Save()

bool Save (   self,
str  path,
  file = Simd.ImageFile.Undefined,
  quality = 100 
)

Saves the image frame to file in given image file format.

Parameters
path- a path to output image file.
file- a format of output image file. To auto choise format of output file set this parameter to Simd.ImageFile.Undefined.
quality- a parameter of compression quality (if file format supports it).
Returns
result of the operation.

◆ Load()

bool Load (   self,
str  path,
  desiredFormat = Simd.FrameFormat.Empty 
)

Loads an image frame from file.

Parameters
path- a path to input image file.
desiredFormat- a desired frame format of output image frame. It can be Simd.FrameFormat.Gray8, Simd.FrameFormat.Bgr24, Simd.FrameFormat.Bgra32, Simd.FrameFormat.Rgb24, Simd.FrameFormat.Rgba32 or Simd.FrameFormat.Empty (use frame format of input image file).
Returns
result of the operation.