utiasSTARS / pykitti

Python tools for working with KITTI data.
MIT License
1.15k stars 239 forks source link

Add fileformat kwarg to pykitti.raw() #14

Closed kampelmuehler closed 7 years ago

kampelmuehler commented 7 years ago

Hi, I'suggest adding an option for fileformat in the call to pykitti.raw(), such that .jpg can be loaded as well.

I've hacked it by adding self.fileformat = kwargs.get('fileformat', 'png') to the init and replacing '.png' with '.{}'.format(self.fileformat) in the generators.

This way other fileformats such as 'jpg' should work as well.

Cheers, Moritz

leeclemnet commented 7 years ago

Can you give me an example of why you would want to load JPG files in pykitti.raw? The raw KITTI images are all encoded as PNG.

kampelmuehler commented 7 years ago

True, in some cases it might be beneficial to save memory though by converting the raw data to .jpg.

Just an idea though.

leeclemnet commented 7 years ago

Alright, it's a minor enough modification that I don't mind making it. You can now pass imtype='jpg' to the raw and odometry constructors. See https://github.com/utiasSTARS/pykitti/commit/838221796cde5d8218f4d6222991abf9936db3b6.

I've updated the package on PyPI as well.