📄 amerinterpra.cpp
字号:
// amerInterPra.cpp: implementation of the CamerInterPra class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "amerInterPra.h"
#include "math.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CamerInterPra::CamerInterPra()
{
}
CamerInterPra::~CamerInterPra()
{
}
/*******************利用获得的内参数对像坐标进行坐标改正***************************
UV------------原始的像坐标;
Num---------------点的个数;
ImageCoorAfterCorr-------改正后的像坐标;
************************************************************************************/
void CamerInterPra::ImageCoorAfterDistCorr(double *UV,int Num,double *ImageCoorAfterCorr)
{
int i;
double r;
for(i=0;i<Num;i++)
{
r=sqrt(pow(UV[2*i]-x0,2)+pow(UV[2*i+1]-y0,2));
//对像横坐标x改正
ImageCoorAfterCorr[2*i]=UV[0]-x0
+k1*pow(r,2)*(UV[2*i]-x0)
+k2*pow(r,4)*(UV[2*i]-x0)
+k3*pow(r,6)*(UV[2*i]-x0)
+p1*(pow(r,2)+2*pow(UV[2*i]-x0,2))
+2*p2*(UV[2*i]-x0)*(UV[2*i+1]-y0)
+b1*(UV[2*i]-x0)
+b2*(UV[2*i+1]-y0);
//对像纵坐标y改正
ImageCoorAfterCorr[2*i+1]=UV[2*i+1]-y0
+k1*pow(r,2)*(UV[2*i+1]-y0)
+k2*pow(r,4)*(UV[2*i+1]-y0)
+k3*pow(r,6)*(UV[2*i+1]-y0)
+p2*(pow(r,2)+2*pow(UV[2*i+1]-y0,2))
+2*p1*(UV[2*i]-x0)*(UV[2*i+1]-y0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -