pcl
pcl copied to clipboard
Encoding point cloud as a ply format into a buffer
Your Environment
- Operating System and version: Windows 10
- Compiler: MSVC 2017
- PCL Version: 1.8.1
Context
The IO library of PCL contains functions to save point cloud as PLY or PCD directly into file. Sometime, it is useful to get the point cloud in PLY format into buffer for sending it over network for example.
Expected Behavior
The savePLY function should has another overload to save the output into buffer instead of file.
Current Behavior
Currently, it has only one option to save it to file directly.
In-memory PCD serialization/deserialization was contributed last year: #1986. You may take this as an example and implement the same for PLY format.
Marking this as stale due to 30 days of inactivity. It will be closed in 7 days if no further activity occurs.
Hi, I have started looking at this issue. Does someone need to assign this to me or something? Some indications as to how we are expecting the functions to behave would be appreciated.
@kaipomauli Hello, great that you want to contribute to PCL! I would suggest that we create a duplicate of the writeBinary function
https://github.com/PointCloudLibrary/pcl/blob/4ab87d43432b5497b715ace7415f799da7be4a77/io/include/pcl/io/ply_io.h#L604
but with std::ostream &os instead of a file name.
The implementation of that function is here: https://github.com/PointCloudLibrary/pcl/blob/4ab87d43432b5497b715ace7415f799da7be4a77/io/src/ply_io.cpp#L1199
There should be as little duplicated code as possible, so maybe the one function can open the file as a stream, then call the other function?
If you have any additional questions, feel free to ask.
Hi, I implemented a fix (waiting review) in https://github.com/PointCloudLibrary/pcl/pull/5966 not sure how to tie this issue back to the PR...