00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00034 #ifndef _CAMERA_PARAMETERS_CPP_
00035 #define _CAMERA_PARAMETERS_CPP_
00036
00037 #include "camera_parameters.h"
00038
00047 int class_camera_parameters::set_intrinsic(double fx, double fy, double cx, double cy)
00048 {
00049 cv::Mat *M = &intrinsic;
00050 M->at<double>(0,0) = fx; M->at<double>(0,1) = 0; M->at<double>(0,2) = cx; M->at<double>(0,3) = 0;
00051 M->at<double>(1,0) = 0; M->at<double>(1,1) = fy; M->at<double>(1,2) = cy; M->at<double>(1,3) = 0;
00052 M->at<double>(2,0) = 0; M->at<double>(2,1) = 0; M->at<double>(2,2) = 1; M->at<double>(2,3) = 0;
00053
00054 return 1;};
00055
00059 int class_camera_parameters::set_extrinsic(tf::StampedTransform* t)
00060 {
00061 camera_6dof_position.setRotation(t->getRotation());
00062 camera_6dof_position.setOrigin(t->getOrigin());
00063 tf::Matrix3x3 rot(t->getRotation());
00064 set_extrinsic(rot[0][0], rot[0][1], rot[0][2], t->getOrigin().x(),
00065 rot[1][0], rot[1][1], rot[1][2], t->getOrigin().y(),
00066 rot[2][0], rot[2][1], rot[2][2], t->getOrigin().z());
00067 return 1;}
00068
00069 int class_camera_parameters::set_extrinsic(tf::Transform* t)
00070 {
00071 camera_6dof_position.setRotation(t->getRotation());
00072 camera_6dof_position.setOrigin(t->getOrigin());
00073 tf::Matrix3x3 rot(t->getRotation());
00074 set_extrinsic(rot[0][0], rot[0][1], rot[0][2], t->getOrigin().x(),
00075 rot[1][0], rot[1][1], rot[1][2], t->getOrigin().y(),
00076 rot[2][0], rot[2][1], rot[2][2], t->getOrigin().z());
00077 return 1;}
00078
00079
00085 int class_camera_parameters::set_extrinsic(double p11, double p12, double p13, double p14,
00086 double p21, double p22, double p23, double p24,
00087 double p31, double p32, double p33, double p34)
00088 {
00089 cv::Mat *M = &extrinsic;
00090 M->at<double>(0,0) = p11; M->at<double>(0,1) = p12; M->at<double>(0,2) = p13; M->at<double>(0,3) = p14;
00091 M->at<double>(1,0) = p21; M->at<double>(1,1) = p22; M->at<double>(1,2) = p23; M->at<double>(1,3) = p24;
00092 M->at<double>(2,0) = p31; M->at<double>(2,1) = p32; M->at<double>(2,2) = p33; M->at<double>(2,3) = p34;
00093 M->at<double>(3,0) = 0; M->at<double>(3,1) = 0; M->at<double>(3,2) = 0; M->at<double>(3,3) = 1;
00094
00095 extrinsic_inverse = extrinsic.inv();
00096 return 1;};
00097
00098
00099
00100 #endif
00101