How to use rotation matrix and translation vector to correct position an assimp model?


I want to use ofxAssimpModelLoader to draw a 3d object and get something similar to this:

Image from

I’m calculating rotation and translation matrix using opencv function like this:

CvMatr32f rotation = new float[9];
CvMatr32f translation = new float[3];
CvPOSITObject* posit = cvCreatePOSITObject(&pModelAnchor[0], pModelAnchor.size());
CvTermCriteria criteria = cvTermCriteria(CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 50, 1.0e-4f);
cvPOSIT(posit, &pImgAnchor[0], FOCAL_LENGTH, criteria, rotation, translation);

How can I use rotation and translation matrix to correct place the assimp model on screen and get an effect similar to the picture above?

Thank you

Tried this:

    ofxAssimpModelLoader assimpModel;

void ofApp::draw(){


               Mat translation = ... result from solve pnp
               Mat rTemp = ... result from solve pnp
               Mat rotation, rMat;
               Rodrigues(rTemp, rMat);
               rotation = rMat.t();
               float* r = rotation.ptr<float>();
               float* t = translation.ptr<float>();
               ofMatrix4x4 transf(
                        r[0], r[1], r[2], 0.0,
                        r[3], r[4], r[5], 0.0,
                        r[6], r[7], r[8], 0.0,
                         0.0,  0.0,  0.0, 1.0);
               ofTranslate(t[0], t[1], t[2]);

But it is not working. The wires are distorted and in wrong position. No idea what i am missing here. Help please.