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

plotting 3D boxes on the point cloud #2

Open
NEURALWORKS91 opened this issue Jan 5, 2020 · 1 comment
Open

plotting 3D boxes on the point cloud #2

NEURALWORKS91 opened this issue Jan 5, 2020 · 1 comment

Comments

@NEURALWORKS91
Copy link

Hi,
I wish to do this:
range image -> pcl -> plot 3D boxes from the labels in the PCL

How can I do that?
Please help.

I tried the following code but I don't understand the result.

`# get the 3D box coordinates for the point cloud - each frame will have many objects and as many labels
for label in frame.laser_labels:

        # compute the 3D box corners in the point cloud
        box_T_mat = utils.get_box_transformation_matrix(label.box)
        vertices = np.empty([2, 2, 2, 2])
        for k in [0, 1]:
            for l in [0, 1]:
                for m in [0, 1]:
                    # 3D point in the box space
                    v = np.array([(k - 0.5), (l - 0.5), (m - 0.5), 1.])

                    vertices[k, l, m, :] = [v[0] / v[2], v[1] / v[2]]

        # vertices = vertices.astype(np.int32)`

image

@gdlg
Copy link
Owner

gdlg commented Jan 5, 2020

Hi,

This function takes a 3D bounding box described by its position, orientation and size and project its 8 corners onto an image. The array vertices contains the 2D position (in pixels) of each corner in the image.

I assume that you are using the top 360° lidar. In this case, this function is not directly usable because it was designed for perspective projection whereas the range image is more like an equirectangular image using spherical coordinates.

Here is a variant of this function which I have used in another project to draw 3D bounding boxes into 360° panoramic images.

Have a look at this function to see the exact details of how the range image is mapped to a pointcloud in this dataset.

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