# tf.contrib.image.flat_transforms_to_matrices

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/image/python/ops/image_ops.py#L334-L363) |

Converts [`tf.contrib.image`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/contrib/image) projective transforms to affine matrices.

    tf.contrib.image.flat_transforms_to_matrices(
        transforms
    )

Note that the output matrices map output coordinates to input coordinates. For
the forward transformation matrix, call [`tf.linalg.inv`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/linalg/inv) on the result.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `transforms` | Vector of length 8, or batches of transforms with shape `(N, 8)`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| 3D tensor of matrices with shape `(N, 3, 3)`. The output matrices map the *output coordinates* (in homogeneous coordinates) of each transform to the corresponding *input coordinates*. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If `transforms` have an invalid shape. |

<br />