E0135 class “pcl::visualization::PCLVisualizer“ 没有成员 “camera_“

太叔炎彬
2023-12-01

配置:VS2017+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]);

版权声明:本文为CSDN博主「the lament」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sljslj111/article/details/120565893

 类似资料: