Rotate an image from centre though accelerometer

I am working with an image displayed on an android tablet I’m wanting to use the accelerometer in order to rotate the image and move the image based on the accelerometer data. I’ve been looking at the accelerometer example in openframeworks android I’ve been able to get an image move but I am yet to be able to rotate the image based on the movements of the tablet.

ofPushMatrix();
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);
im.setAnchorPoint(normAccel.x*ofGetWidth()/2, normAccel.y*ofGetHeight()/2);
im.draw(-300,-300);
ofPopMatrix();

This is the code I have at the moment to draw the image based on the accelerometer.

Think I need to use getOrientation() but not sure on it’s usage.

Any help would be greatly appreciated.