jmscslgroup / bagpy

Python package for reading, and extracting data from rosbag files and performing any analysis on it.
https://jmscslgroup.github.io/bagpy/
Other
202 stars 39 forks source link

Unable to load .bag data generated by RealSense Viewer app - rosbag.bag.ROSBagException: unsupported compression type: lz4 #7

Closed DustinReagan closed 3 years ago

DustinReagan commented 3 years ago

Windows 10 python 3.7.7

code:

from bagpy import bagreader
import bagpy

b = bagreader(r'C:\Users\Dustin\Documents\20210226_142402.bag')
image_data = b.message_by_topic(r'/device_0/sensor_0/Depth_0/image/data')

output:

[INFO] Data folder C:\Users\Dustin\Documents\20210226_142402 already exists. Not creating. Traceback (most recent call last): File "src\utils\bag\load_bag.py", line 5, in <module> image_data = b.message_by_topic(r'/device_0/sensor_0/Depth_0/image/data') File "C:\Users\Dustin\miniconda3\envs\x-ray\lib\site-packages\bagpy\bagreader.py", line 266, in message_by_topic for topic, msg, t in self.reader.read_messages(topics=topic, start_time=tstart, end_time=tend): File "C:\Users\Dustin\miniconda3\envs\x-ray\lib\site-packages\rosbag\bag.py", line 2699, in read_messages yield self.seek_and_read_message_data_record((entry.chunk_pos, entry.offset), raw, return_connection_header) File "C:\Users\Dustin\miniconda3\envs\x-ray\lib\site-packages\rosbag\bag.py", line 2833, in seek_and_read_message_data_record raise ROSBagException('unsupported compression type: %s' % chunk_header.compression) rosbag.bag.ROSBagException: unsupported compression type: lz4

relevant lines from pip list:

bagpy                         0.4.4
lz4                           3.1.3

Any tips would be appreciated.

rahulbhadani commented 3 years ago

Thanks, @DustinReagan for you using bagpy. It looks like you are trying to decode images which is currently not supported. Further, I am not sure if it is being caused because you are using windows. I am not a Windows user and I do not have access to the Windows system to test bagpy.

DustinReagan commented 3 years ago

Thanks for responding. Do you have any advice on the best way to read/deserialize image data from bag files, preferably in python?

rahulbhadani commented 3 years ago

Not in python, but I do have an implementation in MATLAB for extracting images.

You can check the GitHub repo: https://github.com/jmscslgroup/ROSBagreader which is not generic but have only a few specialized functions, one of them is extractCompressedImages.