python-pcl icon indicating copy to clipboard operation
python-pcl copied to clipboard

PointCloud_PointXYZRGB from_array method probably broken

Open dani2112 opened this issue 8 years ago • 5 comments

Hi,

I have a problem when executing the following code:

pointcloud_np = pointcloud.to_array() p = pcl.PointCloud_PointXYZRGB() p.from_array(pointcloud_np)

After that all previously present color information in the pointcloud is lost. All RGB values are set to zero. PCL version is 1.8.1 on Windows.

dani2112 avatar Dec 26 '17 18:12 dani2112

@dani2112, I am facing the same issue.

niranjanreddy891 avatar Apr 12 '18 08:04 niranjanreddy891

I'm also facing the same problem. Do you find a solution or an alternative way to add color information?_

yanjiaweisysu avatar Jun 28 '18 08:06 yanjiaweisysu

I convert the numpy array to a list, then use from_list method and can finally add color information to the pointcloud.

yanjiaweisysu avatar Jun 28 '18 09:06 yanjiaweisysu

@dani2112, @yanjiaweisysu Here is the code which I modified.

 p = pcl.PointCloud_PointXYZRGBA()
    p.from_array(np.array(ptcloud_centred, dtype=np.float32))

    visual = pcl_visualization.CloudViewing()
    visual.ShowColorCloud(p)
    def check_was_stopped():
        visual.WasStopped()

        root.after(100, check_was_stopped)
    check_was_stopped()

I hope this will help you. :) RGB has some issues regarding display. So, I have used RGBA which is similar to RGB

niranjanreddy891 avatar Jun 28 '18 09:06 niranjanreddy891

I convert the numpy array to a list, then use from_list method and can finally add color information to the pointcloud.

it doesnt work.

KainanSu avatar Jun 11 '22 11:06 KainanSu