MNN::CV::Matrix类 参考

`#include <Matrix.h>`

## Public 类型

enum | TypeMask { kIdentity_Mask = 0, kTranslate_Mask = 0x01, kScale_Mask = 0x02, kAffine_Mask = 0x04, kPerspective_Mask = 0x08 }
enum | ScaleToFit { kFill_ScaleToFit, kStart_ScaleToFit, kCenter_ScaleToFit, kEnd_ScaleToFit }

## Public 成员函数

| Matrix ()
TypeMask | getType () const
bool | isIdentity () const
bool | isScaleTranslate () const
bool | isTranslate () const
bool | rectStaysRect () const
bool | preservesAxisAlignment () const
float | operator[] (int index) const
float | get (int index) const
float | getScaleX () const
float | getScaleY () const
float | getSkewY () const
float | getSkewX () const
float | getTranslateX () const
float | getTranslateY () const
float | getPerspX () const
float | getPerspY () const
float & | operator[] (int index)
void | set (int index, float value)
void | setScaleX (float v)
void | setScaleY (float v)
void | setSkewY (float v)
void | setSkewX (float v)
void | setTranslateX (float v)
void | setTranslateY (float v)
void | setPerspX (float v)
void | setPerspY (float v)
void | setAll (float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float persp0, float persp1, float persp2)
void | get9 (float buffer[9]) const
void | set9 (const float buffer[9])
void | reset ()
void | setIdentity ()
void | setTranslate (float dx, float dy)
void | setScale (float sx, float sy, float px, float py)
void | setScale (float sx, float sy)
void | setRotate (float degrees, float px, float py)
void | setRotate (float degrees)
void | setSinCos (float sinValue, float cosValue, float px, float py)
void | setSinCos (float sinValue, float cosValue)
void | setSkew (float kx, float ky, float px, float py)
void | setSkew (float kx, float ky)
void | setConcat (const Matrix &a, const Matrix &b)
void | preTranslate (float dx, float dy)
void | preScale (float sx, float sy, float px, float py)
void | preScale (float sx, float sy)
void | preRotate (float degrees, float px, float py)
void | preRotate (float degrees)
void | preSkew (float kx, float ky, float px, float py)
void | preSkew (float kx, float ky)
void | preConcat (const Matrix &other)
void | postTranslate (float dx, float dy)
void | postScale (float sx, float sy, float px, float py)
void | postScale (float sx, float sy)
bool | postIDiv (int divx, int divy)
void | postRotate (float degrees, float px, float py)
void | postRotate (float degrees)
void | postSkew (float kx, float ky, float px, float py)
void | postSkew (float kx, float ky)
void | postConcat (const Matrix &other)
bool | setRectToRect (const Rect &src, const Rect &dst, ScaleToFit stf)
bool | setPolyToPoly (const Point src[], const Point dst[], int count)
bool | invert (Matrix *inverse) const
bool | asAffine (float affine[6]) const
void | setAffine (const float affine[6])
void | mapPoints (Point dst[], const Point src[], int count) const
void | mapPoints (Point pts[], int count) const
void | mapXY (float x, float y, Point *result) const
Point | mapXY (float x, float y) const
bool | mapRect (Rect *dst, const Rect &src) const
bool | mapRect (Rect *rect) const
Rect | mapRect (const Rect &src) const
void | mapRectScaleTranslate (Rect *dst, const Rect &src) const
bool | cheapEqualTo (const Matrix &m) const
void | dump () const
float | getMinScale () const
float | getMaxScale () const
bool | getMinMaxScales (float scaleFactors[2]) const
void | dirtyMatrixTypeCache ()
void | setScaleTranslate (float sx, float sy, float tx, float ty)

## 静态 Public 成员函数

static Matrix | MakeScale (float sx, float sy)
static Matrix | MakeScale (float scale)
static Matrix | MakeTrans (float dx, float dy)
static Matrix | MakeAll (float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, float pers0, float pers1, float pers2)
static Matrix | MakeRectToRect (const Rect &src, const Rect &dst, ScaleToFit stf)
static void | SetAffineIdentity (float affine[6])
static const Matrix & | I ()
static const Matrix & | InvalidMatrix ()
static Matrix | Concat (const Matrix &a, const Matrix &b)

## 静态 Public 属性

static constexpr int | kMScaleX = 0
| horizontal scale factor 更多...
static constexpr int | kMSkewX = 1
| horizontal skew factor 更多...
static constexpr int | kMTransX = 2
| horizontal translation 更多...
static constexpr int | kMSkewY = 3
| vertical skew factor 更多...
static constexpr int | kMScaleY = 4
| vertical scale factor 更多...
static constexpr int | kMTransY = 5
| vertical translation 更多...
static constexpr int | kMPersp0 = 6
| input x perspective factor 更多...
static constexpr int | kMPersp1 = 7
| input y perspective factor 更多...
static constexpr int | kMPersp2 = 8
| perspective bias 更多...
static constexpr int | kAScaleX = 0
| horizontal scale factor 更多...
static constexpr int | kASkewY = 1
| vertical skew factor 更多...
static constexpr int | kASkewX = 2
| horizontal skew factor 更多...
static constexpr int | kAScaleY = 3
| vertical scale factor 更多...
static constexpr int | kATransX = 4
| horizontal translation 更多...
static constexpr int | kATransY = 5
| vertical translation 更多...

## 友元

MNN_PUBLIC bool | operator== (const Matrix &a, const Matrix &b)
MNN_PUBLIC bool | operator!= (const Matrix &a, const Matrix &b)

## 详细描述

Matrix holds a 3x3 matrix for transforming coordinates. This allows mapping Point and vectors with translation, scaling, skewing, rotation, and perspective.

Matrix elements are in row major order. Matrix does not have a constructor, so it must be explicitly initialized. setIdentity() initializes Matrix so it has no effect. setTranslate(), setScale(), setSkew(), setRotate(), set9 and setAll() initializes all Matrix elements with the corresponding mapping.

Matrix includes a hidden variable that classifies the type of matrix to improve performance. Matrix is not thread safe unless getType() is called first.

## 成员枚举类型说明

## ScaleToFit

enum MNN::CV::Matrix::ScaleToFit

枚举值
kFill_ScaleToFit | scales in x and y to fill destination Rect
kStart_ScaleToFit | scales and aligns to left and top
kCenter_ScaleToFit | scales and aligns to center
kEnd_ScaleToFit | scales and aligns to right and bottom

## TypeMask

enum MNN::CV::Matrix::TypeMask

枚举值
kIdentity_Mask | identity Matrix; all bits clear
kTranslate_Mask | translation Matrix
kScale_Mask | scale Matrix
kAffine_Mask | skew or rotate Matrix
kPerspective_Mask | perspective Matrix

## 构造及析构函数说明

## Matrix()

MNN::CV::Matrix::Matrix | ( |  | ) |

inline

## 成员函数说明

## asAffine()

bool MNN::CV::Matrix::asAffine | ( | float | affine[6] | ) | const

Fills affine in column major order. Sets affine to:

    | scale-x  skew-x translate-x |
    | skew-y  scale-y translate-y |

If Matrix contains perspective, returns false and leaves affine unchanged.

参数

  affine | storage for 3x2 affine matrix; may be nullptr

返回
  true if Matrix does not contain perspective

## cheapEqualTo()

bool MNN::CV::Matrix::cheapEqualTo | ( | const Matrix & | m | ) | const

inline

Returns true if Matrix equals m, using an efficient comparison.

Returns false when the sign of zero values is the different; when one matrix has positive zero value and the other has negative zero value.

Returns true even when both Matrix contain NaN.

NaN never equals any value, including itself. To improve performance, NaN values are treated as bit patterns that are equal if their bit patterns are equal.

参数

  m | Matrix to compare

返回
  true if m and Matrix are represented by identical bit patterns

## Concat()

static Matrix MNN::CV::Matrix::Concat | ( | const Matrix & | a,
|  | const Matrix & | b
| ) |  |

inlinestatic

Returns Matrix a multiplied by Matrix b.

Given:

        | A B C |      | J K L |
    a = | D E F |, b = | M N O |
        | G H I |      | P Q R |

sets Matrix to:

            | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
    a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
            | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |

参数

  a | Matrix on left side of multiply expression
  b | Matrix on right side of multiply expression

返回
  Matrix computed from a times b

## dirtyMatrixTypeCache()

void MNN::CV::Matrix::dirtyMatrixTypeCache | ( |  | ) |

inline

Sets internal cache to unknown state. Use to force update after repeated modifications to Matrix element reference returned by operator[](int index).

## dump()

void MNN::CV::Matrix::dump | ( |  | ) | const

Writes text representation of Matrix to standard output. Floating point values are written with limited precision; it may not be possible to reconstruct original Matrix from output.

## get()

float MNN::CV::Matrix::get | ( | int | index | ) | const

inline

Returns one matrix value. Asserts if index is out of range and SK_DEBUG is defined.

参数

  index | one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2

返回
  value corresponding to index

## get9()

void MNN::CV::Matrix::get9 | ( | float | buffer[9] | ) | const

inline

Copies nine scalar values contained by Matrix into buffer, in member value ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.

参数

  buffer | storage for nine scalar values

## getMaxScale()

float MNN::CV::Matrix::getMaxScale | ( |  | ) | const

Returns the maximum scaling factor of Matrix by decomposing the scaling and skewing elements. Returns -1 if scale factor overflows or Matrix contains perspective.

返回
  maximum scale factor

## getMinMaxScales()

bool MNN::CV::Matrix::getMinMaxScales | ( | float | scaleFactors[2] | ) | const

Sets scaleFactors[0] to the minimum scaling factor, and scaleFactors[1] to the maximum scaling factor. Scaling factors are computed by decomposing the Matrix scaling and skewing elements.

Returns true if scaleFactors are found; otherwise, returns false and sets scaleFactors to undefined values.

参数

  scaleFactors | storage for minimum and maximum scale factors

返回
  true if scale factors were computed correctly

## getMinScale()

float MNN::CV::Matrix::getMinScale | ( |  | ) | const

Returns the minimum scaling factor of Matrix by decomposing the scaling and skewing elements. Returns -1 if scale factor overflows or Matrix contains perspective.

返回
  minimum scale factor

## getPerspX()

float MNN::CV::Matrix::getPerspX | ( |  | ) | const

inline

Returns factor scaling input x-axis relative to input y-axis.

返回
  input x-axis perspective factor

## getPerspY()

float MNN::CV::Matrix::getPerspY | ( |  | ) | const

inline

Returns factor scaling input y-axis relative to input x-axis.

返回
  input y-axis perspective factor

## getScaleX()

float MNN::CV::Matrix::getScaleX | ( |  | ) | const

inline

Returns scale factor multiplied by x-axis input, contributing to x-axis output. With mapPoints(), scales Point along the x-axis.

返回
  horizontal scale factor

## getScaleY()

float MNN::CV::Matrix::getScaleY | ( |  | ) | const

inline

Returns scale factor multiplied by y-axis input, contributing to y-axis output. With mapPoints(), scales Point along the y-axis.

返回
  vertical scale factor

## getSkewX()

float MNN::CV::Matrix::getSkewX | ( |  | ) | const

inline

Returns scale factor multiplied by y-axis input, contributing to x-axis output. With mapPoints(), skews Point along the x-axis. Skewing both axes can rotate Point.

返回
  horizontal scale factor

## getSkewY()

float MNN::CV::Matrix::getSkewY | ( |  | ) | const

inline

Returns scale factor multiplied by x-axis input, contributing to y-axis output. With mapPoints(), skews Point along the y-axis. Skewing both axes can rotate Point.

返回
  vertical skew factor

## getTranslateX()

float MNN::CV::Matrix::getTranslateX | ( |  | ) | const

inline

Returns translation contributing to x-axis output. With mapPoints(), moves Point along the x-axis.

返回
  horizontal translation factor

## getTranslateY()

float MNN::CV::Matrix::getTranslateY | ( |  | ) | const

inline

Returns translation contributing to y-axis output. With mapPoints(), moves Point along the y-axis.

返回
  vertical translation factor

## getType()

TypeMask MNN::CV::Matrix::getType | ( |  | ) | const

inline

Returns a bit field describing the transformations the matrix may perform. The bit field is computed conservatively, so it may include false positives. For example, when kPerspective_Mask is set, all other bits are set.

返回
  kIdentity_Mask, or combinations of: kTranslate_Mask, kScale_Mask, kAffine_Mask, kPerspective_Mask

## I()

static const Matrix& MNN::CV::Matrix::I | ( |  | ) |

static

Returns reference to const identity Matrix. Returned Matrix is set to:

    | 1 0 0 |
    | 0 1 0 |
    | 0 0 1 |

返回
  const identity Matrix

## InvalidMatrix()

static const Matrix& MNN::CV::Matrix::InvalidMatrix | ( |  | ) |

static

Returns reference to a const Matrix with invalid values. Returned Matrix is set to:

    | SK_ScalarMax SK_ScalarMax SK_ScalarMax |
    | SK_ScalarMax SK_ScalarMax SK_ScalarMax |
    | SK_ScalarMax SK_ScalarMax SK_ScalarMax |

返回
  const invalid Matrix

## invert()

bool MNN::CV::Matrix::invert | ( | Matrix * | inverse | ) | const

inline

Sets inverse to reciprocal matrix, returning true if Matrix can be inverted. Geometrically, if Matrix maps from source to destination, inverse Matrix maps from destination to source. If Matrix can not be inverted, inverse is unchanged.

参数

  inverse | storage for inverted Matrix; may be nullptr

返回
  true if Matrix can be inverted

## isIdentity()

bool MNN::CV::Matrix::isIdentity | ( |  | ) | const

inline

Returns true if Matrix is identity. Identity matrix is:

    | 1 0 0 |
    | 0 1 0 |
    | 0 0 1 |

返回
  true if Matrix has no effect

## isScaleTranslate()

bool MNN::CV::Matrix::isScaleTranslate | ( |  | ) | const

inline

Returns true if Matrix at most scales and translates. Matrix may be identity, contain only scale elements, only translate elements, or both. Matrix form is:

    | scale-x    0    translate-x |
    |    0    scale-y translate-y |
    |    0       0         1      |

返回
  true if Matrix is identity; or scales, translates, or both

## isTranslate()

bool MNN::CV::Matrix::isTranslate | ( |  | ) | const

inline

Returns true if Matrix is identity, or translates. Matrix form is:

    | 1 0 translate-x |
    | 0 1 translate-y |
    | 0 0      1      |

返回
  true if Matrix is identity, or translates

## MakeAll()

static Matrix MNN::CV::Matrix::MakeAll | ( | float | scaleX,
|  | float | skewX,
|  | float | transX,
|  | float | skewY,
|  | float | scaleY,
|  | float | transY,
|  | float | pers0,
|  | float | pers1,
|  | float | pers2
| ) |  |

inlinestatic

Sets Matrix to:

    | scaleX  skewX transX |
    |  skewY scaleY transY |
    |  pers0  pers1  pers2 |

参数

  scaleX | horizontal scale factor
  skewX | horizontal skew factor
  transX | horizontal translation
  skewY | vertical skew factor
  scaleY | vertical scale factor
  transY | vertical translation
  pers0 | input x-axis perspective factor
  pers1 | input y-axis perspective factor
  pers2 | perspective scale factor

返回
  Matrix constructed from parameters

## MakeRectToRect()

static Matrix MNN::CV::Matrix::MakeRectToRect | ( | const Rect & | src,
|  | const Rect & | dst,
|  | ScaleToFit | stf
| ) |  |

inlinestatic

Returns Matrix set to scale and translate src Rect to dst Rect. stf selects whether mapping completely fills dst or preserves the aspect ratio, and how to align src within dst. Returns the identity Matrix if src is empty. If dst is empty, returns Matrix set to:

    | 0 0 0 |
    | 0 0 0 |
    | 0 0 1 |

参数

  src | Rect to map from
  dst | Rect to map to
  stf | one of: kFill_ScaleToFit, kStart_ScaleToFit, kCenter_ScaleToFit, kEnd_ScaleToFit

返回
  Matrix mapping src to dst

## MakeScale() [1/2]

static Matrix MNN::CV::Matrix::MakeScale | ( | float | sx,
|  | float | sy
| ) |  |

inlinestatic

Sets Matrix to scale by (sx, sy). Returned matrix is:

    | sx  0  0 |
    |  0 sy  0 |
    |  0  0  1 |

参数

  sx | horizontal scale factor
  sy | vertical scale factor

返回
  Matrix with scale

## MakeScale() [2/2]

static Matrix MNN::CV::Matrix::MakeScale | ( | float | scale | ) |

inlinestatic

Sets Matrix to scale by (scale, scale). Returned matrix is:

    | scale   0   0 |
    |   0   scale 0 |
    |   0     0   1 |

参数

  scale | horizontal and vertical scale factor

返回
  Matrix with scale

## MakeTrans()

static Matrix MNN::CV::Matrix::MakeTrans | ( | float | dx,
|  | float | dy
| ) |  |

inlinestatic

Sets Matrix to translate by (dx, dy). Returned matrix is:

    | 1 0 dx |
    | 0 1 dy |
    | 0 0  1 |

参数

  dx | horizontal translation
  dy | vertical translation

返回
  Matrix with translation

## mapPoints() [1/2]

void MNN::CV::Matrix::mapPoints | ( | Point | dst[],
|  | const Point | src[],
|  | int | count
| ) |  | const

inline

Maps src Point array of length count to dst Point array of equal or greater length. Point are mapped by multiplying each Point by Matrix. Given:

             | A B C |        | x |
    Matrix = | D E F |,  pt = | y |
             | G H I |        | 1 |

where

    for (i = 0; i < count; ++i) {
        x = src[i].fX
        y = src[i].fY
    }

each dst Point is computed as:

                  |A B C| |x|                               Ax+By+C   Dx+Ey+F
    Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
                  |G H I| |1|                               Gx+Hy+I   Gx+Hy+I

src and dst may point to the same storage.

参数

  dst | storage for mapped Point
  src | Point to transform
  count | number of Point to transform

## mapPoints() [2/2]

void MNN::CV::Matrix::mapPoints | ( | Point | pts[],
|  | int | count
| ) |  | const

inline

Maps pts Point array of length count in place. Point are mapped by multiplying each Point by Matrix. Given:

             | A B C |        | x |
    Matrix = | D E F |,  pt = | y |
             | G H I |        | 1 |

where

    for (i = 0; i < count; ++i) {
        x = pts[i].fX
        y = pts[i].fY
    }

each resulting pts Point is computed as:

                  |A B C| |x|                               Ax+By+C   Dx+Ey+F
    Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
                  |G H I| |1|                               Gx+Hy+I   Gx+Hy+I

参数

  pts | storage for mapped Point
  count | number of Point to transform

## mapRect() [1/3]

bool MNN::CV::Matrix::mapRect | ( | Rect * | dst,
|  | const Rect & | src
| ) |  | const

Sets dst to bounds of src corners mapped by Matrix. Returns true if mapped corners are dst corners.

Returned value is the same as calling rectStaysRect().

参数

  dst | storage for bounds of mapped Point
  src | Rect to map

返回
  true if dst is equivalent to mapped src

## mapRect() [2/3]

bool MNN::CV::Matrix::mapRect | ( | Rect * | rect | ) | const

inline

Sets rect to bounds of rect corners mapped by Matrix. Returns true if mapped corners are computed rect corners.

Returned value is the same as calling rectStaysRect().

参数

  rect | rectangle to map, and storage for bounds of mapped corners

返回
  true if result is equivalent to mapped src

## mapRect() [3/3]

Rect MNN::CV::Matrix::mapRect | ( | const Rect & | src | ) | const

inline

Returns bounds of src corners mapped by Matrix.

参数

  src | rectangle to map

返回
  mapped bounds

## mapRectScaleTranslate()

void MNN::CV::Matrix::mapRectScaleTranslate | ( | Rect * | dst,
|  | const Rect & | src
| ) |  | const

Sets dst to bounds of src corners mapped by Matrix. If matrix contains elements other than scale or translate: asserts if SK_DEBUG is defined; otherwise, results are undefined.

参数

  dst | storage for bounds of mapped Point
  src | Rect to map

## mapXY() [1/2]

void MNN::CV::Matrix::mapXY | ( | float | x,
|  | float | y,
|  | Point * | result
| ) |  | const

inline

Maps Point (x, y) to result. Point is mapped by multiplying by Matrix. Given:

             | A B C |        | x |
    Matrix = | D E F |,  pt = | y |
             | G H I |        | 1 |

result is computed as:

                  |A B C| |x|                               Ax+By+C   Dx+Ey+F
    Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
                  |G H I| |1|                               Gx+Hy+I   Gx+Hy+I

参数

  x | x-axis value of Point to map
  y | y-axis value of Point to map
  result | storage for mapped Point

## mapXY() [2/2]

Point MNN::CV::Matrix::mapXY | ( | float | x,
|  | float | y
| ) |  | const

inline

Returns Point (x, y) multiplied by Matrix. Given:

             | A B C |        | x |
    Matrix = | D E F |,  pt = | y |
             | G H I |        | 1 |

result is computed as:

                  |A B C| |x|                               Ax+By+C   Dx+Ey+F
    Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , -------
                  |G H I| |1|                               Gx+Hy+I   Gx+Hy+I

参数

  x | x-axis value of Point to map
  y | y-axis value of Point to map

返回
  mapped Point

## operator[]() [1/2]

float MNN::CV::Matrix::operator[] | ( | int | index | ) | const

inline

Returns one matrix value. Asserts if index is out of range and SK_DEBUG is defined.

参数

  index | one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2

返回
  value corresponding to index

## operator[]() [2/2]

float& MNN::CV::Matrix::operator[] | ( | int | index | ) |

inline

Returns writable Matrix value. Asserts if index is out of range and SK_DEBUG is defined. Clears internal cache anticipating that caller will change Matrix value.

Next call to read Matrix state may recompute cache; subsequent writes to Matrix value must be followed by dirtyMatrixTypeCache().

参数

  index | one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2

返回
  writable value corresponding to index

## postConcat()

void MNN::CV::Matrix::postConcat | ( | const Matrix & | other | ) |

Sets Matrix to Matrix other multiplied by Matrix. This can be thought of mapping by other after applying Matrix.

Given:

             | J K L |           | A B C |
    Matrix = | M N O |,  other = | D E F |
             | P Q R |           | G H I |

sets Matrix to:

                     | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
    other * Matrix = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
                     | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |

参数

  other | Matrix on left side of multiply expression

## postIDiv()

bool MNN::CV::Matrix::postIDiv | ( | int | divx,
|  | int | divy
| ) |  |

Sets Matrix to Matrix constructed from scaling by (1/divx, 1/divy) about pivot point (px, py), multiplied by Matrix.

Returns false if either divx or divy is zero.

Given:

             | J K L |                   | sx  0  0 |
    Matrix = | M N O |,  I(divx, divy) = |  0 sy  0 |
             | P Q R |                   |  0  0  1 |

where

    sx = 1 / divx
    sy = 1 / divy

sets Matrix to:

                             | sx  0  0 | | J K L |   | sx*J sx*K sx*L |
    I(divx, divy) * Matrix = |  0 sy  0 | | M N O | = | sy*M sy*N sy*O |
                             |  0  0  1 | | P Q R |   |    P    Q    R |

参数

  divx | integer divisor for inverse scale in x
  divy | integer divisor for inverse scale in y

返回
  true on successful scale

## postRotate() [1/2]

void MNN::CV::Matrix::postRotate | ( | float | degrees,
|  | float | px,
|  | float | py
| ) |  |

Sets Matrix to Matrix constructed from rotating by degrees about pivot point (px, py), multiplied by Matrix. This can be thought of as rotating about a pivot point after applying Matrix.

Positive degrees rotates clockwise.

Given:

             | J K L |                        | c -s dx |
    Matrix = | M N O |,  R(degrees, px, py) = | s  c dy |
             | P Q R |                        | 0  0  1 |

where

    c  = cos(degrees)
    s  = sin(degrees)
    dx =  s * py + (1 - c) * px
    dy = -s * px + (1 - c) * py

sets Matrix to:

                                  |c -s dx| |J K L|   |cJ-sM+dx*P cK-sN+dx*Q cL-sO+dx+R|
    R(degrees, px, py) * Matrix = |s  c dy| |M N O| = |sJ+cM+dy*P sK+cN+dy*Q sL+cO+dy*R|
                                  |0  0  1| |P Q R|   |         P          Q          R|

参数

  degrees | angle of axes relative to upright axes
  px | pivot x
  py | pivot y

## postRotate() [2/2]

void MNN::CV::Matrix::postRotate | ( | float | degrees | ) |

Sets Matrix to Matrix constructed from rotating by degrees about pivot point (0, 0), multiplied by Matrix. This can be thought of as rotating about the origin after applying Matrix.

Positive degrees rotates clockwise.

Given:

             | J K L |                        | c -s 0 |
    Matrix = | M N O |,  R(degrees, px, py) = | s  c 0 |
             | P Q R |                        | 0  0 1 |

where

    c  = cos(degrees)
    s  = sin(degrees)

sets Matrix to:

                                  | c -s dx | | J K L |   | cJ-sM cK-sN cL-sO |
    R(degrees, px, py) * Matrix = | s  c dy | | M N O | = | sJ+cM sK+cN sL+cO |
                                  | 0  0  1 | | P Q R |   |     P     Q     R |

参数

  degrees | angle of axes relative to upright axes

## postScale() [1/2]

void MNN::CV::Matrix::postScale | ( | float | sx,
|  | float | sy,
|  | float | px,
|  | float | py
| ) |  |

Sets Matrix to Matrix constructed from scaling by (sx, sy) about pivot point (px, py), multiplied by Matrix. This can be thought of as scaling about a pivot point after applying Matrix.

Given:

             | J K L |                       | sx  0 dx |
    Matrix = | M N O |,  S(sx, sy, px, py) = |  0 sy dy |
             | P Q R |                       |  0  0  1 |

where

    dx = px - sx * px
    dy = py - sy * py

sets Matrix to:

                                 | sx  0 dx | | J K L |   | sx*J+dx*P sx*K+dx*Q sx*L+dx+R |
    S(sx, sy, px, py) * Matrix = |  0 sy dy | | M N O | = | sy*M+dy*P sy*N+dy*Q sy*O+dy*R |
                                 |  0  0  1 | | P Q R |   |         P         Q         R |

参数

  sx | horizontal scale factor
  sy | vertical scale factor
  px | pivot x
  py | pivot y

## postScale() [2/2]

void MNN::CV::Matrix::postScale | ( | float | sx,
|  | float | sy
| ) |  |

Sets Matrix to Matrix constructed from scaling by (sx, sy) about pivot point (0, 0), multiplied by Matrix. This can be thought of as scaling about the origin after applying Matrix.

Given:

             | J K L |               | sx  0  0 |
    Matrix = | M N O |,  S(sx, sy) = |  0 sy  0 |
             | P Q R |               |  0  0  1 |

sets Matrix to:

                         | sx  0  0 | | J K L |   | sx*J sx*K sx*L |
    S(sx, sy) * Matrix = |  0 sy  0 | | M N O | = | sy*M sy*N sy*O |
                         |  0  0  1 | | P Q R |   |    P    Q    R |

参数

  sx | horizontal scale factor
  sy | vertical scale factor

## postSkew() [1/2]

void MNN::CV::Matrix::postSkew | ( | float | kx,
|  | float | ky,
|  | float | px,
|  | float | py
| ) |  |

Sets Matrix to Matrix constructed from skewing by (kx, ky) about pivot point (px, py), multiplied by Matrix. This can be thought of as skewing about a pivot point after applying Matrix.

Given:

             | J K L |                       |  1 kx dx |
    Matrix = | M N O |,  K(kx, ky, px, py) = | ky  1 dy |
             | P Q R |                       |  0  0  1 |

where

    dx = -kx * py
    dy = -ky * px

sets Matrix to:

                                 | 1 kx dx| |J K L|   |J+kx*M+dx*P K+kx*N+dx*Q L+kx*O+dx+R|
    K(kx, ky, px, py) * Matrix = |ky  1 dy| |M N O| = |ky*J+M+dy*P ky*K+N+dy*Q ky*L+O+dy*R|
                                 | 0  0  1| |P Q R|   |          P           Q           R|

参数

  kx | horizontal skew factor
  ky | vertical skew factor
  px | pivot x
  py | pivot y

## postSkew() [2/2]

void MNN::CV::Matrix::postSkew | ( | float | kx,
|  | float | ky
| ) |  |

Sets Matrix to Matrix constructed from skewing by (kx, ky) about pivot point (0, 0), multiplied by Matrix. This can be thought of as skewing about the origin after applying Matrix.

Given:

             | J K L |               |  1 kx 0 |
    Matrix = | M N O |,  K(kx, ky) = | ky  1 0 |
             | P Q R |               |  0  0 1 |

sets Matrix to:

                         |  1 kx 0 | | J K L |   | J+kx*M K+kx*N L+kx*O |
    K(kx, ky) * Matrix = | ky  1 0 | | M N O | = | ky*J+M ky*K+N ky*L+O |
                         |  0  0 1 | | P Q R |   |      P      Q      R |

参数

  kx | horizontal skew factor
  ky | vertical skew factor

## postTranslate()

void MNN::CV::Matrix::postTranslate | ( | float | dx,
|  | float | dy
| ) |  |

Sets Matrix to Matrix constructed from translation (dx, dy) multiplied by Matrix. This can be thought of as moving the point to be mapped after applying Matrix.

Given:

             | J K L |               | 1 0 dx |
    Matrix = | M N O |,  T(dx, dy) = | 0 1 dy |
             | P Q R |               | 0 0  1 |

sets Matrix to:

                         | 1 0 dx | | J K L |   | J+dx*P K+dx*Q L+dx*R |
    T(dx, dy) * Matrix = | 0 1 dy | | M N O | = | M+dy*P N+dy*Q O+dy*R |
                         | 0 0  1 | | P Q R |   |      P      Q      R |

参数

  dx | x-axis translation after applying Matrix
  dy | y-axis translation after applying Matrix

## preConcat()

void MNN::CV::Matrix::preConcat | ( | const Matrix & | other | ) |

Sets Matrix to Matrix multiplied by Matrix other. This can be thought of mapping by other before applying Matrix.

Given:

             | A B C |          | J K L |
    Matrix = | D E F |, other = | M N O |
             | G H I |          | P Q R |

sets Matrix to:

                     | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
    Matrix * other = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
                     | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |

参数

  other | Matrix on right side of multiply expression

## preRotate() [1/2]

void MNN::CV::Matrix::preRotate | ( | float | degrees,
|  | float | px,
|  | float | py
| ) |  |

Sets Matrix to Matrix multiplied by Matrix constructed from rotating by degrees about pivot point (px, py). This can be thought of as rotating about a pivot point before applying Matrix.

Positive degrees rotates clockwise.

Given:

             | A B C |                        | c -s dx |
    Matrix = | D E F |,  R(degrees, px, py) = | s  c dy |
             | G H I |                        | 0  0  1 |

where

    c  = cos(degrees)
    s  = sin(degrees)
    dx =  s * py + (1 - c) * px
    dy = -s * px + (1 - c) * py

sets Matrix to:

                                  | A B C | | c -s dx |   | Ac+Bs -As+Bc A*dx+B*dy+C |
    Matrix * R(degrees, px, py) = | D E F | | s  c dy | = | Dc+Es -Ds+Ec D*dx+E*dy+F |
                                  | G H I | | 0  0  1 |   | Gc+Hs -Gs+Hc G*dx+H*dy+I |

参数

  degrees | angle of axes relative to upright axes
  px | pivot x
  py | pivot y

## preRotate() [2/2]

void MNN::CV::Matrix::preRotate | ( | float | degrees | ) |

Sets Matrix to Matrix multiplied by Matrix constructed from rotating by degrees about pivot point (0, 0). This can be thought of as rotating about the origin before applying Matrix.

Positive degrees rotates clockwise.

Given:

             | A B C |                        | c -s 0 |
    Matrix = | D E F |,  R(degrees, px, py) = | s  c 0 |
             | G H I |                        | 0  0 1 |

where

    c  = cos(degrees)
    s  = sin(degrees)

sets Matrix to:

                                  | A B C | | c -s 0 |   | Ac+Bs -As+Bc C |
    Matrix * R(degrees, px, py) = | D E F | | s  c 0 | = | Dc+Es -Ds+Ec F |
                                  | G H I | | 0  0 1 |   | Gc+Hs -Gs+Hc I |

参数

  degrees | angle of axes relative to upright axes

## preScale() [1/2]

void MNN::CV::Matrix::preScale | ( | float | sx,
|  | float | sy,
|  | float | px,
|  | float | py
| ) |  |

Sets Matrix to Matrix multiplied by Matrix constructed from scaling by (sx, sy) about pivot point (px, py). This can be thought of as scaling about a pivot point before applying Matrix.

Given:

             | A B C |                       | sx  0 dx |
    Matrix = | D E F |,  S(sx, sy, px, py) = |  0 sy dy |
             | G H I |                       |  0  0  1 |

where

    dx = px - sx * px
    dy = py - sy * py

sets Matrix to:

                                 | A B C | | sx  0 dx |   | A*sx B*sy A*dx+B*dy+C |
    Matrix * S(sx, sy, px, py) = | D E F | |  0 sy dy | = | D*sx E*sy D*dx+E*dy+F |
                                 | G H I | |  0  0  1 |   | G*sx H*sy G*dx+H*dy+I |

参数

  sx | horizontal scale factor
  sy | vertical scale factor
  px | pivot x
  py | pivot y

## preScale() [2/2]

void MNN::CV::Matrix::preScale | ( | float | sx,
|  | float | sy
| ) |  |

Sets Matrix to Matrix multiplied by Matrix constructed from scaling by (sx, sy) about pivot point (0, 0). This can be thought of as scaling about the origin before applying Matrix.

Given:

             | A B C |               | sx  0  0 |
    Matrix = | D E F |,  S(sx, sy) = |  0 sy  0 |
             | G H I |               |  0  0  1 |

sets Matrix to:

                         | A B C | | sx  0  0 |   | A*sx B*sy C |
    Matrix * S(sx, sy) = | D E F | |  0 sy  0 | = | D*sx E*sy F |
                         | G H I | |  0  0  1 |   | G*sx H*sy I |

参数

  sx | horizontal scale factor
  sy | vertical scale factor

## preservesAxisAlignment()

bool MNN::CV::Matrix::preservesAxisAlignment | ( |  | ) | const

inline

Returns true Matrix maps Rect to another Rect. If true, Matrix is identity, or scales, or rotates a multiple of 90 degrees, or mirrors on axes. In all cases, Matrix may also have translation. Matrix form is either:

    | scale-x    0    translate-x |
    |    0    scale-y translate-y |
    |    0       0         1      |

or

    |    0     rotate-x translate-x |
    | rotate-y    0     translate-y |
    |    0        0          1      |

for non-zero values of scale-x, scale-y, rotate-x, and rotate-y.

Also called rectStaysRect(); use the one that provides better inline documentation.

返回
  true if Matrix maps one Rect into another

## preSkew() [1/2]

void MNN::CV::Matrix::preSkew | ( | float | kx,
|  | float | ky,
|  | float | px,
|  | float | py
| ) |  |

Sets Matrix to Matrix multiplied by Matrix constructed from skewing by (kx, ky) about pivot point (px, py). This can be thought of as skewing about a pivot point before applying Matrix.

Given:

             | A B C |                       |  1 kx dx |
    Matrix = | D E F |,  K(kx, ky, px, py) = | ky  1 dy |
             | G H I |                       |  0  0  1 |

where

    dx = -kx * py
    dy = -ky * px

sets Matrix to:

                                 | A B C | |  1 kx dx |   | A+B*ky A*kx+B A*dx+B*dy+C |
    Matrix * K(kx, ky, px, py) = | D E F | | ky  1 dy | = | D+E*ky D*kx+E D*dx+E*dy+F |
                                 | G H I | |  0  0  1 |   | G+H*ky G*kx+H G*dx+H*dy+I |

参数

  kx | horizontal skew factor
  ky | vertical skew factor
  px | pivot x
  py | pivot y

## preSkew() [2/2]

void MNN::CV::Matrix::preSkew | ( | float | kx,
|  | float | ky
| ) |  |

Sets Matrix to Matrix multiplied by Matrix constructed from skewing by (kx, ky) about pivot point (0, 0). This can be thought of as skewing about the origin before applying Matrix.

Given:

             | A B C |               |  1 kx 0 |
    Matrix = | D E F |,  K(kx, ky) = | ky  1 0 |
             | G H I |               |  0  0 1 |

sets Matrix to:

                         | A B C | |  1 kx 0 |   | A+B*ky A*kx+B C |
    Matrix * K(kx, ky) = | D E F | | ky  1 0 | = | D+E*ky D*kx+E F |
                         | G H I | |  0  0 1 |   | G+H*ky G*kx+H I |

参数

  kx | horizontal skew factor
  ky | vertical skew factor

## preTranslate()

void MNN::CV::Matrix::preTranslate | ( | float | dx,
|  | float | dy
| ) |  |

Sets Matrix to Matrix multiplied by Matrix constructed from translation (dx, dy). This can be thought of as moving the point to be mapped before applying Matrix.

Given:

             | A B C |               | 1 0 dx |
    Matrix = | D E F |,  T(dx, dy) = | 0 1 dy |
             | G H I |               | 0 0  1 |

sets Matrix to:

                         | A B C | | 1 0 dx |   | A B A*dx+B*dy+C |
    Matrix * T(dx, dy) = | D E F | | 0 1 dy | = | D E D*dx+E*dy+F |
                         | G H I | | 0 0  1 |   | G H G*dx+H*dy+I |

参数

  dx | x-axis translation before applying Matrix
  dy | y-axis translation before applying Matrix

## rectStaysRect()

bool MNN::CV::Matrix::rectStaysRect | ( |  | ) | const

inline

Returns true Matrix maps Rect to another Rect. If true, Matrix is identity, or scales, or rotates a multiple of 90 degrees, or mirrors on axes. In all cases, Matrix may also have translation. Matrix form is either:

    | scale-x    0    translate-x |
    |    0    scale-y translate-y |
    |    0       0         1      |

or

    |    0     rotate-x translate-x |
    | rotate-y    0     translate-y |
    |    0        0          1      |

for non-zero values of scale-x, scale-y, rotate-x, and rotate-y.

Also called preservesAxisAlignment(); use the one that provides better inline documentation.

返回
  true if Matrix maps one Rect into another

## reset()

void MNN::CV::Matrix::reset | ( |  | ) |

Sets Matrix to identity; which has no effect on mapped Point. Sets Matrix to:

    | 1 0 0 |
    | 0 1 0 |
    | 0 0 1 |

Also called setIdentity(); use the one that provides better inline documentation.

## set()

void MNN::CV::Matrix::set | ( | int | index,
|  | float | value
| ) |  |

inline

Sets Matrix value. Asserts if index is out of range and SK_DEBUG is defined. Safer than operator[]; internal cache is always maintained.

参数

  index | one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2
  value | scalar to store in Matrix

## set9()

void MNN::CV::Matrix::set9 | ( | const float | buffer[9] | ) |

Sets Matrix to nine scalar values in buffer, in member value ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, kMPersp2.

Sets matrix to:

    | buffer[0] buffer[1] buffer[2] |
    | buffer[3] buffer[4] buffer[5] |
    | buffer[6] buffer[7] buffer[8] |

In the future, set9 followed by get9 may not return the same values. Since Matrix maps non-homogeneous coordinates, scaling all nine values produces an equivalent transformation, possibly improving precision.

参数

  buffer | nine scalar values

## setAffine()

void MNN::CV::Matrix::setAffine | ( | const float | affine[6] | ) |

Sets Matrix to affine values, passed in column major order. Given affine, column, then row, as:

    | scale-x  skew-x translate-x |
    |  skew-y scale-y translate-y |

Matrix is set, row, then column, to:

    | scale-x  skew-x translate-x |
    |  skew-y scale-y translate-y |
    |       0       0           1 |

参数

  affine | 3x2 affine matrix

## SetAffineIdentity()

static void MNN::CV::Matrix::SetAffineIdentity | ( | float | affine[6] | ) |

static

Fills affine with identity values in column major order. Sets affine to:

    | 1 0 0 |
    | 0 1 0 |

Affine 3x2 matrices in column major order are used by OpenGL and XPS.

参数

  affine | storage for 3x2 affine matrix

## setAll()

void MNN::CV::Matrix::setAll | ( | float | scaleX,
|  | float | skewX,
|  | float | transX,
|  | float | skewY,
|  | float | scaleY,
|  | float | transY,
|  | float | persp0,
|  | float | persp1,
|  | float | persp2
| ) |  |

inline

Sets all values from parameters. Sets matrix to:

    | scaleX  skewX transX |
    |  skewY scaleY transY |
    | persp0 persp1 persp2 |

参数

  scaleX | horizontal scale factor to store
  skewX | horizontal skew factor to store
  transX | horizontal translation to store
  skewY | vertical skew factor to store
  scaleY | vertical scale factor to store
  transY | vertical translation to store
  persp0 | input x-axis values perspective factor to store
  persp1 | input y-axis values perspective factor to store
  persp2 | perspective scale factor to store

## setConcat()

void MNN::CV::Matrix::setConcat | ( | const Matrix & | a,
|  | const Matrix & | b
| ) |  |

Sets Matrix to Matrix a multiplied by Matrix b. Either a or b may be this.

Given:

        | A B C |      | J K L |
    a = | D E F |, b = | M N O |
        | G H I |      | P Q R |

sets Matrix to:

            | A B C |   | J K L |   | AJ+BM+CP AK+BN+CQ AL+BO+CR |
    a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR |
            | G H I |   | P Q R |   | GJ+HM+IP GK+HN+IQ GL+HO+IR |

参数

  a | Matrix on left side of multiply expression
  b | Matrix on right side of multiply expression

## setIdentity()

void MNN::CV::Matrix::setIdentity | ( |  | ) |

inline

Sets Matrix to identity; which has no effect on mapped Point. Sets Matrix to:

    | 1 0 0 |
    | 0 1 0 |
    | 0 0 1 |

Also called reset(); use the one that provides better inline documentation.

## setPerspX()

void MNN::CV::Matrix::setPerspX | ( | float | v | ) |

inline

Sets input x-axis perspective factor, which causes mapXY() to vary input x-axis values inversely proportional to input y-axis values.

参数

  v | perspective factor

## setPerspY()

void MNN::CV::Matrix::setPerspY | ( | float | v | ) |

inline

Sets input y-axis perspective factor, which causes mapXY() to vary input y-axis values inversely proportional to input x-axis values.

参数

  v | perspective factor

## setPolyToPoly()

bool MNN::CV::Matrix::setPolyToPoly | ( | const Point | src[],
|  | const Point | dst[],
|  | int | count
| ) |  |

Sets Matrix to map src to dst. count must be zero or greater, and four or less.

If count is zero, sets Matrix to identity and returns true. If count is one, sets Matrix to translate and returns true. If count is two or more, sets Matrix to map Point if possible; returns false if Matrix cannot be constructed. If count is four, Matrix may include perspective.

参数

  src | Point to map from
  dst | Point to map to
  count | number of Point in src and dst

返回
  true if Matrix was constructed successfully

## setRectToRect()

bool MNN::CV::Matrix::setRectToRect | ( | const Rect & | src,
|  | const Rect & | dst,
|  | ScaleToFit | stf
| ) |  |

Sets Matrix to scale and translate src Rect to dst Rect. stf selects whether mapping completely fills dst or preserves the aspect ratio, and how to align src within dst. Returns false if src is empty, and sets Matrix to identity. Returns true if dst is empty, and sets Matrix to:

    | 0 0 0 |
    | 0 0 0 |
    | 0 0 1 |

参数

  src | Rect to map from
  dst | Rect to map to
  stf | one of: kFill_ScaleToFit, kStart_ScaleToFit, kCenter_ScaleToFit, kEnd_ScaleToFit

返回
  true if Matrix can represent Rect mapping

## setRotate() [1/2]

void MNN::CV::Matrix::setRotate | ( | float | degrees,
|  | float | px,
|  | float | py
| ) |  |

Sets Matrix to rotate by degrees about a pivot point at (px, py). The pivot point is unchanged when mapped with Matrix.

Positive degrees rotates clockwise.

参数

  degrees | angle of axes relative to upright axes
  px | pivot x
  py | pivot y

## setRotate() [2/2]

void MNN::CV::Matrix::setRotate | ( | float | degrees | ) |

Sets Matrix to rotate by degrees about a pivot point at (0, 0). Positive degrees rotates clockwise.

参数

  degrees | angle of axes relative to upright axes

## setScale() [1/2]

void MNN::CV::Matrix::setScale | ( | float | sx,
|  | float | sy,
|  | float | px,
|  | float | py
| ) |  |

Sets Matrix to scale by sx and sy, about a pivot point at (px, py). The pivot point is unchanged when mapped with Matrix.

参数

  sx | horizontal scale factor
  sy | vertical scale factor
  px | pivot x
  py | pivot y

## setScale() [2/2]

void MNN::CV::Matrix::setScale | ( | float | sx,
|  | float | sy
| ) |  |

Sets Matrix to scale by sx and sy about at pivot point at (0, 0).

参数

  sx | horizontal scale factor
  sy | vertical scale factor

## setScaleTranslate()

void MNN::CV::Matrix::setScaleTranslate | ( | float | sx,
|  | float | sy,
|  | float | tx,
|  | float | ty
| ) |  |

inline

Initializes Matrix with scale and translate elements.

    | sx  0 tx |
    |  0 sy ty |
    |  0  0  1 |

参数

  sx | horizontal scale factor to store
  sy | vertical scale factor to store
  tx | horizontal translation to store
  ty | vertical translation to store

## setScaleX()

void MNN::CV::Matrix::setScaleX | ( | float | v | ) |

inline

Sets horizontal scale factor.

参数

  v | horizontal scale factor to store

## setScaleY()

void MNN::CV::Matrix::setScaleY | ( | float | v | ) |

inline

Sets vertical scale factor.

参数

  v | vertical scale factor to store

## setSinCos() [1/2]

void MNN::CV::Matrix::setSinCos | ( | float | sinValue,
|  | float | cosValue,
|  | float | px,
|  | float | py
| ) |  |

Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (px, py). The pivot point is unchanged when mapped with Matrix.

Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). Vector length specifies scale.

参数

  sinValue | rotation vector x-axis component
  cosValue | rotation vector y-axis component
  px | pivot x-axis
  py | pivot y-axis

## setSinCos() [2/2]

void MNN::CV::Matrix::setSinCos | ( | float | sinValue,
|  | float | cosValue
| ) |  |

Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (0, 0).

Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). Vector length specifies scale.

参数

  sinValue | rotation vector x-axis component
  cosValue | rotation vector y-axis component

## setSkew() [1/2]

void MNN::CV::Matrix::setSkew | ( | float | kx,
|  | float | ky,
|  | float | px,
|  | float | py
| ) |  |

Sets Matrix to skew by kx and ky, about a pivot point at (px, py). The pivot point is unchanged when mapped with Matrix.

参数

  kx | horizontal skew factor
  ky | vertical skew factor
  px | pivot x
  py | pivot y

## setSkew() [2/2]

void MNN::CV::Matrix::setSkew | ( | float | kx,
|  | float | ky
| ) |  |

Sets Matrix to skew by kx and ky, about a pivot point at (0, 0).

参数

  kx | horizontal skew factor
  ky | vertical skew factor

## setSkewX()

void MNN::CV::Matrix::setSkewX | ( | float | v | ) |

inline

Sets horizontal skew factor.

参数

  v | horizontal skew factor to store

## setSkewY()

void MNN::CV::Matrix::setSkewY | ( | float | v | ) |

inline

Sets vertical skew factor.

参数

  v | vertical skew factor to store

## setTranslate()

void MNN::CV::Matrix::setTranslate | ( | float | dx,
|  | float | dy
| ) |  |

Sets Matrix to translate by (dx, dy).

参数

  dx | horizontal translation
  dy | vertical translation

## setTranslateX()

void MNN::CV::Matrix::setTranslateX | ( | float | v | ) |

inline

Sets horizontal translation.

参数

  v | horizontal translation to store

## setTranslateY()

void MNN::CV::Matrix::setTranslateY | ( | float | v | ) |

inline

Sets vertical translation.

参数

  v | vertical translation to store

## 友元及相关函数文档

## operator!=

MNN_PUBLIC bool operator!= | ( | const Matrix & | a,
|  | const Matrix & | b
| ) |  |

friend

Compares a and b; returns true if a and b are not numerically equal. Returns false even if sign of zero values are different. Returns true if either Matrix contains NaN, even if the other Matrix also contains NaN.

参数

  a | Matrix to compare
  b | Matrix to compare

返回
  true if Matrix a and Matrix b are numerically not equal

## operator==

MNN_PUBLIC bool operator== | ( | const Matrix & | a,
|  | const Matrix & | b
| ) |  |

friend

Compares a and b; returns true if a and b are numerically equal. Returns true even if sign of zero values are different. Returns false if either Matrix contains NaN, even if the other Matrix also contains NaN.

参数

  a | Matrix to compare
  b | Matrix to compare

返回
  true if Matrix a and Matrix b are numerically equal

## 类成员变量说明

## kAScaleX

constexpr int MNN::CV::Matrix::kAScaleX = 0

static

horizontal scale factor

Affine arrays are in column major order to match the matrix used by PDF and XPS.

## kAScaleY

constexpr int MNN::CV::Matrix::kAScaleY = 3

static

vertical scale factor

## kASkewX

constexpr int MNN::CV::Matrix::kASkewX = 2

static

horizontal skew factor

## kASkewY

constexpr int MNN::CV::Matrix::kASkewY = 1

static

vertical skew factor

## kATransX

constexpr int MNN::CV::Matrix::kATransX = 4

static

horizontal translation

## kATransY

constexpr int MNN::CV::Matrix::kATransY = 5

static

vertical translation

## kMPersp0

constexpr int MNN::CV::Matrix::kMPersp0 = 6

static

input x perspective factor

## kMPersp1

constexpr int MNN::CV::Matrix::kMPersp1 = 7

static

input y perspective factor

## kMPersp2

constexpr int MNN::CV::Matrix::kMPersp2 = 8

static

perspective bias

## kMScaleX

constexpr int MNN::CV::Matrix::kMScaleX = 0

static

horizontal scale factor

Matrix organizes its values in row order. These members correspond to each value in Matrix.

## kMScaleY

constexpr int MNN::CV::Matrix::kMScaleY = 4

static

vertical scale factor

## kMSkewX

constexpr int MNN::CV::Matrix::kMSkewX = 1

static

horizontal skew factor

## kMSkewY

constexpr int MNN::CV::Matrix::kMSkewY = 3

static

vertical skew factor

## kMTransX

constexpr int MNN::CV::Matrix::kMTransX = 2

static

horizontal translation

## kMTransY

constexpr int MNN::CV::Matrix::kMTransY = 5

static

vertical translation

该类的文档由以下文件生成:

- include/Matrix.h