After you go through PCL and Kinect Setup. You can start writing program. This time, I will try to capture the Point Cloud without using Grabber. Grabber is method provided by OpenNI library. So in this program, you do not need to add Open NI module inside your project. this program only use Kinect and PCL library as reference.
- Create Win32 C++ Console Project
- Add existing Property Sheet: PCL.props and Kinect SDK.props as configured here
- Declare Include header as follows:
Something to notice is #define NOMINMAX and windows.h header. declare this before we declare PCL header and define NOMINMAX before windows.h. Because if you put it wrong, can cause another error while debugging.
I will not re-write the code, because the code shown in the reference is correct. please refer to below link. I just want to make some note about this program 🙂
References: 1 | 2 |
1.Header Placement of NOMINMAX and Windows.h
Error 2589 and Error 2143 will be shown. ‘identifier’ : illegal token on right side of ‘::’
Solve: rearrange the header placement. declare NOMINMAX before windows.h and PCL header after that.
2.LNK2019 unresolved external symbol
Solve: this was my stupid mistake haha I did the uncomplete config for PCL.props. I forgot to declare Additional Library Dependencies in the property, so that my program could not find the symbol . So, I did solve it with adding those many .lib in the setting. (refer to setup page)
Error 4996 shown.
Solve: Add additional definition after header declaration
4.argument of type “ColorSpacePoint” is incompatible / too few arguments in function call
This error was also my silly mistake. haha I mistakenly use another method. This error was related to Mapping method. MapDepthPointToColorSpace and MapDepthPointToCameraSpace . I got this error because I use different method (MapDepthPointsToCameraSpace and MapDepthPointsToColorSpace). Points , not Point.
Solve: change using the correct method. I don’t know why my Intellisense is so slow. thats why I did not realize that there are two similar method there.
If you found another error, try to check the library, header, and property setting.