GstVideo.VideoMetaTransformMatrix

Fields

Name

Type

Access

Description

in_info

GstVideo.VideoInfo

r/w

the input GstVideo.VideoInfo

in_rectangle

GstVideo.VideoRectangle

r/w

the input GstVideo.VideoRectangle

matrix

[float]

r/w

a 3x3 matrix representing an homographic transformation

out_info

GstVideo.VideoInfo

r/w

the output GstVideo.VideoInfo

out_rectangle

GstVideo.VideoRectangle

r/w

the output GstVideo.VideoRectangle

Methods

class

get_quark ()

init (in_info, in_rectangle, out_info, out_rectangle)

point (x, y)

point_clipped (x, y)

rectangle (rect)

rectangle_clipped (rect)

Details

class GstVideo.VideoMetaTransformMatrix

Extra data passed to a video transform Gst.MetaTransformFunction such as: “gst-video-matrix”.

The matrix represents a transformation that is applied to the content of in_rectangle, and its output is put inside out_rectangle. The coordinate system has it’s (0, 0) in the top-left corner of the rectangles and goes down and right from there..

It’s a programming error to have a singular matrix.

New in version 1.28.

classmethod get_quark()[source]
Returns:

a #GQuark

Return type:

int

Get the #GQuark for the “gst-video-matrix” metadata transform operation.

New in version 1.28.

init(in_info, in_rectangle, out_info, out_rectangle)[source]
Parameters:

Based on the rectangles, initializes the matrix to do a translation and scaling from in_rectangle to out_rectangle

New in version 1.28.

point(x, y)[source]
Parameters:
  • x (int) – a non-None pointer to the X value of the coordinate

  • y (int) – a non-None pointer to the Y value of the coordinate

Returns:

False if the point is outside of self.out_rectangle after the transformation has been applied

x:

a non-None pointer to the X value of the coordinate

y:

a non-None pointer to the Y value of the coordinate

Return type:

(bool, x: int, y: int)

Transforms the (x, y) point from the input coordinates to the output ones. The point’s coordinates are transformed by first applying the self.matrix to it using the top left (x, y) of self.in_rectangle as the origin, then translate it to use the top-left of self.out_rectangle as new origin.

New in version 1.28.

point_clipped(x, y)[source]
Parameters:
  • x (int) – a non-None pointer to the X value of the coordinate

  • y (int) – a non-None pointer to the Y value of the coordinate

Returns:

False if the point is outside of self.out_rectangle after the transformation has been applied

x:

a non-None pointer to the X value of the coordinate

y:

a non-None pointer to the Y value of the coordinate

Return type:

(bool, x: int, y: int)

Transforms the (x, y) point from the input coordinates to the output ones. The point’s coordinates are transformed by first applying the self.matrix to it using the top left (x, y) of self.in_rectangle as the origin, then translate it to use the top-left of self.out_rectangle as new origin.

New in version 1.28.

rectangle(rect)[source]
Parameters:

rect (GstVideo.VideoRectangle) – a rectangle in the coordinate of the original image

Returns:

False is the output rectangle is not axis aligned

rect:

a rectangle in the coordinate of the original image

Return type:

(bool, rect: GstVideo.VideoRectangle)

Transforms rect from the input coordinates to the output ones. The point’s coordinates are transformed by first applying the self.matrix to it using the top left (x, y) of self.in_rectangle as the origin, then translate it to use the top-left of self.out_rectangle as new origin.

rect is always axis aligned at input and this function only returns axis aligned rectangles as output, otherwise it returns False.

Output rectangle could be in partially or totally outside of self.out_rectangle.

New in version 1.28.

rectangle_clipped(rect)[source]
Parameters:

rect (GstVideo.VideoRectangle) – a rectangle in the coordinate of the original image

Returns:

False if the output rectangle is not axis aligned or if the rectangle is entirely outside of the out_rectangle.

rect:

a rectangle in the coordinate of the original image

Return type:

(bool, rect: GstVideo.VideoRectangle)

Transforms rect from the input coordinates to the output ones. The point’s coordinates are transformed by first applying the self.matrix to it using the top left (x, y) of self.in_rectangle as the origin, then translate it to use the top-left of self.out_rectangle as new origin.

rect is always axis aligned at input and this function only returns axis aligned rectangles as output, otherwise it returns False.

Output rectangle will be clipped to fit inside self.out_rectangle.

New in version 1.28.