This code is usefull for grabbing RGB and depth data from BAG file of ros in python and C++
The Python Code saves in both jpg and numpy pickle. Where as the C++ Code saves only in jpg
cd src/bag2rgbdepth/scripts/
Arange the bag files in diffrent folders for each bag file as below
step 1: Run ros.sh using sh ros.sh
on one terminal
step 2: Open another terminal and run sh truedepthandrgb.sh
step 3: Wait
The folder strcture now will be
First you will need to build the code
Open launch file in launch
folder
vim Bag_to_Depth/src/bag2rgbdepth/launch/extractbag_to_rgbd.launch
Edit the line where it says
<param name="folder_extract_location" value="./"/>
Change the value
to the folder where you need to extract the images. The code will add the rgb and depth files.
Excute the below bash script
cd Bag_to_Depth/
catkin_make
source devel/setup.bash
roslaunch bag2rgbdepth extractbag_to_rgbd.launch
Meanwhile in another terminal run these two commands
roscore &
rosbag play bagfile1.bag
The folder strcture now will be