运行此代码时遇到错误..
access violation in reading memory location
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>); //fill the cloud.
cloud-> width = 100;
cloud->height = 10;
cloud->is_dense = false;
cloud->points.resize(cloud->width*cloud->height); // generate the data
//double temp_x , temp_y , temp_z;
for (size_t i = 0; i!=cloud->points.size(); i++) {
cloud->points[i].x = 1024*rand()/(RAND_MAX + 1.0f);
cloud->points[i].y = 1024*rand()/(RAND_MAX + 1.0f);
cloud->points[i].z = 1024*rand()/(RAND_MAX + 1.0f);
}
pcl::visualization::PCLVisualizer viewer;
viewer.addPointCloud<pcl::PointXYZ>(cloud);
while(!viewer.wasStopped()){
viewer.spinOnce();
}
system("PAUSE");
return EXIT_SUCCESS;
答案 0 :(得分:0)
我认为“cloud-&gt; height = 10”意味着它是有组织的点云类型。 你应该尝试设置cloud-&gt; height = 1。 祝你好运!