RSS
 

Convert Polar image into Cartesian

26 Nov

This a simple implementation of Polar to Cartesian transformation applied to the image case. It is useful to unroll an omni image to convert it to panoramic image.

imgPol = cvCreateImage(cvSize(2*CV_PI*RadiusMax,RadiusMax-RadiusMin),IPL_DEPTH_8U,1);
cvSet(imgPol,CV_WHITE,NULL);
int x0,y0;
double Radius;
double Angle;
for(int x=1; x < imgPol->width; x++)
{
	for(int y=1; y < imgPol->height; y++)
	{
		Radius = RadiusMin + y;
		Angle = 2 * CV_PI * x / imgPol->width;
		x0 = cvRound(CenterX + Radius * cos(Angle));
		y0 = cvRound(CenterY + Radius * sin(Angle));

		cvSet2D(imgPol, y, x, cvGet2D(imgBase,y0,x0));
	}
}

cvSaveImage("imgPol.bmp",imgPol);
 
3 Comments

Posted in OpenCV

 

Leave a Reply

 

 
  1. PSD to Joomla

    March 21, 2010 at 1:22 pm

    This is my subsequent visit to your weblog. We’re starting off a brand new initiative within the identical niche as this website. Your blog supplied us with important info to work with. You have done a extraordinary job.

     
  2. kbqrandon

    October 2, 2010 at 10:02 am

    Hey blogger,search your blog from google,great blog,keep writting.promzzz

     
  3. roclafamilia

    October 21, 2010 at 4:01 pm

    Helpful blog, bookmarked the website with hopes to read more!