本文整理汇总了C++中TicToc类的典型用法代码示例。如果您正苦于以下问题:C++ TicToc类的具体用法?C++ TicToc怎么用?C++ TicToc使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TicToc类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: loadCloud
bool
loadCloud (const std::string & filename, PointCloudXYZRGBA & cloud)
{
TicToc tt;
print_highlight ("Loading "); print_value ("%s ", filename.c_str ());
tt.tic ();
if (loadPCDFile (filename, cloud) < 0)
return (false);
printElapsedTimeAndNumberOfPoints (tt.toc (), cloud.width, cloud.height);
print_info ("Available dimensions: "); print_value ("%s\n", pcl::getFieldsList (cloud).c_str ());
return (true);
}
开发者ID:diegodgs,项目名称:PCL,代码行数:16,代码来源:match_linemod_template.cpp
示例2: compute
void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, sensor_msgs::PointCloud2 &output,
std::string method,
int min_pts, double radius,
int mean_k, double std_dev_mul, bool negative)
{
PointCloud<PointXYZ>::Ptr xyz_cloud_pre (new pcl::PointCloud<PointXYZ> ()),
xyz_cloud (new pcl::PointCloud<PointXYZ> ());
fromROSMsg (*input, *xyz_cloud_pre);
std::vector<int> index_vector;
removeNaNFromPointCloud<PointXYZ> (*xyz_cloud_pre, *xyz_cloud, index_vector);
TicToc tt;
tt.tic ();
PointCloud<PointXYZ>::Ptr xyz_cloud_filtered (new PointCloud<PointXYZ> ());
if (method == "statistical")
{
StatisticalOutlierRemoval<PointXYZ> filter;
filter.setInputCloud (xyz_cloud);
filter.setMeanK (mean_k);
filter.setStddevMulThresh (std_dev_mul);
filter.setNegative (negative);
PCL_INFO ("Computing filtered cloud with mean_k %d, std_dev_mul %f, inliers %d\n", filter.getMeanK (), filter.getStddevMulThresh (), filter.getNegative ());
filter.filter (*xyz_cloud_filtered);
}
else if (method == "radius")
{
RadiusOutlierRemoval<PointXYZ> filter;
filter.setInputCloud (xyz_cloud);
filter.setRadiusSearch (radius);
filter.setMinNeighborsInRadius (min_pts);
PCL_INFO ("Computing filtered cloud with radius %f, min_pts %d\n", radius, min_pts);
filter.filter (*xyz_cloud_filtered);
}
else
{
PCL_ERROR ("%s is not a valid filter name! Quitting!\n", method.c_str ());
return;
}
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", xyz_cloud_filtered->width * xyz_cloud_filtered->height); print_info (" points]\n");
toROSMsg (*xyz_cloud_filtered, output);
}
开发者ID:MorS25,项目名称:pcl-fuerte,代码行数:47,代码来源:outlier_removal.cpp
示例3: saveCloud
void
saveCloud (const std::string &filename, const pcl::PCLPointCloud2 &output)
{
TicToc tt;
tt.tic ();
print_highlight ("Saving ");
print_value ("%s ", filename.c_str ());
pcl::io::savePCDFile (filename, output);
print_info ("[done, ");
print_value ("%g", tt.toc ());
print_info (" ms : ");
print_value ("%d", output.width * output.height);
print_info (" points]\n");
}
开发者ID:Razlaw,项目名称:pcl,代码行数:17,代码来源:extract_feature.cpp
示例4: loadCloud
bool
loadCloud (const string &filename, pcl::PCLPointCloud2 &cloud)
{
TicToc tt;
print_highlight ("Loading "); print_value ("%s ", filename.c_str ());
tt.tic ();
if (pcl::io::load (filename, cloud)) {
print_error ("Cannot found input file name (%s).\n", filename.c_str ());
return (false);
}
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : ");
print_value ("%d", cloud.width * cloud.height); print_info (" points]\n");
print_info ("Available dimensions: "); print_value ("%s\n", getFieldsList (cloud).c_str ());
return (true);
}
开发者ID:BITVoyager,项目名称:pcl,代码行数:17,代码来源:uniform_sampling.cpp
示例5: loadPCLZF
bool
loadPCLZF (const std::string &filename_depth,
const std::string &filename_params,
pcl::PointCloud<pcl::PointXYZ> &cloud)
{
TicToc tt;
print_highlight ("Loading "); print_value ("%s ", filename_depth.c_str ());
tt.tic ();
pcl::io::LZFDepth16ImageReader depth;
depth.readParameters (filename_params);
depth.read (filename_depth, cloud);
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", cloud.width * cloud.height); print_info (" points]\n");
print_info ("Available dimensions: "); print_value ("%s\n", pcl::getFieldsList (cloud).c_str ());
return (true);
}
开发者ID:2php,项目名称:pcl,代码行数:18,代码来源:pclzf2pcd.cpp
示例6: compute
void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, sensor_msgs::PointCloud2 &output,
float leaf_x, float leaf_y, float leaf_z, const std::string &field, double fmin, double fmax)
{
TicToc tt;
tt.tic ();
print_highlight ("Computing ");
VoxelGrid<sensor_msgs::PointCloud2> grid;
grid.setInputCloud (input);
grid.setFilterFieldName (field);
grid.setFilterLimits (fmin, fmax);
grid.setLeafSize (leaf_x, leaf_y, leaf_z);
grid.filter (output);
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output.width * output.height); print_info (" points]\n");
}
开发者ID:rbart,项目名称:guide-dog,代码行数:18,代码来源:voxel_grid.cpp
示例7: project
void
project (const sensor_msgs::PointCloud2::ConstPtr &input, sensor_msgs::PointCloud2 &output, float a, float b, float c, float d)
{
Eigen::Vector4f coeffs;
coeffs << a, b, c, d;
// Convert data to PointCloud<T>
PointCloud<PointXYZ>::Ptr xyz (new PointCloud<PointXYZ>);
fromROSMsg (*input, *xyz);
// Estimate
TicToc tt;
tt.tic ();
//First, we'll find a point on the plane
print_highlight (stderr, "Projecting ");
PointCloud<PointXYZ>::Ptr projected_cloud_pcl (new PointCloud<PointXYZ>);
projected_cloud_pcl->width = xyz->width;
projected_cloud_pcl->height = xyz->height;
projected_cloud_pcl->is_dense = xyz->is_dense;
projected_cloud_pcl->sensor_origin_ = xyz->sensor_origin_;
projected_cloud_pcl->sensor_orientation_ = xyz->sensor_orientation_;
for(size_t i = 0; i < xyz->points.size(); ++i)
{
pcl::PointXYZ projection;
pcl::projectPoint<PointXYZ> (xyz->points[i], coeffs, projection);
projected_cloud_pcl->points.push_back(projection);
}
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : ");
pcl::io::savePCDFile ("foo.pcd", *projected_cloud_pcl);
// Convert data back
sensor_msgs::PointCloud2 projected_cloud;
toROSMsg (*projected_cloud_pcl, projected_cloud);
//we can actually use concatenate fields to inject our projection into the
//output, the second argument overwrites the first's fields for those that
//are shared
concatenateFields (*input, projected_cloud, output);
}
开发者ID:rbart,项目名称:guide-dog,代码行数:44,代码来源:plane_projection.cpp
示例8: compute
void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, sensor_msgs::PointCloud2 &output,
std::string field_name, float min, float max, bool inside)
{
// Estimate
TicToc tt;
tt.tic ();
print_highlight (stderr, "Computing ");
PassThrough<sensor_msgs::PointCloud2> passthrough_filter;
passthrough_filter.setInputCloud (input);
passthrough_filter.setFilterFieldName (field_name);
passthrough_filter.setFilterLimits (min, max);
passthrough_filter.setFilterLimitsNegative (!inside);
passthrough_filter.filter (output);
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output.width * output.height); print_info (" points]\n");
}
开发者ID:MorS25,项目名称:pcl-fuerte,代码行数:19,代码来源:passthrough_filter.cpp
示例9: saveCloud
void
saveCloud (const std::string &filename, const std::vector<sensor_msgs::PointCloud2::Ptr> &output)
{
TicToc tt;
tt.tic ();
std::string basename = filename.substr (0, filename.length () - 4);
for (size_t i = 0; i < output.size (); i++)
{
std::string clustername = basename + boost::lexical_cast<std::string>(i) + ".pcd";
print_highlight ("Saving "); print_value ("%s ", clustername.c_str ());
pcl::io::savePCDFile (clustername, *(output[i]), translation, orientation, false);
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output[i]->width * output[i]->height); print_info (" points]\n");
}
}
开发者ID:diegodgs,项目名称:PCL,代码行数:19,代码来源:cluster_extraction.cpp
示例10: saveCloud
void
saveCloud (const std::string &filename, const pcl::PCLPointCloud2 &output)
{
TicToc tt;
tt.tic ();
print_highlight ("Saving ");
print_value ("%s ", filename.c_str ());
PCDWriter w;
//w.writeBinaryCompressed (filename, output, translation, orientation);
w.writeASCII (filename, output, translation, orientation);
print_info ("[done, ");
print_value ("%g", tt.toc ());
print_info (" ms : ");
print_value ("%d", output.width * output.height);
print_info (" points]\n");
}
开发者ID:Razlaw,项目名称:pcl,代码行数:19,代码来源:iterative_closest_point.cpp
示例11: loadCloud
bool
loadCloud (const std::string &filename, sensor_msgs::PointCloud2 &cloud)
{
TicToc tt;
print_highlight ("Loading "); print_value ("%s ", filename.c_str ());
tt.tic ();
if (loadPCDFile (filename, cloud, translation, orientation) < 0)
return (false);
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", cloud.width * cloud.height); print_info (" points]\n");
print_info ("Available dimensions: "); print_value ("%s\n", getFieldsList (cloud).c_str ());
// Check if the dataset has normals
if (getFieldIndex (cloud, "normal_x") == -1)
{
print_error ("The input dataset does not contain normal information!\n");
return (false);
}
return (true);
}
开发者ID:rbart,项目名称:guide-dog,代码行数:20,代码来源:fpfh_estimation.cpp
示例12: loadCloud
bool
loadCloud (const std::string &filename, pcl::PCLPointCloud2 &cloud)
{
TicToc tt;
print_highlight ("Loading ");
print_value ("%s ", filename.c_str ());
tt.tic ();
if (loadPCDFile (filename, cloud, translation, orientation) < 0)
return (false);
print_info ("[done, ");
print_value ("%g", tt.toc ());
print_info (" ms : ");
print_value ("%d", cloud.width * cloud.height);
print_info (" points]\n");
print_info ("Available dimensions: ");
print_value ("%s\n", getFieldsList (cloud).c_str ());
return (true);
}
开发者ID:Razlaw,项目名称:pcl,代码行数:20,代码来源:iterative_closest_point.cpp
示例13: transform
void
transform (const sensor_msgs::PointCloud2::ConstPtr &input, sensor_msgs::PointCloud2 &output)
{
// Check for 'normals'
bool has_normals = false;
for (size_t i = 0; i < input->fields.size (); ++i)
if (input->fields[i].name == "normals")
has_normals = true;
// Estimate
TicToc tt;
tt.tic ();
print_highlight (stderr, "Transforming ");
// Convert data to PointCloud<T>
if (has_normals)
{
PointCloud<PointNormal> xyznormals;
fromROSMsg (*input, xyznormals);
pcl::transformPointCloud<PointNormal> (xyznormals, xyznormals, translation.head<3> (), orientation);
// Copy back the xyz and normals
sensor_msgs::PointCloud2 output_xyznormals;
toROSMsg (xyznormals, output_xyznormals);
concatenateFields (*input, output_xyznormals, output);
}
else
{
PointCloud<PointXYZ> xyz;
fromROSMsg (*input, xyz);
pcl::transformPointCloud<PointXYZ> (xyz, xyz, translation.head<3> (), orientation);
// Copy back the xyz and normals
sensor_msgs::PointCloud2 output_xyz;
toROSMsg (xyz, output_xyz);
concatenateFields (*input, output_xyz, output);
}
translation = Eigen::Vector4f::Zero ();
orientation = Eigen::Quaternionf::Identity ();
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", output.width * output.height); print_info (" points]\n");
}
开发者ID:Bardo91,项目名称:pcl,代码行数:41,代码来源:transform_from_viewpoint.cpp
示例14: main
int main(int argc, char * argv[])
{
double portion = 0.9;
uint64 memory_size = getMemorySize() * portion;
uint64 page_size = sysconf(_SC_PAGESIZE);
uint64 page_nums = memory_size/page_size;
// Need to Configure Parse
bool debug = true;
if(debug)
{
printf("*--------------------------*\nMemory Information... \n*--------------------------*\n");
printf("Memory Size (bytes): %lu | ",memory_size);
printf("Page Size (bytes): %lu | ",page_size);
printf("Number of Pages: %lu \n",page_nums);
printf("Note: We allocte %f of the memory \n",portion*100);
}
// Allocate memory
Byte * memory = (Byte * ) malloc(memory_size);
double iterations = 10;
double total_mem_time = 0;
double total_alligned_page = 0;
double total_unalligned_page =0;
for(double j =0 ; j < iterations; j++)
{
TicToc timer;
timer.tic();
memset(memory,0,memory_size);
total_mem_time+= (timer.toc()/1000000);
timer.tic();
for(uint64 i =0 ; i < page_nums; i++ )
{
memset(memory + i* page_size,i,page_size);
}
total_alligned_page+= (timer.toc()/page_size);
timer.tic();
for(uint64 i =0 ; i < page_nums - 1 ; i++ )
{
memset(memory + i * page_size + 2,i,page_size);
}
total_unalligned_page+=(timer.toc()/(page_size - 1));
}
printf("*--------------------------*\nBenchmarking Starting... \n*--------------------------*\n");
printf("Memory Access Time: %f (secs)\n",total_mem_time/iterations);
printf("Alligned Page Access Time: %f (usec)\n",total_alligned_page/iterations);
printf("Unalligned Page Access Time: %f (usec)\n",total_unalligned_page/iterations);
// Free allocated memory
free(memory);
}
开发者ID:ahmedatya,项目名称:Benchmark,代码行数:56,代码来源:bus_bench.cpp
示例15: compute
void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, std::vector<sensor_msgs::PointCloud2::Ptr> &output,
int min, int max, double tolerance)
{
// Convert data to PointCloud<T>
PointCloud<pcl::PointXYZ>::Ptr xyz (new PointCloud<pcl::PointXYZ>);
fromROSMsg (*input, *xyz);
// Estimate
TicToc tt;
tt.tic ();
print_highlight (stderr, "Computing ");
// Creating the KdTree object for the search method of the extraction
pcl::search::KdTree<pcl::PointXYZ>::Ptr tree (new pcl::search::KdTree<pcl::PointXYZ>);
tree->setInputCloud (xyz);
std::vector<pcl::PointIndices> cluster_indices;
pcl::EuclideanClusterExtraction<pcl::PointXYZ> ec;
ec.setClusterTolerance (tolerance);
ec.setMinClusterSize (min);
ec.setMaxClusterSize (max);
ec.setSearchMethod (tree);
ec.setInputCloud (xyz);
ec.extract (cluster_indices);
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", cluster_indices.size ()); print_info (" clusters]\n");
output.reserve (cluster_indices.size ());
for (std::vector<pcl::PointIndices>::const_iterator it = cluster_indices.begin (); it != cluster_indices.end (); ++it)
{
pcl::ExtractIndices<sensor_msgs::PointCloud2> extract;
extract.setInputCloud (input);
extract.setIndices (boost::make_shared<const pcl::PointIndices> (*it));
sensor_msgs::PointCloud2::Ptr out (new sensor_msgs::PointCloud2);
extract.filter (*out);
output.push_back (out);
}
}
开发者ID:diegodgs,项目名称:PCL,代码行数:40,代码来源:cluster_extraction.cpp
示例16: compute
void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, sensor_msgs::PointCloud2 &output,
int k, double radius)
{
// Convert data to PointCloud<T>
PointCloud<PointXYZ>::Ptr xyz (new PointCloud<PointXYZ>);
fromROSMsg (*input, *xyz);
TicToc tt;
tt.tic ();
PointCloud<Normal> normals;
// Try our luck with organized integral image based normal estimation
if (xyz->isOrganized ())
{
IntegralImageNormalEstimation<PointXYZ, Normal> ne;
ne.setInputCloud (xyz);
ne.setNormalEstimationMethod (IntegralImageNormalEstimation<PointXYZ, Normal>::COVARIANCE_MATRIX);
ne.setNormalSmoothingSize (float (radius));
ne.setDepthDependentSmoothing (true);
ne.compute (normals);
}
else
{
NormalEstimation<PointXYZ, Normal> ne;
ne.setInputCloud (xyz);
ne.setSearchMethod (search::KdTree<PointXYZ>::Ptr (new search::KdTree<PointXYZ>));
ne.setKSearch (k);
ne.setRadiusSearch (radius);
ne.compute (normals);
}
print_highlight ("Computed normals in "); print_value ("%g", tt.toc ()); print_info (" ms for "); print_value ("%d", normals.width * normals.height); print_info (" points.\n");
// Convert data back
sensor_msgs::PointCloud2 output_normals;
toROSMsg (normals, output_normals);
concatenateFields (*input, output_normals, output);
}
开发者ID:KoenBuys,项目名称:pcl,代码行数:40,代码来源:normal_estimation.cpp
示例17: compute
void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, PolygonMesh &output,
int depth, int solver_divide, int iso_divide)
{
PointCloud<PointNormal>::Ptr xyz_cloud (new pcl::PointCloud<PointNormal> ());
fromROSMsg (*input, *xyz_cloud);
Poisson<PointNormal> poisson;
poisson.setDepth (depth);
poisson.setSolverDivide (solver_divide);
poisson.setIsoDivide (iso_divide);
poisson.setInputCloud (xyz_cloud);
TicToc tt;
tt.tic ();
print_highlight ("Computing ");
poisson.reconstruct (output);
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms]\n");
}
开发者ID:hitsjt,项目名称:StanfordPCL,代码行数:22,代码来源:poisson_reconstruction.cpp
示例18: compute
void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, sensor_msgs::PointCloud2 &output,
float sigma_s, float sigma_r, bool early_division)
{
PointCloud<PointXYZRGBA>::Ptr cloud (new PointCloud<PointXYZRGBA> ());
fromROSMsg (*input, *cloud);
FastBilateralFilter<PointXYZRGBA> filter;
filter.setSigmaS (sigma_s);
filter.setSigmaR (sigma_r);
filter.setEarlyDivision (early_division);
filter.setInputCloud (cloud);
PointCloud<PointXYZRGBA>::Ptr out_cloud (new PointCloud<PointXYZRGBA> ());
TicToc tt;
tt.tic ();
filter.filter (*out_cloud);
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms : "); print_value ("%d", out_cloud->width * out_cloud->height); print_info (" points]\n");
toROSMsg (*out_cloud, output);
}
开发者ID:Bardo91,项目名称:pcl,代码行数:23,代码来源:fast_bilateral_filter.cpp
示例19: view
void
view (const CloudConstPtr &src, const CloudConstPtr &tgt, const CorrespondencesPtr &correspondences)
{
if (!visualize || !vis) return;
PointCloudColorHandlerCustom<PointT> green (tgt, 0, 255, 0);
if (!vis->updatePointCloud<PointT> (src, "source"))
{
vis->addPointCloud<PointT> (src, "source");
vis->resetCameraViewpoint ("source");
}
if (!vis->updatePointCloud<PointT> (tgt, green, "target")) vis->addPointCloud<PointT> (tgt, green, "target");
vis->setPointCloudRenderingProperties (PCL_VISUALIZER_OPACITY, 0.5, "source");
vis->setPointCloudRenderingProperties (PCL_VISUALIZER_OPACITY, 0.7, "target");
vis->setPointCloudRenderingProperties (PCL_VISUALIZER_POINT_SIZE, 6, "source");
TicToc tt;
tt.tic ();
if (!vis->updateCorrespondences<PointT> (src, tgt, *correspondences, 1))
vis->addCorrespondences<PointT> (src, tgt, *correspondences, 1, "correspondences");
tt.toc_print ();
vis->setShapeRenderingProperties (PCL_VISUALIZER_LINE_WIDTH, 5, "correspondences");
//vis->setShapeRenderingProperties (PCL_VISUALIZER_COLOR, 1.0, 0.0, 0.0, "correspondences");
vis->spin ();
}
开发者ID:Bardo91,项目名称:pcl,代码行数:23,代码来源:example1.cpp
示例20: compute
void
compute (const sensor_msgs::PointCloud2::ConstPtr &input, sensor_msgs::PointCloud2 &output,
double standard_deviation)
{
TicToc tt;
tt.tic ();
print_highlight ("Adding Gaussian noise with mean 0.0 and standard deviation %f\n", standard_deviation);
PointCloud<PointXYZ>::Ptr xyz_cloud (new pcl::PointCloud<PointXYZ> ());
fromROSMsg (*input, *xyz_cloud);
PointCloud<PointXYZ>::Ptr xyz_cloud_filtered (new PointCloud<PointXYZ> ());
xyz_cloud_filtered->points.resize (xyz_cloud->points.size ());
xyz_cloud_filtered->header = xyz_cloud->header;
xyz_cloud_filtered->width = xyz_cloud->width;
xyz_cloud_filtered->height = xyz_cloud->height;
boost::mt19937 rng; rng.seed (time (0));
boost::normal_distribution<> nd (0, standard_deviation);
boost::variate_generator<boost::mt19937&, boost::normal_distribution<> > var_nor (rng, nd);
for (size_t point_i = 0; point_i < xyz_cloud->points.size (); ++point_i)
{
xyz_cloud_filtered->points[point_i].x = xyz_cloud->points[point_i].x + var_nor ();
xyz_cloud_filtered->points[point_i].y = xyz_cloud->points[point_i].y + var_nor ();
xyz_cloud_filtered->points[point_i].z = xyz_cloud->points[point_i].z + var_nor ();
}
sensor_msgs::PointCloud2 input_xyz_filtered;
toROSMsg (*xyz_cloud_filtered, input_xyz_filtered);
concatenateFields (*input, input_xyz_filtered, output);
print_info ("[done, "); print_value ("%g", tt.toc ()); print_info (" ms: "); print_value ("%d", output.width * output.height); print_info (" points]\n");
}
开发者ID:nttputus,项目名称:PCL,代码行数:36,代码来源:add_gaussian_noise.cpp
注:本文中的TicToc类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论