Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "camera_pose_calibration_impl.hpp"
00018 #include <gtest/gtest.h>
00019
00020 int main(int argc, char **argv) {
00021 ::testing::InitGoogleTest(&argc, argv);
00022 return RUN_ALL_TESTS();
00023 }
00024
00025 namespace camera_pose_calibration {
00026
00028 TEST(CameraPoseCalibration, findIsometry_identity) {
00029
00030 pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
00031 cloud->push_back(pcl::PointXYZ(0,0,0));
00032 cloud->push_back(pcl::PointXYZ(0,1,0));
00033 cloud->push_back(pcl::PointXYZ(0,0,1));
00034
00035
00036 Eigen::Isometry3d expected = Eigen::Isometry3d::Identity();
00037 Eigen::Isometry3d actual = findIsometry(cloud, cloud);
00038
00039 for (int row=0; row<actual.matrix().rows(); row++) {
00040 for (int col=0; col<actual.matrix().cols(); col++) {
00041 EXPECT_NEAR(expected(row,col), actual(row,col), 6E-8);
00042 }
00043 }
00044 }
00045
00047 TEST(CameraPoseCalibration, findIsometry_translation) {
00048
00049 pcl::PointCloud<pcl::PointXYZ>::Ptr source(new pcl::PointCloud<pcl::PointXYZ>);
00050 source->push_back(pcl::PointXYZ(0,0,0));
00051 source->push_back(pcl::PointXYZ(1,0,0));
00052 source->push_back(pcl::PointXYZ(0,1,0));
00053 source->push_back(pcl::PointXYZ(0,0,1));
00054
00055
00056 pcl::PointCloud<pcl::PointXYZ>::Ptr target(new pcl::PointCloud<pcl::PointXYZ>);
00057 target->push_back(pcl::PointXYZ(0,0,2));
00058 target->push_back(pcl::PointXYZ(1,0,2));
00059 target->push_back(pcl::PointXYZ(0,1,2));
00060 target->push_back(pcl::PointXYZ(0,0,3));
00061
00062
00063 Eigen::Isometry3d expected = Eigen::Isometry3d::Identity() * Eigen::Translation3d(0,0,2);
00064
00065
00066 Eigen::Isometry3d actual = findIsometry(source, target);
00067
00068 for (int row=0; row<actual.matrix().rows(); row++) {
00069 for (int col=0; col<actual.matrix().cols(); col++) {
00070 EXPECT_NEAR(expected(row,col), actual(row,col), 6E-8);
00071 }
00072 }
00073 }
00074
00075 }