# rospy convert matrix to transform

How would I convert a 4x4 numpy matrix to (translation, quaternion) using `tf`

(or some other package package) in python?

On the wiki for python tf, I found the method `fromTranslationRotation`

, which converts (translation, quaternion) to numpy matrix. What's the method that does the inverse operation?

The context (though I'm not sure this is relevant) is to connect two tf trees.

```
/camera_1
/ar_marker_1
/camera_2
/ar_marker_2
```

I can't easily measure the transform between `camera_1`

and `camera_2`

, so I've placed AR markers where I can easily measure the transform between them, and one camera can see each marker. I know the transform between `ar_marker_1`

and `ar_marker_2`

, but tf trees have to be connected by the root, so I've used matrices to compute the transform from `ar_marker_1`

to `camera_2`

, but now I can't figure out how to publish that transform because it's a matrix, not a (translation, quaternion).

Here's a related question in c++: http://answers.ros.org/question/10341...