usb_cam icon indicating copy to clipboard operation
usb_cam copied to clipboard

About video compression

Open hxj0316 opened this issue 3 years ago • 16 comments

Hello, I would like to ask where is the code related to video compression in this program? I want to try to make changes in the source code of ros2.

hxj0316 avatar Aug 08 '21 09:08 hxj0316

so there is no code within this repo for compression yet.

future work would be to use image_transport publisher and subscriber to do this internally.

you can however use a plugin from image_transport to accomplish this.

check out the tutorial at the end of this README on how to do this. I haven tried this out yet myself though so not sure if it does actually work.

flynneva avatar Aug 08 '21 13:08 flynneva

Oh, thank you very much for replying to me. I also tried the methods mentioned in the document you mentioned, but I encountered some problems as shown in the figure. I seem to have some problems when executing ros2 run v4l2_camera v4l2_camera_compose_test. Hope you can give me a little help, thank you very much~ 2021-08-08 20-19-30 的屏幕截图 2021-08-08 20-19-48 的屏幕截图

hxj0316 avatar Aug 08 '21 13:08 hxj0316

ok so not sure what that error is (incorrect parameter maybe?) but if this is a required feature that you need I can try and add it to this repo.

all that we should have to do is switch over to use image_transport publishers instead of the vanilla rclcpp::Publishers.

you can see how they do it in the linked package above on this line

flynneva avatar Aug 08 '21 14:08 flynneva

give me a few days and I'll add it to this package

flynneva avatar Aug 08 '21 14:08 flynneva

actually it looks like it is already supported....just missing the "plugins" package.

install it with sudo apt install ros-galactic-image-transport-plugins on ubuntu, and rerun the usb_cam package and you should see the compressed topics.

rviz2 doesnt support visualization of them yet I think so you may not be able to visualized the compressed topics yet.

flynneva avatar Aug 08 '21 14:08 flynneva

on my machine using usb_cam after installing image_transport_plugins:

ros2 topic list
/camera_info
/image_raw
/image_raw/compressed
/image_raw/compressedDepth
/image_raw/theora
/parameter_events
/rosout

flynneva avatar Aug 08 '21 14:08 flynneva

Did you report an error when you executed this command?ros2 run v4l2_camera v4l2_camera_node

hxj0316 avatar Aug 08 '21 14:08 hxj0316

Did you report an error when you executed this command?ros2 run v4l2_camera v4l2_camera_node

no, dont use v4l2_camera, just use this package usb_cam as before after installing the image_transport_plugins package.

  1. sudo apt install ros-galactic-image-transport-plugins
  2. sudo apt install ros-galactic-usb-cam
  3. ros2 run usb_cam usb_cam_node_exe

and you should see the compression topics shown above when you run ros2 topic list

flynneva avatar Aug 08 '21 14:08 flynneva

Oh, thank you very much, it does take effect, but I can see the topic as shown in the picture using ros2 topic list, but it is not in rviz2. What is the reason? 2021-08-08 22-35-13 的屏幕截图 2021-08-08 22-34-51 的屏幕截图

hxj0316 avatar Aug 08 '21 14:08 hxj0316

i dont think rviz2 uses image_transport just yet. im sure someone is probably working on that somewhere.

flynneva avatar Aug 08 '21 14:08 flynneva

In this case, how should I use compressed topics?

hxj0316 avatar Aug 08 '21 14:08 hxj0316

I need to use this node for image transmission between multiple devices. If I can’t subscribe to this topic, I don’t know how to call it. The data volume of the original topic is too large, and the image transmission will be stuck. I use the command to check that the compressed topic occupies a very small bandwidth, but my previous work will be invalid if I can't subscribe to this topic.

hxj0316 avatar Aug 08 '21 14:08 hxj0316

you can transport it compressed but then to visualize it on the other end use the image_transport plugin to uncompress it:

ros2 run image_transport republish compressed in/compressed:=image_raw/compressed raw out:=image_raw/uncompressed

flynneva avatar Aug 08 '21 15:08 flynneva

ive created an issue over on the rviz repo to track this topic

flynneva avatar Aug 08 '21 15:08 flynneva

OK,thank you very much.i will try it tomorrow,because it's very late in my country .thank you.

---Original--- From: "Evan @.> Date: Sun, Aug 8, 2021 23:04 PM To: @.>; Cc: @.@.>; Subject: Re: [ros-drivers/usb_cam] About video compression (#166)

ive created an issue over on the rviz repo to track this topic

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

hxj0316 avatar Aug 08 '21 15:08 hxj0316

Sorry, I don’t think I picked up your meaning, how can I use the image_transport plugin to decompress it? I executed your instructions above, and the result was an error. 2021-08-09 11-47-08 的屏幕截图

hxj0316 avatar Aug 09 '21 03:08 hxj0316

Closing this issue as inactive

flynneva avatar Apr 09 '23 01:04 flynneva