Code Monkey home page Code Monkey logo

kitti_tutorial's Introduction

KITTI Tutorial

Introduction

This is personal result for studying Self-Driving Techs. In this tutorial, I'll upload various codes from basic methods(e.g. lidar point projection) to state-of-the-art techs(e.g. deeplearning-based vehicle detection). Mainly, 'velodyne, camera' data-based approach will be discussed but when the time allows, I'll treat stereo vision, too. Also, Kitti-dataset-related simple codes(e.g. load tracklet or velodyne points) are in kitti_foundation.py coded by myself.

Before start,

Dataset

KITTI 2011_09_26_drive_0005 dataset

tutorials

Velodyne -> Panoramic Image : Convert Velodyne data(model : HDL-64E) to panoramic image.

panorama_image

Velodyne -> Top-View Image : Convert Velodyne data(model : HDL-64E) to Top-view image.

topview_image

Velodyne to Image Projection : Project Velodyne points(model : HDL-64E) to camera Image.

projection_image

Display 3D Tracklet : Display 3D Tracklet on image

tracklet_image

Contributions / Comments

always welcome any kind of comments and pull-requests

kitti_tutorial's People

Contributors

jaskaran1 avatar windowsub0406 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kitti_tutorial's Issues

TypeError: 'generator' object has no attribute '__getitem__'

Hi,
Here is what I have encountered when I run the code which you provided "Project 3D Velodyne points to 2D camera Image ", I got error message.
I put the code you provided in ipython notebook inside one file called, "projectVelo.py", and I only changed the path to velodyne and image file.

Here is the error message:

Traceback (most recent call last):
File "projectVelo.py", line 60, in
img, pnt, c_ = res.velo_projection_frame(v_fov=v_fov, h_fov=h_fov)
File "/home/keisha_tsai/Downloads/KITTI_Tutorial-master/kitti_foundation.py", line 611, in velo_projection_frame
res, c_ = self.__velo_2_img_projection(velo_gen)
File "/home/keisha_tsai/Downloads/KITTI_Tutorial-master/kitti_foundation.py", line 486, in _velo_2_img_projection
xyz_v, c
= self.__point_matrix(points)
File "/home/keisha_tsai/Downloads/KITTI_Tutorial-master/kitti_foundation.py", line 305, in __point_matrix
self.__points_filter(points)
File "/home/keisha_tsai/Downloads/KITTI_Tutorial-master/kitti_foundation.py", line 368, in __points_filter
self.__upload_points(points)
File "/home/keisha_tsai/Downloads/KITTI_Tutorial-master/kitti_foundation.py", line 296, in __upload_points
self.__x = points[:, 0]
TypeError: 'generator' object has no attribute 'getitem'

Hope anyone can help me to solve this problem.
Thank you.

problem in velo_points_2_pano funciton

I found something illogical in function velo_points_2_pano of Convert_Velo_2_Pano_detail.ipynb;

def velo_points_2_pano(points, v_res, h_res, v_fov, h_fov, depth=False):
    # Projecting to 2D
    x = points[:, 0]
    y = points[:, 1]
    z = points[:, 2]
    dist = np.sqrt(x ** 2 + y ** 2 + z ** 2)

    # project point cloud to 2D point map
    y_img = -(np.arctan2(z, dist) / (v_res * (np.pi / 180)))

Should dist = np.sqrt(x ** 2 + y ** 2) rather than dist = np.sqrt(x ** 2 + y ** 2 + z ** 2)? I discussed with ChatGPT4,0 who also agrees with me.

velodyne project to image not correct

Hi, thanks for your sharing code first.
However, when I try your code to realize the velodyne cloud points projection to image, I found there are mismatch between the cloud points and the corresponding image object, such as the cyclist of "2011_09_26_drive_0005_sync" dataset.
2018-11-18 15-17-26
You can see the points cloud of the cyclist go through the side car.
I don't know why, maybe the original calibration matrix is not correct? Or the calculation is not right, because I am not understand the calibration matrix very well in "calib_cam_to_cam.txt".
Thanks!

Bad results on custom data

Hi Great work!
I was using Convert_Velo_2_Pano.ipynb for my Indian Driving Data(IDD) and the lidar used for this dataset is Velodyne VLP-16.I changed the angular resolution and hfov and vfov accordingly,but I got a very bad result.
idd_kitti
But when I use the code on Kitti dataset for Velodyne HDL-64E (with the respective resoluion and fov)
I got much better results.
idd_kitti (copy)
Can anyone suggest what is going wrong?
Is the conversion also dependent on any other factors based on lidar?
Thank you

TypeError: super() takes at least 1 argument (0 given)

Hi,
Thanks for the tutorial.
Here is what I have encountered when I run the code which you provided "Project 3D Velodyne points to 2D camera Image ", I got error message.
I put the code you provided in ipython notebook inside one file called, "projectVelo.py", and I only changed the path to velodyne and image file.

Traceback (most recent call last):
File "projectVelo.py", line 54, in
res = Kitti_util(frame=128, camera_path=image_path, velo_path=velo_path, v2c_path=v2c_filepath, c2c_path=c2c_filepath)
File "/home/keisha_tsai/Downloads/KITTI_Tutorial-master/kitti_foundation.py", line 235, in init
super().init(frame, velo_path, camera_path, img_type, v2c_path, c2c_path, xml_path)
TypeError: super() takes at least 1 argument (0 given)

Could you help me to clarify the error? Thank you.

3D Tracklet Display error

I am getting an error while trying to execute the display_groundtruth.ipynb notebook.
In cell number 4

issue

please it will be highly appreciated if you can give me a clue about it ?

3D tracklet issue (display_groundtruth.ipynb)

Hey there,

There's an issue with your ground truth script. It links back to the parsing script, itertools.izip does not work. I changed it to zip (python2 -> python3) but then the main loop fails at:

for i, j in zip(tracklet2d, type_[frame]):
    for k in line_order:    
        cv2.line(image, (int(i[0][k[0]]), int(i[1][k[0]])), (int(i[0][k[1]]), int(i[1][k[1]])), type_c[j], 2)

Algorithm of Lidar-Camera Projection

In the projection part, your algorithm is to remove the points outside the camera frame by using distances and angles. But I cannot find the theory which support this way.

Actually we can use the whole pointcloud with Extrinsic and Intrinsic matrix to get the results of [x, y, w], then remove the points with w<0. This way is more understandable.

values in calib_velo_to_cam.txt

There are 9 values for the rotation matrix in calib_velo_to_cam.txt of KITTI dataset. Can anyone interpret these 9 values??

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.