kitti-odom-2012-dataloader


Namekitti-odom-2012-dataloader JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryEfficient and user-friendly point cloud data loader for the Kitti Odometry 2012 dataset, supporting multiple coordinate systems and numpy compatibility.
upload_time2025-08-24 06:31:47
maintainerNone
docs_urlNone
authorHopeCollector
requires_python>=3.12
licenseMIT License Copyright (c) 2025 HopeCollector Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords kaist pointcloud lidar slam autonomous driving dataset
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # KITTI Odometry 2012 Point Cloud Data Loader (English Translation)

> This is an English translation of the original [中文版](./README_CN.md).

> **Dataset Homepage**: [KITTI Odometry Benchmark](http://www.cvlibs.net/datasets/kitti/eval_odometry.php)

## 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 system
  - `MAP_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](https://github.com/astral-sh/uv) or pip to install dependencies:

```bash
uv pip install -e .
```

Or use pip directly:

```bash
pip install kitti-odom-2012-dataloader
```

## Quick Start

```python
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

1. **Activate Python virtual environment** (ensure kitti-odom-2012-dataloader and pybind11 are installed)
2. Modify line 18 in `main.cc` to set the `root` variable to your dataset path, e.g., `/ws/data/kitti/sequences/00`
3. Build the project:
   ```bash
   cd example/cpp
   cmake -S . -B build
   cmake --build build
   ```
4. Run the example:
   ```bash
   ./build/embed_loader
   ```

After running, it will output the dataset length, point cloud, and pose shapes.

### Main Code Logic

- Start Python interpreter  
  ```cpp
  #include <pybind11/embed.h>
  namespace py = pybind11;
  py::scoped_interpreter guard{};
  ```
- Import `kitti_odom_2012_dataloader` module  
  ```cpp
  py::module_ kd = py::module_::import("kitti_odom_2012_dataloader");
  py::object PointCloudLoader = kd.attr("PointCloudLoader");
  py::object FrameID = kd.attr("FrameID");
  ```
- Create `PointCloudLoader` instance  
  ```cpp
  const char* root = "/ws/data/kitti/sequences/00";
  py::object loader =
    PointCloudLoader(root, py::arg("frame_id") = FrameID.attr("MAP_FLU"));
  ```
- Read dataset length  
  ```cpp
  std::size_t n = loader.attr("__len__")().cast<std::size_t>();
  std::cout << "dataset length = " << n << "\n";
  ```
- Read point cloud and pose, print shapes  
  ```cpp
  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)  
  ```cpp
  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 matrix
- `MAP_KITTI`: KITTI official global coordinate system (RDF), point cloud transformed by global pose
- `MAP_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:

```python
loader.frame_id = FrameID.MAP_FLU
cld, pose = loader[0]
```

## API Reference

- [`PointCloudLoader`](src/kitti_odom_2012_dataloader/pointcloud.py): Main loader class, supports indexing, slicing, iteration
- [`FrameID`](src/kitti_odom_2012_dataloader/pointcloud.py): Coordinate system enum type
- [`get_lidar_files`](src/kitti_odom_2012_dataloader/basic.py): Get point cloud file list
- [`read_lidar`](src/kitti_odom_2012_dataloader/basic.py): Read single frame point cloud
- [`load_calib_matrix`](src/kitti_odom_2012_dataloader/basic.py): Read calibration matrix
- [`load_global_poses`](src/kitti_odom_2012_dataloader/basic.py): Read global poses
- [`transform_point_cloud`](src/kitti_odom_2012_dataloader/basic.py): 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](pyproject.toml)):
- open3d
- matplotlib
- pytest
- ipykernel
- ruff

## Testing

Unit tests are included. Run:

```bash
uv pip install .[dev]
uv run pytest
```

## Changelog

- **v0.1.0**: Initial version, basic functionality implemented
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "kitti-odom-2012-dataloader",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "kaist, pointcloud, lidar, slam, autonomous driving, dataset",
    "author": "HopeCollector",
    "author_email": "HopeCollector <cmw0249@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3c/18/211ac21f559f477ad2bfe3a22c984a5ab7170a436560aa9c5046903737d3/kitti_odom_2012_dataloader-0.1.0.tar.gz",
    "platform": null,
    "description": "# KITTI Odometry 2012 Point Cloud Data Loader (English Translation)\n\n> This is an English translation of the original [\u4e2d\u6587\u7248](./README_CN.md).\n\n> **Dataset Homepage**: [KITTI Odometry Benchmark](http://www.cvlibs.net/datasets/kitti/eval_odometry.php)\n\n## Project Overview\n\nThis 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.\n\n## Features\n\n- **Multiple Coordinate Systems Supported**\n  - `BASE_LINK`: Vehicle local coordinate system\n  - `MAP_KITTI`: KITTI official global coordinate system (RDF)\n  - `MAP_FLU`: Common FLU global coordinate system\n- **Iterator and Slicing**: Supports iteration, slicing, and random access\n- **Numpy Compatible**: Can read directly from numpy arrays\n- **Dataset Length**: Supports the `len()` method\n\n## Installation\n\nIt is recommended to use [uv](https://github.com/astral-sh/uv) or pip to install dependencies:\n\n```bash\nuv pip install -e .\n```\n\nOr use pip directly:\n\n```bash\npip install kitti-odom-2012-dataloader\n```\n\n## Quick Start\n\n```python\nfrom kitti_odom_2012_dataloader import PointCloudLoader, FrameID\n\nloader = PointCloudLoader(\"/path/to/kitti/sequences/00\", frame_id=FrameID.MAP_FLU)\ncld, pose = loader[0]  # Read the first point cloud and its pose\n\n# Iterate over the first 10 frames\nfor cld, pose in loader[:10]:\n    # Process point cloud and pose\n    pass\n\n# Get dataset length\nprint(len(loader))\n```\n\n## C++/pybind11 Example\n\nThis project supports direct invocation of the Python loader in C++ via pybind11, suitable for integration with C++ projects.  \nSee `example/cpp/main.cc` for sample code. Ensure the `root` path points to a valid KITTI dataset directory.\n\n### Build and Run Steps\n\n1. **Activate Python virtual environment** (ensure kitti-odom-2012-dataloader and pybind11 are installed)\n2. Modify line 18 in `main.cc` to set the `root` variable to your dataset path, e.g., `/ws/data/kitti/sequences/00`\n3. Build the project:\n   ```bash\n   cd example/cpp\n   cmake -S . -B build\n   cmake --build build\n   ```\n4. Run the example:\n   ```bash\n   ./build/embed_loader\n   ```\n\nAfter running, it will output the dataset length, point cloud, and pose shapes.\n\n### Main Code Logic\n\n- Start Python interpreter  \n  ```cpp\n  #include <pybind11/embed.h>\n  namespace py = pybind11;\n  py::scoped_interpreter guard{};\n  ```\n- Import `kitti_odom_2012_dataloader` module  \n  ```cpp\n  py::module_ kd = py::module_::import(\"kitti_odom_2012_dataloader\");\n  py::object PointCloudLoader = kd.attr(\"PointCloudLoader\");\n  py::object FrameID = kd.attr(\"FrameID\");\n  ```\n- Create `PointCloudLoader` instance  \n  ```cpp\n  const char* root = \"/ws/data/kitti/sequences/00\";\n  py::object loader =\n    PointCloudLoader(root, py::arg(\"frame_id\") = FrameID.attr(\"MAP_FLU\"));\n  ```\n- Read dataset length  \n  ```cpp\n  std::size_t n = loader.attr(\"__len__\")().cast<std::size_t>();\n  std::cout << \"dataset length = \" << n << \"\\n\";\n  ```\n- Read point cloud and pose, print shapes  \n  ```cpp\n  py::tuple item0 = loader[py::int_(0)];\n  py::array_t<float> cld = item0[0].cast<py::array_t<float>>();\n  py::array_t<double> pose = item0[1].cast<py::array_t<double>>();\n  std::cout << \"points shape = (\" << cld.shape(0) << \", \" << cld.shape(1) << \")\\n\";\n  std::cout << \"pose shape   = (\" << pose.shape(0) << \", \" << pose.shape(1) << \")\\n\";\n  ```\n- Iterate over first 10 frames (optional)  \n  ```cpp\n  for (py::size_t i = 0; i < 10 && i < n; ++i) {\n    py::tuple it = loader[py::int_(i)];\n    // Process point cloud and pose here\n  }\n  ```\n\nSee `example/cpp/main.cc` for detailed code.\n\n## Coordinate System Description\n\n- `BASE_LINK`: Vehicle local coordinate system, point cloud transformed by calibration matrix\n- `MAP_KITTI`: KITTI official global coordinate system (RDF), point cloud transformed by global pose\n- `MAP_FLU`: Common FLU global coordinate system, point cloud converted from RDF to FLU\n\nYou can switch coordinate systems via the `frame_id` parameter or attribute:\n\n```python\nloader.frame_id = FrameID.MAP_FLU\ncld, pose = loader[0]\n```\n\n## API Reference\n\n- [`PointCloudLoader`](src/kitti_odom_2012_dataloader/pointcloud.py): Main loader class, supports indexing, slicing, iteration\n- [`FrameID`](src/kitti_odom_2012_dataloader/pointcloud.py): Coordinate system enum type\n- [`get_lidar_files`](src/kitti_odom_2012_dataloader/basic.py): Get point cloud file list\n- [`read_lidar`](src/kitti_odom_2012_dataloader/basic.py): Read single frame point cloud\n- [`load_calib_matrix`](src/kitti_odom_2012_dataloader/basic.py): Read calibration matrix\n- [`load_global_poses`](src/kitti_odom_2012_dataloader/basic.py): Read global poses\n- [`transform_point_cloud`](src/kitti_odom_2012_dataloader/basic.py): Point cloud coordinate transformation\n\n## Data Format\n\n- Point cloud data shape: `[N, 4]`, representing `[x, y, z, intensity]`\n- Pose matrix shape: `[4, 4]`\n\n## Dependencies\n\n- numpy\n\nDevelopment/testing dependencies (see [pyproject.toml](pyproject.toml)):\n- open3d\n- matplotlib\n- pytest\n- ipykernel\n- ruff\n\n## Testing\n\nUnit tests are included. Run:\n\n```bash\nuv pip install .[dev]\nuv run pytest\n```\n\n## Changelog\n\n- **v0.1.0**: Initial version, basic functionality implemented",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2025 HopeCollector  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Efficient and user-friendly point cloud data loader for the Kitti Odometry 2012 dataset, supporting multiple coordinate systems and numpy compatibility.",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://github.com/HopeCollector/kitti-odom-2012-dataloader#readme",
        "Homepage": "https://github.com/HopeCollector/kitti-odom-2012-dataloader",
        "Source": "https://github.com/HopeCollector/kitti-odom-2012-dataloader"
    },
    "split_keywords": [
        "kaist",
        " pointcloud",
        " lidar",
        " slam",
        " autonomous driving",
        " dataset"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "802d893fc58988dd157d2ce360934dc4c704d809a210577a80136c0b79edb3b8",
                "md5": "e5c30b34f492d06795477462b3777897",
                "sha256": "8e0d9b3a41df56a3984f6d3e71db67d3a66e72c83871b2b52e761768538da34c"
            },
            "downloads": -1,
            "filename": "kitti_odom_2012_dataloader-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e5c30b34f492d06795477462b3777897",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 8398,
            "upload_time": "2025-08-24T06:31:45",
            "upload_time_iso_8601": "2025-08-24T06:31:45.562207Z",
            "url": "https://files.pythonhosted.org/packages/80/2d/893fc58988dd157d2ce360934dc4c704d809a210577a80136c0b79edb3b8/kitti_odom_2012_dataloader-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3c18211ac21f559f477ad2bfe3a22c984a5ab7170a436560aa9c5046903737d3",
                "md5": "5827b92ae09647d9deea5158cd1dfc7c",
                "sha256": "e8048964e68caccbe160de3f3077efd0254f843f69c3ea2979c84a7b2e2a2a55"
            },
            "downloads": -1,
            "filename": "kitti_odom_2012_dataloader-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5827b92ae09647d9deea5158cd1dfc7c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 7525,
            "upload_time": "2025-08-24T06:31:47",
            "upload_time_iso_8601": "2025-08-24T06:31:47.062464Z",
            "url": "https://files.pythonhosted.org/packages/3c/18/211ac21f559f477ad2bfe3a22c984a5ab7170a436560aa9c5046903737d3/kitti_odom_2012_dataloader-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-24 06:31:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "HopeCollector",
    "github_project": "kitti-odom-2012-dataloader#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "kitti-odom-2012-dataloader"
}
        
Elapsed time: 0.85830s