其他分享
首页 > 其他分享> > “camera_“:不是“pcl::visualization::PCLVisualizer“的成员

“camera_“:不是“pcl::visualization::PCLVisualizer“的成员

作者:互联网

配置:VS2015+PCL1.8.1
问题:编译《点云库PCL从入门到精通》第五章可视化深度图像例程时编译器报错"camera_":不是"pcl::visualization::PCLVisualizer"的成员,报错代码如下:

  viewer.camera_.pos[0] = pos_vector[0];
  viewer.camera_.pos[1] = pos_vector[1];
  viewer.camera_.pos[2] = pos_vector[2];
  viewer.camera_.focal[0] = look_at_vector[0];
  viewer.camera_.focal[1] = look_at_vector[1];
  viewer.camera_.focal[2] = look_at_vector[2];
  viewer.camera_.view[0] = up_vector[0];
  viewer.camera_.view[1] = up_vector[1];
  viewer.camera_.view[2] = up_vector[2];
  viewer.updateCamera();

解决:PCL1.8的viewer已经没有camera_了,应使用函数setCameraPosition()替换。修改后的代码如下:

viewer.setCameraPosition(pos_vector[0], pos_vector[1], pos_vector[2], look_at_vector[0],   
    look_at_vector[1], look_at_vector[2], up_vector[0], up_vector[1], up_vector[2]);

标签:visualization,PCLVisualizer,look,viewer,camera,pos,_.,vector
来源: https://blog.csdn.net/sljslj111/article/details/120565893