Rotate image around x and Y axis

Hi,

I am trying to rotate an Image around X and Y-axis with a given angle. The methods available in ofImage are to rotate around z axis. How can I achieve this? Are there any openCV methods to do this?

Thanks,
Paras.

  
  
#include "testApp.h"  
  
float angle;  
  
//--------------------------------------------------------------  
void testApp::setup(){  
  
	ofBackground(0);  
	angle = 0;  
	  
}  
  
//--------------------------------------------------------------  
void testApp::update(){  
  
  
}  
  
//--------------------------------------------------------------  
void testApp::draw(){  
  
  
	angle += ofNoise(ofGetFrameNum());  
	  
	ofSetColor(255, 0, 0);  
	ofPushMatrix();  
	ofTranslate(ofGetWidth()/4, ofGetHeight()/2);  
	ofRotateX(angle);  
	ofRect(0, 0, 100, 100);  
	ofPopMatrix();  
	  
	  
	ofSetColor(0, 255, 0);  
	ofPushMatrix();  
	ofTranslate(ofGetWidth()/4*2, ofGetHeight()/2);  
	ofRotateY(angle);  
	ofRect(0, 0, 100, 100);  
	ofPopMatrix();  
	  
	  
	ofSetColor(0, 0, 255);  
	ofPushMatrix();  
	ofTranslate(ofGetWidth()/4*3, ofGetHeight()/2);  
	ofRotateZ(angle);  
	ofRect(0, 0, 100, 100);  
	ofPopMatrix();  
	  
	  
}  
  

Hi,

Thanks for the reply. But the above solution will be helpful in displaying the rotated images. It is more like openGL
rotate and translate functions. I think my question wasn’t very clear, mea culpa;

I actually have a 2D matrix as an array of depth values for an RGB image. I want to translate and rotate this matrix such that it fits the RGB image as there is offset between the two, as they are taken from two different cameras. (I know this problem is similar to kinect cam calibration, but I am not using kinect and I have some problems using cvSterocalibrate, so I am doing this manually).

Further, I have converted this 2D matrix in to image for visualisation purpose. I want to translate(easy part done) and rotate along x,y axis and then fit this to RGB image (with some data loss). I want to rotate this 2D matrix and store the rotation in same data structure. I am still struggling on this part.

Thanks again for the reply, any help appreciated.

Cheers,
~Paras.