Skip to content

Made compressed image handling smoother, removed hardcoding#40

Open
seantfish wants to merge 5 commits intomlaiacker:masterfrom
gt-marine-robotics-group:master
Open

Made compressed image handling smoother, removed hardcoding#40
seantfish wants to merge 5 commits intomlaiacker:masterfrom
gt-marine-robotics-group:master

Conversation

@seantfish
Copy link

@seantfish seantfish commented Oct 10, 2024

Hi, I added handling for compressed images that does not involve hardcoding. Hardcoding for video rendering of Image types was also fixed. Topic name argument should work now. Also made images be saved in a separate directory to reduce likelihood of unintended deletion of existing png images. Added a flag to save images.

@cardboardcode cardboardcode self-assigned this Oct 10, 2024
@cardboardcode
Copy link
Collaborator

Thank you for the Pull Request. Will test this once my bandwidth allows me, probably this weekend or the next.

@seantfish
Copy link
Author

seantfish commented Oct 10, 2024

This should address #36 and #38 as the script hanging behavior is consistent with the hardcoded topics, and address #37 by enabling regular Image to mp4.

One limitation to note is that I am testing with CompressedImage files which have a reference to the encoding in the format field, which is not standard. I have not tested with those that specify only compression format, but that should be addressable with additional flags or elif cases.

@cardboardcode
Copy link
Collaborator

The script hanging behaviour as captured in the 2 aforementioned issues is unfortunately still not resolved with the modifications introduced.

Steps To Reproduce 📚

  1. Create ros2 bag file:
cd $HOME
git clone https://github.com/cardboardcode/virtual_camera.git --depth 1 --single-branch && cd virtual_camera
  1. Download this test.mp4 and place it in ~/virtual_camera/data/
test.mp4
cd ~/virtual_camera/data && ln -sf test.mp4 input_data
cd ~/virtual_camera && bash scripts/0_build_docker_image.bash
bash scripts/1_create_docker_container.bash

This publishes test.mp4 as ROS messages on ROS 2 topic /virtual_camera/image_raw

  1. Set up rosbag2video:
cd $HOME && git clone https://github.com/gt-marine-robotics-group/rosbag2video.git --branch master --depth 1 --single-branch && cd rosbag2video
  1. Record ros2 bag for about 10 seconds:
source /opt/ros/humble/setup.bash && ros2 bag record /virtual_camera/image_raw
python3 ros2bag2video.py -t /virtual_camera/image_raw <generated_rosbag2_bag_file_folder_name>

Expected Behaviour 🟢

Script does not hang and generates output.mp4.

Actual Behaviour 🔴

Script still hangs.

@seantfish
Copy link
Author

I will look into this when I get a chance, thanks!

@mlaiacker
Copy link
Owner

nice to see some activity. thanks for the pull requests.

@cardboardcode cardboardcode self-requested a review August 16, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants