17 void Camera::distort(
const std::vector<cv::Point2f> &src, std::vector<cv::Point2f> &des) {
31 des.resize(src.size());
32 double x,
y, x1, y1, r2, r4, r6, a1, a2, a3, cdist;
33 for(
unsigned int i = 0; i < src.size(); i++) {
35 x = (src[i].x - srcCx) / srcFx;
36 y = (src[i].y - srcCy) / srcFy;
43 cdist = 1+k1*r2+k2*r4+k3*r6;
44 x1 = (x*cdist + p1*a1 + p2*a2);
45 y1 = (y*cdist + p1*a3 + p2*a1);
47 des[i].x = x1 * desFx + desCx;
48 des[i].y = y1 * desFy + desCy;
54 std::vector<cv::Point2f> vtx(5);
57 std::vector<cv::Point2f> vtxDistort;
59 des.size = cv::Size2f((cv::norm(vtx[2] - vtx[1])+cv::norm(vtx[0] - vtx[3]))/2., (cv::norm(vtx[1] - vtx[0])+cv::norm(vtx[3] - vtx[2]))/2.);
60 des.angle = atan2(vtx[2].
y - vtx[1].
y, vtx[2].
x - vtx[1].
x) * 180.0/M_PI;
61 des.center = vtxDistort[4];
cv::Mat_< double > distCoeffs
void distort(const std::vector< cv::Point2f > &src, std::vector< cv::Point2f > &des)
cv::Mat_< double > projectionMatrix
TFSIMD_FORCE_INLINE const tfScalar & y() const
cv::Mat_< double > cameraMatrix
TFSIMD_FORCE_INLINE const tfScalar & x() const