Re: Sending point cloud to another PC with socket send function

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Sending point cloud to another PC with socket send function

Gruenke,Matt
You must first serialize the point cloud.  This can be accomplished by writing it to a file, then reading the contents of the file as a contiguous block of raw data.  However, I recently added a method to serialize point clouds in-memory.

You can find a rough example in the LZFInMem test case, in test_io.cpp:

    https://github.com/PointCloudLibrary/pcl/blob/master/test/io/test_io.cpp#L1297

In that test case, the variable pcd_str holds the serialized representation of the point cloud.  To get a pointer for the second parameter of send(), you'd call pcd_str.data().  The 3rd parameter would be pcd_str.size().

The rest of the test case shows how you'd deserialize it, on the other end.

Note that the in-memory serialization/deserialization functionality was added after the 1.8.1 release.  So, you must either use a more recent snapshot of PCL, or wait until the next release.


Matt


-----Original Message-----
From: PCL-users [mailto:[hidden email]] On Behalf Of Max
Sent: Tuesday, October 17, 2017 23:56
To: [hidden email]
Subject: [PCL-users] Sending point cloud to another PC with socket send function

Hi, everyone
I want to sent point cloud to another PC with socket. However, I have no idea about the second variable of send function. Here are some variables about the point cloud and send function:

typedef pcl::PointXYZRGBA PointT;
pcl::PointCloud<PointT>::Ptr cloud(new pcl::PointCloud<PointT>);

send function:
send(
    _In_ SOCKET s,
    _In_reads_bytes_(len) const char FAR * buf,
    _In_ int len,
    _In_ int flags
    )

Can anyone help me to fix the send function as the following:
send(Socket, &cloud, sizeof(cloud), NULL);

P.S. In fact, maybe I have no idea about how to fill in the "?" about this:
       send(Socket, ?, ?, NULL);

Any help is appreciated.

Thank you very much!
Max



--
Sent from: https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__www.pcl-2Dusers.org_%26d%3DDwIGaQ%26c%3D0YGvTs3tT-VMy8_v51yLDw%26r%3DVhIBU6ncUQoMafVUqG8TjKbuDohjXo_1oEvOBKGy_DA%26m%3DZriC-EfeGRlwkcTX8kN9-MY1C7ZKcjF8U4bj9v2Ez-E%26s%3D3unf2XigbOITrO131qL3v6U7D1clKx5oh2XnBCMmiiY%26e&data=02%7C01%7Cmgruenke%40tycoint.com%7C54387c0a415f4526a59d08d515dc2c83%7Ca1f1e2147ded45b681a19e8ae3459641%7C0%7C0%7C636438957739733057&sdata=wuXT0DDny9ffToRVrQrLWeOEzrBCSZiD93z123dK%2Btw%3D&reserved=0=
_______________________________________________
[hidden email] / https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__pointclouds.org%26d%3DDwIGaQ%26c%3D0YGvTs3tT-VMy8_v51yLDw%26r%3DVhIBU6ncUQoMafVUqG8TjKbuDohjXo_1oEvOBKGy_DA%26m%3DZriC-EfeGRlwkcTX8kN9-MY1C7ZKcjF8U4bj9v2Ez-E%26s%3DV6wnNtpVY3l1e_Nr8nZdAr-BGSP0_KyVFwARsp37koY%26e&data=02%7C01%7Cmgruenke%40tycoint.com%7C54387c0a415f4526a59d08d515dc2c83%7Ca1f1e2147ded45b681a19e8ae3459641%7C0%7C0%7C636438957739733057&sdata=ERtRhLhXfDSXx27zsKOVPRwxBAtSPIX6wxgovcutijI%3D&reserved=0=
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttp-3A__pointclouds.org_mailman_listinfo_pcl-2Dusers%26d%3DDwIGaQ%26c%3D0YGvTs3tT-VMy8_v51yLDw%26r%3DVhIBU6ncUQoMafVUqG8TjKbuDohjXo_1oEvOBKGy_DA%26m%3DZriC-EfeGRlwkcTX8kN9-MY1C7ZKcjF8U4bj9v2Ez-E%26s%3DBXzZS-qxgyK69vRvuqUNVIOh9qArCcZKkaemXv5k22U%26e&data=02%7C01%7Cmgruenke%40tycoint.com%7C54387c0a415f4526a59d08d515dc2c83%7Ca1f1e2147ded45b681a19e8ae3459641%7C0%7C0%7C636438957739733057&sdata=LiNUA2sx6n0XzNMjajDUem7Kae%2FR%2BSqCDq1rJthDeOk%3D&reserved=0=

________________________________

This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users