Hello everyone I am trying make a bag file of rgb images and depth images that are saved in .mat file (h5py fomat), in Ubuntu 16.04 and ROS kinetic with pycharm IDE.
import pyrosbag
import h5py
import numpy as np
path_to_depth = '/home/maq/PycharmProjects/ROS_bagfile/test.mat'
f = h5py.File(path_to_depth)
img = f['rgb_undist'][1]
img_ = np.empty([480, 640, 3])
img_[:, :, 0] = img[0, :, :].T
img_[:, :, 1] = img[1, :, :].T
img_[:, :, 2] = img[2, :, :].T
img__ = img_.astype('float32')
bag = pyrosbag.Bag('test.bag')
pyrosbag.BagPlayer.play()
But ther is error on the play command, I have taken help from [here](https://pyrosbag.readthedocs.io/en/latest/pyrosbag.html).
Error is
/usr/bin/python2.7 /home/maq/PycharmProjects/ROS_bagfile/ros_bagfile.py
Traceback (most recent call last):
File "/home/maq/PycharmProjects/ROS_bagfile/ros_bagfile.py", line 22, in
pyrosbag.BagPlayer.play()
TypeError: unbound method play() must be called with BagPlayer instance as first argument (got nothing instead)
Process finished with exit code 1
Can anyone help me with this or guide me with some other effective method that could be done in pycharm.
Regards.
↧