目前我使用的是Visual Studio 2010,PCL 1.8.0 / 1.6.0, 现在根据我的要求,我必须向云添加和绑定框并可视化为给定云创建的边界框天气,因为可视化我们需要PCLVisualizer,当我尝试初始化PCLVisualizer时得到以下链接器错误并且,当我使用最新版本的PCL时,我虽然可能有任何错误,但我已经降级到旧版本1.6.0并尝试但面临相同的错误,任何人都可以建议我在哪里出错了
以下是我正在使用的代码。
int BoundingBox(pcl::PointCloud<pcl::PointXYZ>::Ptr point_cloud_ptr)
{
// compute principal direction
Eigen::Vector4f centroid;
pcl::compute3DCentroid(*point_cloud_ptr, centroid);
Eigen::Matrix3f covariance;
computeCovarianceMatrixNormalized(*point_cloud_ptr, centroid, covariance);
Eigen::SelfAdjointEigenSolver<Eigen::Matrix3f> eigen_solver(covariance, Eigen::ComputeEigenvectors);
Eigen::Matrix3f eigDx = eigen_solver.eigenvectors();
eigDx.col(2) = eigDx.col(0).cross(eigDx.col(1));
// move the points to the that reference frame
Eigen::Matrix4f p2w(Eigen::Matrix4f::Identity());
p2w.block<3,3>(0,0) = eigDx.transpose();
p2w.block<3,1>(0,3) = -1.f * (p2w.block<3,3>(0,0) * centroid.head<3>());
pcl::PointCloud<pcl::PointXYZ> cPoints;
pcl::transformPointCloud(*point_cloud_ptr, cPoints, p2w);
pcl::PointXYZ min_pt, max_pt;
pcl::getMinMax3D(cPoints, min_pt, max_pt);
const Eigen::Vector3f mean_diag = 0.5f*(max_pt.getVector3fMap() + min_pt.getVector3fMap());
// final transform
const Eigen::Quaternionf qfinal(eigDx);
const Eigen::Vector3f tfinal = eigDx*mean_diag + centroid.head<3>();
// draw the cloud and the box
pcl::visualization::PCLVisualizer viewer;
viewer.addPointCloud(point_cloud_ptr);
viewer.addCube(tfinal, qfinal, max_pt.x - min_pt.x, max_pt.y - min_pt.y, max_pt.z - min_pt.z);
viewer.spin();
return(0);
}
我得到的错误如下所示。
错误LNK2001:未解析的外部符号“public:void __cdecl vtkProp3D :: SetUserMatrix(类vtkMatrix4x4 *)“ (?SetUserMatrix @ @@ vtkProp3D @@@ QEAAXPEAVvtkMatrix4x4 Z)
错误LNK2019:未解析的外部符号“public:void __cdecl vtkProp3D :: SetUserMatrix(类vtkMatrix4x4 *)“ (?SetUserMatrix @ vtkProp3D @@ QEAAXPEAVvtkMatrix4x4 @@@ Z)在 函数“private:bool __cdecl PCL ::可视化:: PCLVisualizer :: fromHandlersToScreen(类 PCL ::可视化:: PointCloudGeometryHandler const&amp;,class pcl :: visualization :: PointCloudColorHandler const&amp;,class std :: basic_string,class std :: allocator&gt; const&amp;,int,class Eigen :: Matrix const&amp;,class Eigen :: Quaternion const&amp;)“ (?? $ @ fromHandlersToScreen @ UPointXYZ PCL @@@ PCLVisualizer @可视化@ PCL @@ AEAA_NAEBV?$ @ PointCloudGeometryHandler @ UPointXYZ PCL @@@ 12 @ AEBV?$ @ PointCloudColorHandler @ UPointXYZ PCL @@@ 12 @ AEBV?$ @的basic_string杜?$ @ char_traits @ d @@性病V'$ @分配器@ d @@ 2性病@@ HAEBV?$基质@ M $ 03 $ $ 00 0A @ $ 03 $ 00 @艾根@@ AEBV?$ @四元数M $ 0A @@ 8 @@ Z)