utest.cpp
Go to the documentation of this file.
00001 /*
00002  * utest.cpp
00003  *
00004  *  Created on: May 5, 2012
00005  *      Author: vsu
00006  */
00007 
00008 /*
00009  * test.cpp
00010  *
00011  *  Created on: May 5, 2012
00012  *      Author: vsu
00013  */
00014 
00015 #include <pcl17/features/sgfall.h>
00016 #include <gtest/gtest.h>
00017 
00018 TEST(Feature1NumberOfBoundaryPoints, SquareTest)
00019 {
00020 
00021         int square_size = 5;
00022         pcl17::PointCloud<pcl17::PointXYZ>::Ptr cloud(
00023                         new pcl17::PointCloud<pcl17::PointXYZ>);
00024 
00025         for (int i = 0; i < square_size; i++) {
00026                 for (int j = 0; j < square_size; j++) {
00027                         pcl17::PointXYZ point;
00028                         point.x = i;
00029                         point.y = j;
00030                         point.z = 1.0f;
00031                         cloud->points.push_back(point);
00032                 }
00033         }
00034 
00035         cloud->width = cloud->points.size();
00036         cloud->height = 1;
00037         cloud->is_dense = true;
00038 
00039         boost::shared_ptr<std::vector<int> > indicesptr(new std::vector<int>());
00040 
00041         for (size_t i = 0; i < cloud->points.size(); i++) {
00042                 (*indicesptr).push_back(i);
00043         }
00044 
00045         pcl17::search::KdTree<pcl17::PointXYZ>::Ptr tree(new pcl17::search::KdTree<
00046                         pcl17::PointXYZ>());
00047         pcl17::PointCloud<pcl17::Histogram<pcl17::SGF1_SIZE> >::Ptr sgf1s(
00048                         new pcl17::PointCloud<pcl17::Histogram<pcl17::SGF1_SIZE> >());
00049         pcl17::SGF1Estimation<pcl17::PointXYZ, pcl17::Histogram<pcl17::SGF1_SIZE> > sgf1;
00050         sgf1.setInputCloud(cloud);
00051         sgf1.setIndices(indicesptr);
00052         sgf1.setSearchMethod(tree);
00053         sgf1.setKSearch(10);
00054         sgf1.compute(*sgf1s);
00055 
00056         EXPECT_FLOAT_EQ(16.0/25.0, sgf1s->points[0].histogram[0]);
00057 }
00058 
00059 int main(int argc, char **argv) {
00060         testing::InitGoogleTest(&argc, argv);
00061         return RUN_ALL_TESTS();
00062 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


furniture_features
Author(s): Stefan
autogenerated on Sun Oct 6 2013 11:58:55