error C4996: 'pcl::SAC_SAMPLE_SIZE': This map is deprecated and is kept only to prevent breaking existing user code. Starting from PCL 1.8.0 model sample size is a protected member of the SampleConsensusModel class c:\program files (x86)\pcl 1.8.0\include\pcl-1.8\pcl\sample_consensus\model_types.h 100 1 ConsoleApplication3
如题
出现这个错误在头文件前面加上
#pragma warning(disable:4996)
这个原因可能是项目版本不兼容或者头文件编译的不兼容导致的
我的是vs15+pcl1.8x64程序放在vs13+pcl1.832位下调试出现的错误
代码如下
#pragma warning(disable:4996) #include #include #include #include #include int main() { pcl::PointCloud pcl::PointCloud // Fill in the cloud data cloud->width = 5; cloud->height = 1; cloud->points.resize(cloud->width * cloud->height); 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); } std::cerr << "Cloud before projection: " << std::endl; for (size_t i = 0; i < cloud->points.size(); ++i) std::cerr << " " << cloud->points[i].x << " " << cloud->points[i].y << " " << cloud->points[i].z << std::endl; // // // Create a set of planar coefficients with X=Y=0,Z=1 pcl::ModelCoefficients::Ptr coefficients(new pcl::ModelCoefficients()); coefficients->values.resize(4); coefficients->values[0] = coefficients->values[1] = 0; coefficients->values[2] = 1.0; coefficients->values[3] = 0; // // // Create the filtering object pcl::ProjectInliers proj.setModelType(pcl::SACMODEL_PLANE); proj.setInputCloud(cloud); proj.setModelCoefficients(coefficients); proj.filter(*cloud_projected); std::cerr << "Cloud after projection: " << std::endl; for (size_t i = 0; i < cloud_projected->points.size(); ++i) std::cerr << " " << cloud_projected->points[i].x << " " << cloud_projected->points[i].y << " " << cloud_projected->points[i].z << std::endl; system("pause"); return 0; } |
|
Cloud before projection:
1.28125 577.094 197.938
828.125 599.031 491.375
358.688 917.438 842.563
764.5 178.281 879.531
727.531 525.844 311.281
Cloud after projection:
1.28125 577.094 0
828.125 599.031 0
358.688 917.438 0
764.5 178.281 0
727.531 525.844 0