Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point Cloud visualization problem #77

Open
MiniDudi opened this issue Aug 20, 2024 · 1 comment
Open

Point Cloud visualization problem #77

MiniDudi opened this issue Aug 20, 2024 · 1 comment

Comments

@MiniDudi
Copy link

i'm trying to convert the point cloud results into a kitti dataset .bin file and for some reason it's returning me a error when running the test:

TypeError: tuple indices must be integers or slices, not str #21

convertion code:

class MinimalSubscriber(Node):

    def __init__(self):
        super().__init__('minimal_subscriber')
        self.subscription = self.create_subscription(
            PointCloud2,
            'velodyne_points',
            self.listener_callback,
            10)

    def convert_pointcloud(self, msg):

        pc = pc2.read_points(msg, field_names=("x", "y", "z", "intensity"), skip_nans=True)
        pc = np.array(list(pc), dtype=np.float32)

        x = pc[:, 0]
        y = pc[:, 1]
        z = pc[:, 2]
        intensity = pc[:, 3]
        
        arr = np.zeros(x.shape[0] * 4, dtype=np.float32)
        arr[::4] = x
        arr[1::4] = y
        arr[2::4] = z
        arr[3::4] = intensity
        
        bin_file_name = 'point_cloud_data.bin'
        with open(bin_file_name, 'wb') as f:
            arr.tofile(f)

    def listener_callback(self, msg):

        self.convert_pointcloud(msg)

To resolve the error above, i removed the following line in test.py:

#model.eval() #48

After this, the inference worked and displayed the window with the detected objects. But, all the point cloud is showing in white.

image

What am i doing wrong? Do you guys have any idea?

Thank you in advance.

@kauanBestel
Copy link

I'm facing the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants