Efficient and user-friendly point cloud data loader for the Kitti Odometry 2012 dataset, supporting multiple coordinate systems and numpy compatibility.
Project description
KITTI Odometry 2012 Point Cloud Data Loader (English Translation)
This is an English translation of the original 中文版.
Dataset Homepage: KITTI Odometry Benchmark
Project Overview
This project provides an efficient and user-friendly point cloud data loader for the KITTI Odometry 2012 dataset. It supports multiple coordinate system conversions, iteration, slicing, and is suitable for scenarios such as autonomous driving, SLAM, and 3D reconstruction.
Features
- Multiple Coordinate Systems Supported
BASE_LINK: Vehicle local coordinate systemMAP_KITTI: KITTI official global coordinate system (RDF)MAP_FLU: Common FLU global coordinate system
- Iterator and Slicing: Supports iteration, slicing, and random access
- Numpy Compatible: Can read directly from numpy arrays
- Dataset Length: Supports the
len()method
Installation
It is recommended to use uv or pip to install dependencies:
uv pip install -e .
Or use pip directly:
pip install kitti-odom-2012-dataloader
Quick Start
from kitti_odom_2012_dataloader import PointCloudLoader, FrameID
loader = PointCloudLoader("/path/to/kitti/sequences/00", frame_id=FrameID.MAP_FLU)
cld, pose = loader[0] # Read the first point cloud and its pose
# Iterate over the first 10 frames
for cld, pose in loader[:10]:
# Process point cloud and pose
pass
# Get dataset length
print(len(loader))
C++/pybind11 Example
This project supports direct invocation of the Python loader in C++ via pybind11, suitable for integration with C++ projects.
See example/cpp/main.cc for sample code. Ensure the root path points to a valid KITTI dataset directory.
Build and Run Steps
- Activate Python virtual environment (ensure kitti-odom-2012-dataloader and pybind11 are installed)
- Modify line 18 in
main.ccto set therootvariable to your dataset path, e.g.,/ws/data/kitti/sequences/00 - Build the project:
cd example/cpp cmake -S . -B build cmake --build build
- Run the example:
./build/embed_loader
After running, it will output the dataset length, point cloud, and pose shapes.
Main Code Logic
- Start Python interpreter
#include <pybind11/embed.h> namespace py = pybind11; py::scoped_interpreter guard{};
- Import
kitti_odom_2012_dataloadermodulepy::module_ kd = py::module_::import("kitti_odom_2012_dataloader"); py::object PointCloudLoader = kd.attr("PointCloudLoader"); py::object FrameID = kd.attr("FrameID");
- Create
PointCloudLoaderinstanceconst char* root = "/ws/data/kitti/sequences/00"; py::object loader = PointCloudLoader(root, py::arg("frame_id") = FrameID.attr("MAP_FLU"));
- Read dataset length
std::size_t n = loader.attr("__len__")().cast<std::size_t>(); std::cout << "dataset length = " << n << "\n";
- Read point cloud and pose, print shapes
py::tuple item0 = loader[py::int_(0)]; py::array_t<float> cld = item0[0].cast<py::array_t<float>>(); py::array_t<double> pose = item0[1].cast<py::array_t<double>>(); std::cout << "points shape = (" << cld.shape(0) << ", " << cld.shape(1) << ")\n"; std::cout << "pose shape = (" << pose.shape(0) << ", " << pose.shape(1) << ")\n";
- Iterate over first 10 frames (optional)
for (py::size_t i = 0; i < 10 && i < n; ++i) { py::tuple it = loader[py::int_(i)]; // Process point cloud and pose here }
See example/cpp/main.cc for detailed code.
Coordinate System Description
BASE_LINK: Vehicle local coordinate system, point cloud transformed by calibration matrixMAP_KITTI: KITTI official global coordinate system (RDF), point cloud transformed by global poseMAP_FLU: Common FLU global coordinate system, point cloud converted from RDF to FLU
You can switch coordinate systems via the frame_id parameter or attribute:
loader.frame_id = FrameID.MAP_FLU
cld, pose = loader[0]
API Reference
PointCloudLoader: Main loader class, supports indexing, slicing, iterationFrameID: Coordinate system enum typeget_lidar_files: Get point cloud file listread_lidar: Read single frame point cloudload_calib_matrix: Read calibration matrixload_global_poses: Read global posestransform_point_cloud: Point cloud coordinate transformation
Data Format
- Point cloud data shape:
[N, 4], representing[x, y, z, intensity] - Pose matrix shape:
[4, 4]
Dependencies
- numpy
Development/testing dependencies (see pyproject.toml):
- open3d
- matplotlib
- pytest
- ipykernel
- ruff
Testing
Unit tests are included. Run:
uv pip install .[dev]
uv run pytest
Changelog
- v0.1.0: Initial version, basic functionality implemented
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kitti_odom_2012_dataloader-0.1.0.tar.gz.
File metadata
- Download URL: kitti_odom_2012_dataloader-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8048964e68caccbe160de3f3077efd0254f843f69c3ea2979c84a7b2e2a2a55
|
|
| MD5 |
5827b92ae09647d9deea5158cd1dfc7c
|
|
| BLAKE2b-256 |
3c18211ac21f559f477ad2bfe3a22c984a5ab7170a436560aa9c5046903737d3
|
File details
Details for the file kitti_odom_2012_dataloader-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kitti_odom_2012_dataloader-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e0d9b3a41df56a3984f6d3e71db67d3a66e72c83871b2b52e761768538da34c
|
|
| MD5 |
e5c30b34f492d06795477462b3777897
|
|
| BLAKE2b-256 |
802d893fc58988dd157d2ce360934dc4c704d809a210577a80136c0b79edb3b8
|