Skip to content

PenceMataria/ros-virtual-cam

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ros-virtual-cam Build Status Coverage Status

ROS node for streaming an image topic to a video capture device. Mostly based on this:

dev

Setup a workspace:

cd ~/catkin_ws/src  # or wherever catkin_ws is
git clone https://github.com/lucasw/ros-virtual-cam
cd ..
catkin build virtual_cam

video devices

Stream node needs to write to a video capture device, which varies depending on your system.

linux

Uses v4l2-loopback:

$ sudo apt-get install v4l2loopback-*
$ sudo modprobe v4l2loopback video_nr=1
$ v4l2-ctl -D -d /dev/video1
Driver Info (not using libv4l2):
    Driver name   : v4l2 loopback
    Card type     : Dummy video device (0x0000)
    Bus info      : v4l2loopback:0
    Driver version: 0.8.0
    Capabilities  : 0x05000003
        Video Capture
        Video Output
        Read/Write
        Streaming

usage

stream

Typically just:

$ rosrun virtual_cam stream _device:=/dev/video1 _width:=640 _height:=480 _fourcc:=YV12 image:=/my_camera/image

where:

  • /dev/video1 target device
  • 640x480 target size
  • YV12 target pixel format
  • /my_camera/image the source sensor_msgs/Image topic re-mapped to image

For more:

$ rosrun virtual_cam stream --help

tests

$ v4l2-ctl -D -d /dev/video1
Driver Info (not using libv4l2):
    Driver name   : v4l2 loopback
    Card type     : Dummy video device (0x0000)
    Bus info      : v4l2loopback:0
    Driver version: 0.8.0
    Capabilities  : 0x05000003
        Video Capture
        Video Output
        Read/Write
        Streaming
$ ROS_VIRTUAL_CAM_STREAM_TEST_DEVICE=/dev/video1 catkin_make run_tests

If you want coverage:

$ catkin_make -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON
$ ROS_VIRTUAL_CAM_STREAM_TEST_DEVICE=/dev/video1 catkin_make run_tests
$ lcov --path . --directory . --capture --output-file coverage.info
$ lcov --remove coverage.info 'tests/*' '/usr/*' '/opt/*' --output-file coverage.info
$ lcov --list coverage.info

TODO(lucasw) update above for catkin build

About

Stream ROS image topics to video capture devices.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 63.3%
  • CMake 21.9%
  • Python 14.8%