Git Product home page Git Product logo

Comments (6)

xpchuan-95 avatar xpchuan-95 commented on June 27, 2024

Have you ever tried this tutorial?
https://github.com/scaleapi/pandaset-devkit/blob/master/tutorials/projection/projection.ipynb

from pandaset-devkit.

crackgfw avatar crackgfw commented on June 27, 2024

My code:
Is there any bug?

import pandaset
from pandaset import geometry
import numpy as np
import cv2

dataset = pandaset.DataSet("/data/PandaSet")

seq002 = dataset["002"]
seq002.load()
camera_keys = seq002.camera.keys()
print("Available cameras: ", camera_keys)

seq_idx = 0
cuboids0 = seq002.cuboids[seq_idx]
box = [cuboids0["position.x"][seq_idx], cuboids0["position.y"][seq_idx], cuboids0["position.z"][seq_idx],
cuboids0["dimensions.x"][seq_idx], cuboids0["dimensions.y"][seq_idx], cuboids0["dimensions.y"][seq_idx],
cuboids0["yaw"][seq_idx]]

corners = geometry.center_box_to_corners(box)

camera_used = cuboids0["camera_used"][seq_idx]
camera_name = "front_right_camera"
choosen_camera = seq002.camera[camera_name]

ori_image = seq002.camera[camera_name][seq_idx]
img = cv2.cvtColor(np.array(ori_image), cv2.COLOR_RGB2BGR)

projected_points2d, camera_points_3d, inner_indices = geometry.projection(lidar_points=corners,
camera_data=choosen_camera[seq_idx],
camera_pose=choosen_camera.poses[seq_idx],
camera_intrinsics=choosen_camera.intrinsics,
filter_outliers=False)

box1 = projected_points2d[(0, 3, 7, 4), :]
box2 = projected_points2d[(1, 2, 6, 5), :]
box1 = np.rint(box1).astype(np.int32)
box2 = np.rint(box2).astype(np.int32)
box1 = box1.reshape((-1, 1, 2))
box2 = box2.reshape((-1, 1, 2))
cv2.polylines(img, [box1], True, (0, 0, 255), 5)
cv2.polylines(img, [box2], True, (255, 0, 0), 5)

cv2.imshow('boxed', img)

cv2.waitKey()
cv2.destroyAllWindows()

from pandaset-devkit.

xpchuan-95 avatar xpchuan-95 commented on June 27, 2024

The box you try to show on the image is not in front of the camera, it's out of field of vision, maybe at back of the camera.

from pandaset-devkit.

crackgfw avatar crackgfw commented on June 27, 2024

I have tried every camera. It doesn't work well

from pandaset-devkit.

xpchuan-95 avatar xpchuan-95 commented on June 27, 2024

I have tried every camera. It doesn't work well

There is a mistake in visualization code,
cuboids0["dimensions.x"][seq_idx], cuboids0["dimensions.y"][seq_idx], cuboids0["dimensions.y"] ->
cuboids0["dimensions.x"][seq_idx], cuboids0["dimensions.y"][seq_idx], cuboids0["dimensions.z"]

from pandaset-devkit.

crackgfw avatar crackgfw commented on June 27, 2024

Thanks a lot.

from pandaset-devkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.