Skip to main content

KITTI

GitHub PyPI - Python Version PyPI PyPI - Downloads

wernstrom

So this package is a modification for what I use and a specific set of KITTI data that doesn't appear to follow the standard KITTI format. Use at own risk, your computer might melt or become sentient and take over the world!

This package provides a minimal set of tools for working with the KITTI dataset [1] in Python. So far only the raw datasets and odometry benchmark datasets are supported, but we're working on adding support for the others. We welcome contributions from the community.

Assumptions

This package assumes that you have also downloaded the calibration data associated with the sequences you want to work on (these are separate files from the sequences themselves).

from wernstrom import get_data

# download the zip data to current directory ... nothing fancy here!
get_data("image_2")

Notation

Homogeneous coordinate transformations are provided as 4x4 numpy.array objects and are denoted as T_destinationFrame_originFrame.

Pinhole camera intrinsics for camera N are provided as 3x3 numpy.array objects and are denoted as K_camN. Stereo pair baselines are given in meters as b_gray for the monochrome stereo pair (cam0 and cam1), and b_rgb for the color stereo pair (cam2 and cam3).

Example

Camera data is available via generators for easy sequential access (e.g., for visual odometry), and by indexed getter methods for random access (e.g., for deep learning). Images are loaded as PIL.Image objects using Pillow.

import wernstrom as pykitti

basedir = '/your/dataset/dir'
sequence = '19'

# The 'frames' argument is optional - default: None, which loads the whole dataset.
# Calibration, timestamps, and IMU data are read automatically.
# Camera and velodyne data are available via properties that create generators
# when accessed, or through getter methods that provide random access.
data = pykitti.raw(basedir, sequence, frames=range(0, 50, 5))

# dataset.calib:         Calibration data are accessible as a named tuple
# dataset.timestamps:    Timestamps are parsed into a list of datetime objects
# dataset.oxts:          List of OXTS packets and 6-dof poses as named tuples
# dataset.camN:          Returns a generator that loads individual images from camera N
# dataset.get_camN(idx): Returns the image from camera N at idx
# dataset.gray:          Returns a generator that loads monochrome stereo pairs (cam0, cam1)
# dataset.get_gray(idx): Returns the monochrome stereo pair at idx
# dataset.rgb:           Returns a generator that loads RGB stereo pairs (cam2, cam3)
# dataset.get_rgb(idx):  Returns the RGB stereo pair at idx
# dataset.position:      Returns an array of x,y positions in meters

point_cam0 = data.calib.T_cam0_velo.dot(point_velo)

point_imu = np.array([0,0,0,1])
point_w = [o.T_w_imu.dot(point_imu) for o in data.oxts]

for cam0_image in data.cam0:
    # do something
    pass

cam2_image, cam3_image = data.get_rgb(3)

Transforms T_w_imu

"The T_w_imu convention refers to the transformation from IMU to the world coordinate system (so notation is T_destinationFrame_originFrame)." ref

OpenCV

PIL Image data can be converted to an OpenCV-friendly format using numpy and cv2.cvtColor:

img_np = np.array(img)
img_cv2 = cv2.cvtColor(img_np, cv2.COLOR_RGB2BGR)

Note: This package does not actually require that OpenCV be installed on your system, except to run demo_raw_cv2.py.

References

MIT License

Copyright (c) 2020 Kevin J. Walchko

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

Metadata

Release files for wernstrom 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wernstrom 0.4.4
File Size Uploaded
wernstrom-0.4.4.tar.gz 12.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wernstrom 0.4.4
File Interpreter ABI Platform
wernstrom-0.4.4-py3-none-any.whl Python 3 none any Details

Total release size: 22.9 kB

Release files / wernstrom-0.4.4.tar.gz

Download URL wernstrom-0.4.4.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4affea376f8514fc3d38d759d33c604989f6598b97f09079617aa76eb4514fe3
BLAKE2b-256 checksum
How to use checksums
01077c80f51b1fc3f8095fd91d35e1f3b987e90f4f942241d7dfe9340c3221ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.5 Darwin/21.6.0

Release files / wernstrom-0.4.4-py3-none-any.whl

Download URL wernstrom-0.4.4-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cae37e3c72c0cdedc27f081be31053b12bd3b16a8a52ddd805a07314fb535de5
BLAKE2b-256 checksum
How to use checksums
57c13284fa7a3809ca5f54f5aa765979598b8e77b87b3ff35e99ba0c97f2a372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.14 CPython/3.10.5 Darwin/21.6.0

Release history Release notifications | RSS feed

This release

0.4.4 This release

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page