url-kaist / patchwork-plusplus

Patchwork++: Fast and robust ground segmentation method for 3D LiDAR scans. @ IROS'22
GNU General Public License v3.0
637 stars 103 forks source link

How to include intensity data #17

Closed reddittoob closed 1 year ago

reddittoob commented 1 year ago

Hi, I'm trying to use your amazing work.

In the data, point cloud was used only x,y,z data.

However, I want to use data including intensity data because I need to use intensity.

How can I do that?

Thank you.

seungjae24 commented 1 year ago

Hi @reddittoob , thank you for having interest on our work.

Actually, the example data provided in the repository ( e.g., 00000*.bin ) are including x, y, z, and intensity. Also, as you can see the function read_bin() in the demo codes, Patchwork++ already utilizes the intensity information. ( The input pointcloud receives 4 inputs from the bin per each iteration, which are x, y, z, and intensity. )

You can follow the demo codes and modify it for your situation. If you are using ROS, I can suggest you to visit this repository. Thank you.

reddittoob commented 1 year ago

Hi @seungjae24, Thank you for your reply.

I already knew that intensity was already included in read_bin(), however, result only include x,y,z information like below picture.

I want to include intensity value in result data.

Screenshot from 2022-11-29 16-40-57

Can you give me some solution?

Thank you.

seungjae24 commented 1 year ago

Aha, I got it.

The easiest way to include intensity value is modifying the structure of point defined in the file patchworkpp/include/patchworkpp.h. You can refer the previous issue, #11. It will help you to add intensity information to each point. You can try add ing intensity information like index information in #11.

reddittoob commented 1 year ago

I tried that you mentioned repo(#11). However, I got a same result.. I really don't know how to get it.

seungjae24 commented 1 year ago

Did you modify the function PatchWorkpp::toEigenCloud() ? It is defined in the patchworkpp/include/patchworkpp.h file and declared in the patchworkpp/src/patchworkpp.cpp file. You should edit this function to output Eigen::MatrixX4f, not Eigen::MatrixX3f, to include the intensity information. Also, you should put x, y, z, and intensity information of points to dst in this function.

reddittoob commented 1 year ago

After I changed as you said and compiled, I got errors like below.

error: static assertion failed: YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(ActualDstTypeCleaned,Src)

/usr/include/eigen3/Eigen/src/Core/AssignEvaluator.h:833:3: error: static assertion failed: YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES

seungjae24 commented 1 year ago

Did you check the corresponding functions, such as getGround(), getNonground(), and the corresponding variables, such as ground or nonground in the files: demo_visualize.cpp, demo_sequential.cpp? You should change them to operate properly with Eigen::MatrixX4f format. Please check all functions or variables, which will be affected due to the change of data format from Eigen::MatrixX3f to Eigen::MatrixX4f.

seungjae24 commented 1 year ago

I simply make the branch adding the intensity information to the point cloud. Please check this branch. If you build the code and run the python code, the python demo codes will print out the point cloud including the intensity information. ( By the way, I prevented the visualization of point cloud in the python code of this branch because I guess that geometry::PointCloud should get the input point cloud with the format of Eigen::MatrixX3f. You can visualize the point cloud by creating the point cloud of Eigen::MatrixX3f separately. )

seungjae24 commented 1 year ago

Actually, it is very difficult for me to find out the exact problem of your situation because I didn't change anything from the master branch, except for the addition of intensity information.

Moreover, as you can see in the below picture, there's no difference between the provided branch and the master branch. I got the exact same result. image

reddittoob commented 1 year ago

Thank you for your help!