tauseef_CuriousGuy tauseef_CuriousGuy - 2 years ago 112
C++ Question

viewing 3D point cloud by integrating custom C API with generic point cloud viewer

I have a ToF (Time of Flight) camera. Depth data from the camera can be obtained in XYZ format by use of certain C APIs, such as given below -

xCoordinate = ((int16_t *)xCoordinates)[x + y*xRes];
yCoordinate = ((int16_t *)yCoordinates)[x + y*xRes];
zCoordinate = ((int16_t *)zCoordinates)[x + y*xRes];


I can start a infinite while loop to keep getting the above co-ordinates from a scene in front of the camera.
However, for visualization purpose as a 3D point cloud, I want to use the APIs provided at http://pointclouds.org/documentation/tutorials/pcl_visualizer.php

My questions therefore are the following :


  1. I was able to install pcl successfully by using precompiled binaries as provided here - http://unanancyowen.com/en/pcl18/ . Specifically, I am using VS 2015 (32 bit of course). Hence I installed PCL-1.8.1rc2-AllInOne-msvc2017-win32 binary application. Using cmake I am able to obtain a .sln project sucessfully for the demo pcl application of cloudviewer (as given here - http://pointclouds.org/documentation/tutorials/cloud_viewer.php#cloud-viewer). However I get some linking errors on compiling the .sln project using VS 2017. The errors appears are :




cloud_viewer.obj : error LNK2019: unresolved external symbol "public: bool __thiscall
pcl::visualization::PCLVisualizer::removeShape(class
std::basic_string,class
std::allocator > const &,int)"
(?removeShape@PCLVisualizer@visualization@pcl@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) referenced in function "void __cdecl viewerPsycho(class
pcl::visualization::PCLVisualizer &)"

cloud_viewer.obj : error LNK2019: unresolved external symbol "public: void __thiscall
pcl::visualization::PCLVisualizer::setBackgroundColor(double const
&,double const &,double const &,int)"
(?setBackgroundColor@PCLVisualizer@visualization@pcl@@QAEXABN00H@Z)
referenced in function "void __cdecl viewerOneOff(class
pcl::visualization::PCLVisualizer &)"
(?viewerOneOff@@YAXAAVPCLVisualizer@visualization@pcl@@@Z)

cloud_viewer.obj : error LNK2019: unresolved external symbol "public: bool __thiscall
pcl::visualization::PCLVisualizer::addText(class
std::basic_string,class
std::allocator > const &,int,int,class
std::basic_string,class
std::allocator > const &,int)"

cloud_viewer.obj : error LNK2019: unresolved external symbol "private: void __thiscall
pcl::visualization::PCLVisualizer::addActorToRenderer(class
vtkSmartPointer const &,int)"
(?addActorToRenderer@PCLVisualizer@visualization@pcl@@AAEXABV?$vtkSmartPointer@VvtkProp@@@@H@Z)
referenced in function "public: bool __thiscall
pcl::visualization::PCLVisualizer::addSphere(struct pcl::PointXYZ const
&,double,double,double,double,class std::basic_string,class std::allocator > const &,int)"

cloud_viewer.obj : error LNK2019: unresolved external symbol "public: __thiscall pcl::visualization::CloudViewer::CloudViewer(class
std::basic_string,class
std::allocator > const &)"
(??0CloudViewer@visualization@pcl@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
referenced in function _main
cloud_viewer.obj : error LNK2019: unresolved external symbol "public: __thiscall
pcl::visualization::CloudViewer::~CloudViewer(void)"
(??1CloudViewer@visualization@pcl@@QAE@XZ) referenced in function
_main

cloud_viewer.obj : error LNK2019: unresolved external symbol "public: void __thiscall
pcl::visualization::CloudViewer::showCloud(class
boost::shared_ptr
const > const &,class std::basic_string,class std::allocator > const &)"
(?showCloud@CloudViewer@visualization@pcl@@QAEXABV?$shared_ptr@$$CBV?$PointCloud@UPointXYZRGBA@pcl@@@pcl@@@boost@@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
referenced in function _main

cloud_viewer.obj : error LNK2019: unresolved external symbol "public: bool __thiscall
pcl::visualization::CloudViewer::wasStopped(int)"
(?wasStopped@CloudViewer@visualization@pcl@@QAE_NH@Z) referenced in
function _main



  1. I have only XYZ data without any RGB value. Which functions from PCL must I use ?

  2. How must my main.cpp file look like ?
    Is it similar to the grabber main mentioned here - http://pointclouds.org/documentation/tutorials/openni_grabber.php

  3. I understand that I must build my own VisualStudio project. Which header files and cpp files from pcl library I need to copy and put in my project to use?

  4. What additional tools/software must I install in addition to using selected PCL files (header and cpp) ?


Answer Source
  1. Looks like you're not linking the PCL visualization lib file and probably others. Do this in the project properties > Linker > Input > Additional Dependencies. The path to your PCL lib directory should be specified in Project properties > VC++ Directories > Library Directories. At the same time the path to your PCL include directory should be specified in Project properties > VC++ Directories > Include Directories.
  2. PCL functions and types are templated on the point type. So you will use pcl::PointXYZ as the point type for all functions.
  3. No. Yours will be more similar to the Simple Cloud Visualization example in the CloudViewer tutorial.
  4. You don't copy the PCL .h and .cpp files into your solution. You #include the PCL headers that remain in their installed location, and you link in the PCL lib files, (see 1 above.)
  5. None. If the PCL bin/ directory is not in your $PATH then place the PCL .dlls alongside your .exe.

Make sure you match release libraries with a release build and debug libraries with a debug build. Make sure you're building either for Win32 or x64 depending on which pre-installed binary you installed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download