Giter VIP home page Giter VIP logo

video_stream_opencv's Introduction

video_stream_opencv

A package to view video streams based on the OpenCV VideoCapture module, easy way to publish on a ROS Image topic (including camera info) usb cams, ethernet cameras, video streams or video files. It also supports flipping of images and fps throttling.

Screenshot of the plugin working with a webcam, video stream and video file

Example usages in launch folder (only the argument video_stream_provider is mandatory):

<launch>
   <!-- launch video stream -->
   <include file="$(find video_stream_opencv)/launch/camera.launch" >
        <!-- node name and ros graph name -->
        <arg name="camera_name" value="webcam" />
        <!-- means video device 0, /dev/video0 -->
        <arg name="video_stream_provider" value="0" />
        <!-- set camera fps to (if the device allows) -->
        <arg name="set_camera_fps" value="30"/>
        <!-- set buffer queue size of frame capturing to -->
        <arg name="buffer_queue_size" value="100" />
        <!-- throttling the publishing of frames to -->
        <arg name="fps" value="30" />
        <!-- setting frame_id -->
        <arg name="frame_id" value="webcam" />
        <!-- camera info loading, take care as it needs the "file:///" at the start , e.g.:
        "file:///$(find your_camera_package)/config/your_camera.yaml" -->
        <arg name="camera_info_url" value="" />
        <!-- flip the image horizontally (mirror it) -->
        <arg name="flip_horizontal" value="false" />
        <!-- flip the image vertically -->
        <arg name="flip_vertical" value="false" />
        <!-- force a width and height, 0 means no forcing -->
        <arg name="width" value="640"/>
        <arg name="height" value="480"/>
        <!-- visualize on an image_view window the stream generated -->
        <arg name="visualize" value="true" />
   </include>
</launch>

Based on the ROS tutorial to convert opencv images to ROS messages.

Usability

You can use any input that OpenCV on your system accepts, e.g.:

  • Video devices that appear in linux as /dev/videoX, e.g.: USB webcams appearing as /dev/video0

  • Video streamings, e.g.: rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov

  • Video files, anything you can play, e.g.: myvideo.avi

  • Etc.

Parameters

Note these important ones on the behaviour of the node:

  • set_camera_fps: Will set the OpenCV parameter CV_CAP_PROP_FPS to that amount of fps, if the camera allows it. Does nothing on video streams or video files.

  • buffer_queue_size: Will set the size of the buffer of images read from the capturing device. We read as fast as possible (in another thread) from the device and store in the buffer the images. The main thread consumes from the buffer. If you want the shortest delay/lag set it to 1. If you don't want to lose images set it higher.

  • fps: The effective rate at which you want the image topic to publish, if lower than the effective fps of the camera it will throttle the publication dropping frames when needed.

So if you want the very latest image published from a camera, set buffer_queue_size to 1, set_camera_fps to the max the camera allows and fps to that same max.

If you want to publish all images (don't drop any and you don't mind some possible delay from real time), set buffer_queue_size big enough for your case (1000?), set_camera_fps and fps to whatever FPS it has.

The rest of the parameters explained, even though they are pretty self explanatory:

  • camera_name: node name and ros graph name. All topics will hang from this e.g.: /camera_name/.
  • video_stream_provider: A number for the /dev/videoX device, e.g.: 0 for /dev/video0. A string for a path for a video file, e.g.: /home/user/Videos/myvideo.avi or a url of a video stream e.g.: rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov and http://10.68.0.6/mjpg/video.mjpg.
  • frame_id: frame_id to be published in the Header of the messages.
  • camera_info_url: camera info loading, take care as it needs the "file:///" at the start , e.g.: "file:///$(find your_camera_package)/config/your_camera.yaml".
  • flip_horizontal: flip horizontally the image (mirror it).
  • flip_vertical: flip vertically the image (upside down).
  • loop_videofile: if the provider is a video file, enable loop playback.
  • width and height: force a width and height to the capturing device (if it allows), 0 means no forcing.
  • start_frame: if the provider is a video file, set the start frame of video.
  • stop_frame: if the provider is a video file, set the stop frame of video. -1 means the end of the video. Also setting stop_frame = start_frame + 1 can publish a single frame with a certain rate.

Extras

In the scripts folder you'll find test_video_resource.py which you can use to test if your system installation can use this node to open your video stream (not using any ROS, just copy the file to your computer and try). Just do any of those:

./test_video_resource.py 0
./test_video_resource.py rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
./test_video_resource.py /home/youruser/myvideo.mkv

And you'll see an output like:

Trying to open resource: /dev/video0
Correctly opened resource, starting to show feed.

With an OpenCV image show window showing the stream (which should close when pressing ESC, or Control+C the shell).

video_stream_opencv's People

Contributors

aviogit avatar awesomebytes avatar axel13fr avatar furushchev avatar garaemon avatar gitai-dev01 avatar iory avatar jendker avatar leoll2 avatar machinekoder avatar mjsobrep avatar senden9 avatar tim-fan avatar tongtybj avatar wiebevr avatar zchen24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

video_stream_opencv's Issues

Selecting pixel format

Is there a way to select the v4l2 cameras pixel format when starting the opencv stream?

It looks like it selects the uncompressed stream per default on my device, which rather slow at 1080p even with USB 3.0.

camera.launch image_view error

Error occurs when the visualization is set to TRUE. How could I resolve this? Thanks for the help.

image

I'm using ROS Melodic with Python 3 and OpenCV2 vers. 3.2.0.

Loop videofile doesn't seem to work

Hi!

When I'm trying to use loop_videofile to loop the video I'm trying to publish, the end_frame parameter doesn't seem like it's properly changing after the subscribe method. When I check inside that method, the end_frame is correctly set from -1 to 2259, but when I try to test this within the do_capture method, the end_frame value is not changed to 2259.

It like when the private variable config is assigned to latest_config inside the subscribe method, it is just copied, and all change is therefore dropped.

Please tell me if and how I should include more relevant information if necessary.

'Could not capture frame' error when 'stop_frame' is -1

Hi

When stop_frame is set to -1, capturing the stream leads to the following error:

[ERROR] [1589731616.096380328]: Could not capture frame
[ERROR] [1589731616.129171038]: Could not capture frame
[ERROR] [1589731616.162531012]: Could not capture frame
[ERROR] [1589731616.195890605]: Could not capture frame
[ERROR] [1589731616.229178206]: Could not capture frame

as I briefly reported here: ros-perception/image_pipeline#516 (comment)_

Here's the result of a quick investigation. This line handles the case when stop_frame == -1: https://github.com/ros-drivers/video_stream_opencv/blob/master/src/video_stream.cpp#L244

where latest_config is a copy of config. But https://github.com/ros-drivers/video_stream_opencv/blob/master/src/video_stream.cpp#L140 expects a meaningful value of stop_frame.

I've managed to avoid the error by making latest_config a VideoStreamConfig*, but I'm not sure if that'll produce unintended effects.

SIGSEGV (Segfault) in image_view

I've had to upgrade ROS from kinetic to melodic due to the repositories being shut down. So, previously, on kinetic, I've had no problem running video_stream_opencv straight out of the box without any problems, at least for the webcam. However, come to melodic, it seems that image_view always triggers a SIGSEGV (segfault) and dies.

aytimothy@ubuntu:~$ roslaunch video_stream_opencv webcam.launch
... logging to /home/aytimothy/.ros/log/3c846264-8cdc-11ea-9c80-dca63244e983/roslaunch-ubuntu-28435.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu:38679/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.5
 * /webcam/webcam_stream/buffer_queue_size: 1
 * /webcam/webcam_stream/camera_info_url: 
 * /webcam/webcam_stream/camera_name: webcam
 * /webcam/webcam_stream/flip_horizontal: False
 * /webcam/webcam_stream/flip_vertical: False
 * /webcam/webcam_stream/fps: 30.0
 * /webcam/webcam_stream/frame_id: webcam_optical_frame
 * /webcam/webcam_stream/height: 0
 * /webcam/webcam_stream/loop_videofile: False
 * /webcam/webcam_stream/set_camera_fps: 30.0
 * /webcam/webcam_stream/video_stream_provider: 0
 * /webcam/webcam_stream/width: 0

NODES
  /webcam/
    webcam_image_view (image_view/image_view)
    webcam_stream (video_stream_opencv/video_stream)

ROS_MASTER_URI=http://localhost:11311

process[webcam/webcam_stream-1]: started with pid [28451]
process[webcam/webcam_image_view-2]: started with pid [28452]
[ INFO] [1588472410.274417096]: Resource video_stream_provider: 0
[ INFO] [1588472410.278582490]: Getting video from provider: /dev/video0
[ INFO] [1588472411.128208668]: Video stream provider type detected: videodevice
[ INFO] [1588472411.131100702]: Camera name: webcam
[ INFO] [1588472411.134295054]: Setting camera FPS to: 30
[ INFO] [1588472411.203305255]: Camera reports FPS: 25
[ INFO] [1588472411.207589551]: Setting buffer size for capturing frames to: 1
[ INFO] [1588472411.211263970]: Throttling to fps: 30
[ INFO] [1588472411.215136713]: Publishing with frame_id: webcam_optical_frame
[ INFO] [1588472411.220204134]: Provided camera_info_url: ''
[ INFO] [1588472411.227309579]: Flip horizontal image is: false
[ INFO] [1588472411.233874274]: Flip vertical image is: false
[ INFO] [1588472411.246008345]: using default calibration URL
[ INFO] [1588472411.246228408]: camera calibration URL: file:///home/aytimothy/.ros/camera_info/webcam.yaml
[ INFO] [1588472411.246496505]: Unable to open camera calibration file [/home/aytimothy/.ros/camera_info/webcam.yaml]
[ WARN] [1588472411.246620369]: Camera calibration file /home/aytimothy/.ros/camera_info/webcam.yaml not found.
[ INFO] [1588472411.246728011]: Opened the stream, starting to publish.
[ WARN] [1588472412.115673857]: No calibration file given, publishing a reasonable default camera info.
[ INFO] [1588472412.115804609]: The image width is: 640
[ INFO] [1588472412.115878291]: The image height is: 480
[webcam/webcam_image_view-2] process has died [pid 28452, exit code -11, cmd /opt/ros/melodic/lib/image_view/image_view image:=image_raw __name:=webcam_image_view __log:=/home/aytimothy/.ros/log/3c846264-8cdc-11ea-9c80-dca63244e983/webcam-webcam_image_view-2.log].
log file: /home/aytimothy/.ros/log/3c846264-8cdc-11ea-9c80-dca63244e983/webcam-webcam_image_view-2*.log

I'm not sure what is going on, because I have had my /dev/video0 available for user read/write and cheese seems to be able to open it fine without having the need to be sudo'd.

This is the stacktrace that was outputted by the crash detector:

Stacktrace:
 #0  0x0000ffffb4040978 in cvConvertImage () at /usr/lib/aarch64-linux-gnu/libopencv_imgcodecs.so.3.2
 #1  0x0000ffffb4017aa4 in  () at /usr/lib/aarch64-linux-gnu/libopencv_highgui.so.3.2
 #2  0x0000ffffb4019d04 in cvShowImage () at /usr/lib/aarch64-linux-gnu/libopencv_highgui.so.3.2
 #3  0x0000ffffb40168dc in cv::imshow(cv::String const&, cv::_InputArray const&) () at /usr/lib/aarch64-linux-gnu/libopencv_highgui.so.3.2
 #4  0x0000ffffb42d7b58 in image_view::ImageNodelet::windowThread() () at /opt/ros/melodic/lib//libimage_view.so
 #5  0x0000ffffb86cbfe8 in  () at /usr/lib/aarch64-linux-gnu/libboost_thread.so.1.65.1
 #6  0x0000ffffb8695088 in start_thread (arg=0xffffe915e65f) at pthread_create.c:463

I don't think it's any help, but the logs files mentioned in the console output are both empty.

Publish stereo cameras or video files

Hello,

I am new with ROS. I am using this package to publish video files as image topic to ROS and it works really well.

I just wonder, is it possible to publish stereo video files (synchronized) with this package? As I have two seperate video files from left and right cameras.

Thanks!

Unable to open V4L devices by device node other than /dev/videoN

Sometimes it would be beneficial to open the video devices with other device node than the /dev/videoN because udev populates the /dev/v4l/by-id entries like:
/dev/v4l/by-id/usb-CN0CJ3PDPA01_Laptop_Integrated_Webcam_FHD-video-index0

Using these device nodes eliminates the necessity of plugging the cameras in specified order to specified ports in a robot which has multiple USB cameras.

Unfortunately if I pass such a device path as a string I got "Could not open the stream." error.

I have checked the OpenCV code, but unfortunately the OpenCV 2.4.8.3 which is shipped with the Ubuntu 14.04 does not had any feature to specify the V4L2 device manually.

Lately an open method with an apiReference argument added see:
opencv/opencv@41d8c4d

Any suggestions would be highly appreciated with this issue

Publishing Images

Hello,

publish

I am trying to calibrate my camera using the Kalibr Toolbox and utilizing the video_stream_opencv to record a ROS bag. I am trying to achieve a publish rate of about 2 images per 0.01 seconds while also accounting for the delay from converting the images to grayscale. Here is an image above from an example dataset from Kalibr that shows what I am trying to do. What values do I need to modify in the launch file to achieve a similar publish rate as shown above?

Or better yet, are there any other ROS nodes that publishes images in grayscale w/o delay?

Select Timeout Issue When Testing

After installing, and running ./test_video_resource.py 0
I get the errors below, any ideas? I am using a SainSmart IMX219 Camera Module on Jetson Nano.

Trying to open resource: /dev/video0
Correctly opened resource, starting to show feed.
select timeout
select timeout
OpenCV Error: Assertion failed (total() == 0 || data != NULL) in Mat, file /build/opencv-XDqSFW/opencv-3.2.0+dfsg/modules/core/include/opencv2/core/mat.inl.hpp, line 431
Traceback (most recent call last):
File "./test_video_resource.py", line 43, in
rval, frame = cap.read()
cv2.error: /build/opencv-XDqSFW/opencv-3.2.0+dfsg/modules/core/include/opencv2/core/mat.inl.hpp:431: error: (-215) total() == 0 || data != NULL in function Mat

Dynamic Reconfiguration Does not Work

I checked the cfg file for dynamic reconfiguration. However, when I run let's say

rosrun dynamic_reconfigure dynparam get /videofile/videofile_image_view

I get the following output:

{'max_image_value': 0.0, 'min_image_value': 0.0, 'do_dynamic_scaling': False, 'groups': {'colormap': -1, 'parent': 0, 'min_image_value': 0.0, 'groups': {}, 'id': 0, 'do_dynamic_scaling': False, 'name': 'Default', 'parameters': {}, 'max_image_value': 0.0, 'state': True, 'type': ''}, 'colormap': -1}

However, parameters you added to config file is totally different than these parameters. How can I change the parameters in config?

My goal is to play different videos (mp4) from ROS network. I managed to do that with roslaunch and changing video_stream_provider argument, but I want to do this dynamically.

Can't set FPS more than 30

Hi, I am using a PS3 camera. I am able to stream the video about 60 fps by OpenCV. In launch file when I set FPS to any number lower than 30 it's true but for any number more than 30 FPS (fore example 40) the output is 30 FPS

ROSNode crashes after connecting from web_video_server ROSNode

My Configuration -

  1. Have started one web_video_server which is used for publish ROS video topic to browser using link
  2. Have started one video_stream_opencv ROSNode using roslaunch
  3. Able to see ros video topic link in browser

Issue : when I click on link one request goes to web_video_server node to get Particular topic video/ image but the video_stream_opencv node crashes in 1 sec also doe not provide any log error.

Q. Do we need to have some video player to get video ?
Q. Does video_stream_opencv able to stream video ?

Note: I am using "http://wiki.ros.org/video_stream_opencv" example. I have also tested without web_video_server what is provided in the example visualize=true, but no luck.

LOG-
SUMMARY

PARAMETERS

  • /videoe6/videoe6_stream/buffer_queue_size: 890
  • /videoe6/videoe6_stream/camera_info_url:
  • /videoe6/videoe6_stream/camera_name: videoe6
  • /videoe6/videoe6_stream/flip_horizontal: False
  • /videoe6/videoe6_stream/flip_vertical: False
  • /videoe6/videoe6_stream/fps: 25.0
  • /videoe6/videoe6_stream/frame_id: videoe4
  • /videoe6/videoe6_stream/height: 100
  • /videoe6/videoe6_stream/loop_videofile: True
  • /videoe6/videoe6_stream/set_camera_fps: 35.0
  • /videoe6/videoe6_stream/video_stream_provider: /bbb-360p.mp4
  • /videoe6/videoe6_stream/width: 100
  • /rosdistro: kinetic
  • /rosversion: 1.12.13

NODES
/videoe6/
videoe6_stream (video_stream_opencv/video_stream)

ROS_MASTER_URI=http://localhost:11311

process[videoe6/videoe6_stream-1]: started with pid [53162]
[ INFO] [1549452087.564457100]: Resource video_stream_provider: /bbb-360p.mp4
[ INFO] [1549452087.564543000]: Getting video from provider: /bbb-360p.mp4
[ INFO] [1549452087.572626100]: Video stream provider type detected: videofile
[ INFO] [1549452087.576083700]: Camera name: videoe6
[ INFO] [1549452087.579046500]: Setting camera FPS to: 35
[ INFO] [1549452087.579101800]: Camera reports FPS: 24
[ INFO] [1549452087.583555900]: Setting buffer size for capturing frames to: 890
[ INFO] [1549452087.589854200]: Throttling to fps: 25
[ INFO] [1549452087.594140100]: Publishing with frame_id: videoe4
[ INFO] [1549452087.598559800]: Provided camera_info_url: ''
[ INFO] [1549452087.605323400]: Flip horizontal image is: false
[ INFO] [1549452087.608432000]: Flip vertical image is: false
[ INFO] [1549452087.625571900]: Forced image width is: 100
[ INFO] [1549452087.625615800]: Forced image height is: 100
[ INFO] [1549452087.633463000]: using default calibration URL
[ INFO] [1549452087.633532000]: camera calibration URL: file:///root/.ros/camera_info/videoe6.yaml
[ INFO] [1549452087.634625900]: Unable to open camera calibration file [/root/.ros/camera_info/videoe6.yaml]
[ WARN] [1549452087.634663200]: Camera calibration file /root/.ros/camera_info/videoe6.yaml not found.
[ INFO] [1549452087.634718900]: Opened the stream, starting to publish.
[ WARN] [1549452159.435056700]: No calibration file given, publishing a reasonable default camera info.
[ INFO] [1549452159.435117500]: The image width is: 640
[ INFO] [1549452159.435171800]: The image height is: 360
[videoe6/videoe6_stream-1] process has died [pid 53162, exit code -11, cmd /opt/ros/kinetic/lib/video_stream_opencv/video_stream camera:=image __name:=videoe6_stream __log:=/root/.ros/log/8ff4d67e-29f8-11e9-9eb4-0242ac120002/videoe6-videoe6_stream-1.log].
log file: /root/.ros/log/8ff4d67e-29f8-11e9-9eb4-0242ac120002/videoe6-videoe6_stream-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done

missing calibration and camera_model yaml param not read

Hi,

I've used this node to publish RTSP to a ROS topic in order to calibrate the camera using ROS camera_calibrate node. Calibration generated the following yaml output below. However, upon loading this calibration file a warning is logged that it couldn't find the distortion_model parameter in the yaml, however that should be listed as camera_model, at least in ROS melodic.

Also, when camera_calibration writes the yaml output, this node has told it the incorrect height of 360. I filed a separate issue for this, but I've verified it still persists even if I launch this node with a dummy yaml config file (all distortion set to 1) with height config'd as 480 (the resulting calibration file still outputs 360)

image_width: 640
image_height: 480  # this value incorrectly set to 360
camera_name: rugged_hd_ip
camera_matrix:
  rows: 3
  cols: 3
  data: [ 543.2134 ,    0.     ,  321.01119,
            0.     ,  543.06716,  190.99665,
            0.     ,    0.     ,    1.     ]
camera_model: plumb_bob # this node expects "distortion_model"
distortion_coefficients:
  rows: 1
  cols: 5
  data: [-0.480672, 0.184891, -0.001901, 0.002792, 0.000000]
rectification_matrix:
  rows: 3
  cols: 3
  data: [ 1.,  0.,  0.,
          0.,  1.,  0.,
          0.,  0.,  1.]
projection_matrix:
  rows: 3
  cols: 4
  data: [ 429.48141,    0.     ,  325.60516,    0.     ,
            0.     ,  512.12939,  191.97364,    0.     ,
            0.     ,    0.     ,    1.     ,    0.     ]

Without calibration:
without_cal

With calibration (if I change camera_model to distortion_model):

roslaunch video_stream_opencv camera.launch video_stream_provider:=rtsp://192.168.1.1:554/h264 camera_info_url:='file:////root/git/adas/rugged_hd_ip_cal.yaml' width:=640 height:=480 camera_name:=rugged_hd_ip

with_cal

Install problem

I try to install video_stream_opencv . when I use 'catkin_make' ,it shows errors:
`Base path: /home/deemo/catkin_mpl
Source space: /home/deemo/catkin_mpl/src
Build space: /home/deemo/catkin_mpl/build
Devel space: /home/deemo/catkin_mpl/devel
Install space: /home/deemo/catkin_mpl/install

Running command: "make cmake_check_build_system" in "/home/deemo/catkin_mpl/build"

-- Using CATKIN_DEVEL_PREFIX: /home/deemo/catkin_mpl/devel
-- Using CMAKE_PREFIX_PATH: /home/deemo/catkin_mpl/devel;/opt/ros/kinetic
-- This workspace overlays: /home/deemo/catkin_mpl/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/deemo/catkin_mpl/build/test_results
-- Found gmock sources under '/usr/src/gmock': gmock will be built
-- Found gtest sources under '/usr/src/gmock': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.14
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 1 packages in topological order:
-- ~~ - video_stream_opencv
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'video_stream_opencv'
-- ==> add_subdirectory(video_stream_opencv)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/deemo/catkin_mpl/build

Running command: "make -j1 -l1" in "/home/deemo/catkin_mpl/build"

Scanning dependencies of target video_stream_node
[ 20%] Building CXX object video_stream_opencv/CMakeFiles/video_stream_node.dir/src/video_stream_node.cpp.o
[ 40%] Linking CXX executable /home/deemo/catkin_mpl/devel/lib/video_stream_opencv/video_stream
[ 40%] Built target video_stream_node
Scanning dependencies of target video_stream_opencv
[ 60%] Building CXX object video_stream_opencv/CMakeFiles/video_stream_opencv.dir/src/video_stream.cpp.o
/home/deemo/catkin_mpl/src/video_stream_opencv/src/video_stream.cpp:52:51: fatal error: video_stream_opencv/VideoStreamConfig.h: No such file or directory
compilation terminated.
video_stream_opencv/CMakeFiles/video_stream_opencv.dir/build.make:62: recipe for target 'video_stream_opencv/CMakeFiles/video_stream_opencv.dir/src/video_stream.cpp.o' failed
make[2]: *** [video_stream_opencv/CMakeFiles/video_stream_opencv.dir/src/video_stream.cpp.o] Error 1
CMakeFiles/Makefile2:1827: recipe for target 'video_stream_opencv/CMakeFiles/video_stream_opencv.dir/all' failed
make[1]: *** [video_stream_opencv/CMakeFiles/video_stream_opencv.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j1 -l1" failed
`
I have installed successfully , but this time failed.
I searched the missing file but still not found.
I am wondering some changed

Docker Error Could not capture frame on Ubuntu 18.04

I have a problem with accessing the camera in docker. The video_stream_opencv is being run in docker as a root user so the access permission to the device are not an issue. Everything works fine on docker with Ubuntu 20.04 host machine but on a different computer with Ubuntu 18.04 in docker I am getting following output if I subscribe to the created camera rostopic:

started roslaunch server http://172.18.0.2:44913/

SUMMARY
========

PARAMETERS
 * /camera0/camera0_stream/buffer_queue_size: 100
 * /camera0/camera0_stream/camera_info_url: 
 * /camera0/camera0_stream/camera_name: camera0
 * /camera0/camera0_stream/flip_horizontal: False
 * /camera0/camera0_stream/flip_vertical: False
 * /camera0/camera0_stream/fps: 30.0
 * /camera0/camera0_stream/frame_id: world
 * /camera0/camera0_stream/height: 0
 * /camera0/camera0_stream/loop_videofile: False
 * /camera0/camera0_stream/set_camera_fps: 30.0
 * /camera0/camera0_stream/start_frame: 0
 * /camera0/camera0_stream/stop_frame: -1
 * /camera0/camera0_stream/video_stream_provider: 4
 * /camera0/camera0_stream/width: 0
 * /rosdistro: noetic
 * /rosversion: 1.15.9

NODES
  /camera0/
    camera0_stream (video_stream_opencv/video_stream)

auto-starting new master
process[master]: started with pid [599]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 5ab6d9ec-8b50-11eb-846a-0242ac120002
process[rosout-1]: started with pid [609]
started core service [/rosout]
process[camera0/camera0_stream-2]: started with pid [616]
[ INFO] [1616446281.084626564]: Initializing nodelet with 12 worker threads.
[ INFO] [1616446281.231082240]: Camera name: camera0
[ INFO] [1616446281.231145549]: Provided camera_info_url: ''
[ INFO] [1616446281.231181137]: Publishing with frame_id: world
[ INFO] [1616446281.231210516]: Setting camera FPS to: 30
[ INFO] [1616446281.231237541]: Throttling to fps: 30
[ INFO] [1616446281.231265247]: Setting buffer size for capturing frames to: 100
[ INFO] [1616446281.231288768]: Flip horizontal image is: false
[ INFO] [1616446281.231311911]: Flip vertical image is: false
[ INFO] [1616446281.231342150]: Video start frame is: 0
[ INFO] [1616446281.231372180]: Video stop frame is: -1
[ INFO] [1616446289.123753215]: using default calibration URL
[ INFO] [1616446289.123886318]: camera calibration URL: file:///root/.ros/camera_info/camera0.yaml
[ INFO] [1616446289.124076802]: Unable to open camera calibration file [/root/.ros/camera_info/camera0.yaml]
[ WARN] [1616446289.124140005]: Camera calibration file /root/.ros/camera_info/camera0.yaml not found.
[ INFO] [1616446289.124444183]: Opening VideoCapture with provider: /dev/video4
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (935) open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1
[ INFO] [1616446290.302166801]: Video stream provider type detected: videodevice
[ INFO] [1616446290.302266712]: Camera reports FPS: 5
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (1186) setProperty OpenCV | GStreamer warning: GStreamer: unhandled property
[ WARN:1] global ../modules/videoio/src/cap_gstreamer.cpp (1758) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Device '/dev/video4' failed during initialization
[ WARN:1] global ../modules/videoio/src/cap_gstreamer.cpp (515) startPipeline OpenCV | GStreamer warning: unable to start pipeline
[ERROR] [1616446291.852088783]: Could not capture frame (frame_counter: 0)
[ WARN] [1616446291.852207511]: Waiting for device...
[ WARN] [1616446291.952562714]: Waiting for device...
[ WARN] [1616446292.052847656]: Waiting for device...
[ WARN] [1616446292.153119626]: Waiting for device...
[ WARN] [1616446292.253407089]: Waiting for device...
[ WARN] [1616446292.353719961]: Waiting for device...
[ WARN] [1616446292.454032736]: Waiting for device...
[ WARN] [1616446292.554347708]: Waiting for device...
[ WARN] [1616446292.654681905]: Waiting for device...
[ WARN] [1616446292.754938392]: Waiting for device...
[ WARN] [1616446292.855224316]: Waiting for device...
[ WARN] [1616446292.955508793]: Waiting for device...
[ WARN] [1616446293.055815889]: Waiting for device...
[ WARN] [1616446293.156144592]: Waiting for device...
[ WARN] [1616446293.256436284]: Waiting for device...
[ WARN] [1616446293.356739560]: Waiting for device...
[ WARN] [1616446293.457051838]: Waiting for device...
[ WARN] [1616446293.557366183]: Waiting for device...
[ WARN] [1616446293.657679612]: Waiting for device...
[ WARN] [1616446293.757997069]: Waiting for device...
[ WARN] [1616446293.858312195]: Waiting for device...
[ WARN] [1616446293.958634418]: Waiting for device...
...

and sometimes after subscribing to the topic I get the following output because the device /dev/videoX disappears after I try subscribing until I reconnect the camera:

SUMMARY
========

PARAMETERS
 * /camera0/camera0_stream/buffer_queue_size: 100
 * /camera0/camera0_stream/camera_info_url: 
 * /camera0/camera0_stream/camera_name: camera0
 * /camera0/camera0_stream/flip_horizontal: False
 * /camera0/camera0_stream/flip_vertical: False
 * /camera0/camera0_stream/fps: 30.0
 * /camera0/camera0_stream/frame_id: world
 * /camera0/camera0_stream/height: 0
 * /camera0/camera0_stream/loop_videofile: False
 * /camera0/camera0_stream/set_camera_fps: 30.0
 * /camera0/camera0_stream/start_frame: 0
 * /camera0/camera0_stream/stop_frame: -1
 * /camera0/camera0_stream/video_stream_provider: 0
 * /camera0/camera0_stream/width: 0
 * /rosdistro: noetic
 * /rosversion: 1.15.9

NODES
  /camera0/
    camera0_stream (video_stream_opencv/video_stream)

auto-starting new master
process[master]: started with pid [307]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to ad187b6c-8b5c-11eb-b2bc-0242ac120002
process[rosout-1]: started with pid [317]
started core service [/rosout]
process[camera0/camera0_stream-2]: started with pid [324]
[ INFO] [1616451573.239341205]: Initializing nodelet with 12 worker threads.
[ INFO] [1616451573.380970996]: Camera name: camera0
[ INFO] [1616451573.381068189]: Provided camera_info_url: ''
[ INFO] [1616451573.381116147]: Publishing with frame_id: world
[ INFO] [1616451573.381156614]: Setting camera FPS to: 30
[ INFO] [1616451573.381193775]: Throttling to fps: 30
[ INFO] [1616451573.381251976]: Setting buffer size for capturing frames to: 100
[ INFO] [1616451573.381303064]: Flip horizontal image is: false
[ INFO] [1616451573.381349959]: Flip vertical image is: false
[ INFO] [1616451573.381394840]: Video start frame is: 0
[ INFO] [1616451573.381434548]: Video stop frame is: -1
[ INFO] [1616451577.881623925]: using default calibration URL
[ INFO] [1616451577.881734196]: camera calibration URL: file:///root/.ros/camera_info/camera0.yaml
[ INFO] [1616451577.881938309]: Unable to open camera calibration file [/root/.ros/camera_info/camera0.yaml]
[ WARN] [1616451577.882080689]: Camera calibration file /root/.ros/camera_info/camera0.yaml not found.
[ INFO] [1616451577.882399145]: Opening VideoCapture with provider: /dev/video0
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (1758) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Could not open device '/dev/video0' for reading and writing.
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ WARN:0] global ../modules/videoio/src/cap_v4l.cpp (887) open VIDEOIO(V4L2:/dev/video0): can't open camera by index
[ INFO] [1616451748.986824755]: Video stream provider type detected: videodevice
[ INFO] [1616451748.986912183]: Backend can't provide camera FPS information
[ERROR] [1616451748.986960284]: Could not open the stream

I am using the following options for running docker container:

version: "2.4"
services:
  robonet:
    build:
      context: ..
      dockerfile: ./docker/Dockerfile
    image: robonet
    container_name: robonet
    working_dir: /root
    environment:
      - DISPLAY=:0
    runtime: nvidia
    volumes:
       - /dev:/dev
    command: bash
    stdin_open: true
    tty: true
    device_cgroup_rules:
      - 'c *:* rmw'

I am able to access the camera on the machine without any problems though when I tried the x11docker, so I assume it is video_stream_opencv or (maybe?) GStreamer specific.

Please let me know if any additional information would be helpful.

Strange errors consuming RTSP h264 stream

The following error logs I get while consuming h264 RTSP stream from a visual engineering HD Rugged IP camera with the latest firmware installed. I did not run with ros DEBUG on because the debug messages that print the frame count would truncate my terminals history if left running for long enough (these errors are intermittent). The camera stays connected and I still had video feedback fortunately, though possibly the stream was interrupted briefly.

Any thoughts on what could be causing them? Or is it likely an issue with the camera and not this repo? The camera is just on my desk - no motion or environmental factors:

roslaunch video_stream_opencv camera.launch video_stream_provider:=rtsp://192.168.1.1:554/h264

[h264 @ 0x7f6fdc031380] Invalid level prefix
[h264 @ 0x7f6fdc031380] error while decoding MB 39 22
[h264 @ 0x7f6fdc031380] top block unavailable for requested intra mode -1
[h264 @ 0x7f6fdc031380] error while decoding MB 0 0
[h264 @ 0x7f6fdc031380] Frame num change from 0 to 215
[h264 @ 0x7f6fdc031380] decode_slice_header error
Invalid UE golomb code
[h264 @ 0x7f6fdc1d4240] mb_type -1094995529 in I slice too large at 0 0
[h264 @ 0x7f6fdc1d4240] error while decoding MB 0 0
[h264 @ 0x7f6fdc1f0580] slice type 32 too large at 0
[h264 @ 0x7f6fdc1f0580] decode_slice_header error
[h264 @ 0x7f6fdc1f0580] no frame!
[h264 @ 0x7f6fdc2b4ec0] corrupted macroblock 39 22 (total_coeff=-1)
[h264 @ 0x7f6fdc2b4ec0] error while decoding MB 39 22
[h264 @ 0x7f6fdc1f0580] corrupted macroblock 39 22 (total_coeff=-1)
[h264 @ 0x7f6fdc1f0580] error while decoding MB 39 22
[h264 @ 0x7f6fdc2b4ec0] corrupted macroblock 31 16 (total_coeff=-1)
[h264 @ 0x7f6fdc2b4ec0] error while decoding MB 31 16
[NULL @ 0x7f6fdc019580] reference count 1 overflow
[h264 @ 0x7f6fdc279c20] reference count overflow
[h264 @ 0x7f6fdc279c20] decode_slice_header error
[h264 @ 0x7f6fdc279c20] no frame!
[h264 @ 0x7f6fdc279c20] out of range intra chroma pred mode
[h264 @ 0x7f6fdc279c20] error while decoding MB 38 22

terminate called after throwing an instance of 'std::runtime_error'

I am trying to stream an ip camera over rtsp using video_stream_opencv.
I have been able to successfully visualize the camera using VLC with the command:

vlc --network-caching=500 rtsp://admin:[email protected]:5541

However any attempts to stream the camera with video_stream has failed. Here is the result of attempting to run video_stream_opencv:

roslaunch video_stream_opencv camera.launch video_stream_provider:="rtsp://admin:[email protected]:5541" visualize:=true
... logging to /home/user/.ros/log/824e7b1e-f3a1-11ea-8e38-509a4c4c9a82/roslaunch-user-OptiPlex-7050-7261.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
WARNING: disk usage in log directory [/home/user/.ros/log] is over 1GB.
It's recommended that you use the 'rosclean' command.

started roslaunch server http://user-OptiPlex-7050:44619/

SUMMARY
========

PARAMETERS
 * /camera/camera_stream/buffer_queue_size: 100
 * /camera/camera_stream/camera_info_url: 
 * /camera/camera_stream/camera_name: camera
 * /camera/camera_stream/flip_horizontal: False
 * /camera/camera_stream/flip_vertical: False
 * /camera/camera_stream/fps: 30.0
 * /camera/camera_stream/frame_id: camera
 * /camera/camera_stream/height: 0
 * /camera/camera_stream/loop_videofile: False
 * /camera/camera_stream/set_camera_fps: 30.0
 * /camera/camera_stream/video_stream_provider: rtsp://admin:admi...
 * /camera/camera_stream/width: 0
 * /rosdistro: melodic
 * /rosversion: 1.14.5

NODES
  /camera/
    camera_image_view (image_view/image_view)
    camera_stream (video_stream_opencv/video_stream)

auto-starting new master
process[master]: started with pid [7271]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 824e7b1e-f3a1-11ea-8e38-509a4c4c9a82
process[rosout-1]: started with pid [7282]
started core service [/rosout]
process[camera/camera_stream-2]: started with pid [7289]
process[camera/camera_image_view-3]: started with pid [7290]
[ INFO] [1599768559.808352235]: Resource video_stream_provider: rtsp://admin:[email protected]:5541
[ INFO] [1599768559.808787364]: Getting video from provider: rtsp://admin:[email protected]:5541
[ INFO] [1599768589.924488669]: Video stream provider type detected: rtsp_stream
[ INFO] [1599768589.926685254]: Camera name: camera
[ INFO] [1599768589.928740132]: Setting camera FPS to: 30
[ INFO] [1599768589.928824345]: Camera reports FPS: 90000
[ INFO] [1599768589.930779402]: Setting buffer size for capturing frames to: 100
[ INFO] [1599768589.932821669]: Throttling to fps: 30
[ INFO] [1599768589.934871704]: Publishing with frame_id: camera
[ INFO] [1599768589.936872284]: Provided camera_info_url: ''
[ INFO] [1599768589.938861274]: Flip horizontal image is: false
[ INFO] [1599768589.940802556]: Flip vertical image is: false
[ INFO] [1599768589.948160366]: using default calibration URL
[ INFO] [1599768589.948329780]: camera calibration URL: file:///home/user/.ros/camera_info/camera.yaml
[ INFO] [1599768589.948532653]: Unable to open camera calibration file [/home/user/.ros/camera_info/camera.yaml]
[ WARN] [1599768589.948644310]: Camera calibration file /home/user/.ros/camera_info/camera.yaml not found.
[ INFO] [1599768589.948729846]: Opened the stream, starting to publish.
terminate called after throwing an instance of 'std::runtime_error'
  what():  Could not capture frame!
[camera/camera_stream-2] process has died [pid 7289, exit code -6, cmd /opt/ros/melodic/lib/video_stream_opencv/video_stream camera:=image_raw __name:=camera_stream __log:=/home/user/.ros/log/824e7b1e-f3a1-11ea-8e38-509a4c4c9a82/camera-camera_stream-2.log].
log file: /home/user/.ros/log/824e7b1e-f3a1-11ea-8e38-509a4c4c9a82/camera-camera_stream-2*.log

Changing the FPS and buffer size seem to change the frequency of it but I'm unsure as to what is happening.

Node keeps sending last frame of file

In case of reading a video file, the node keeps sending the last frame when it reaches the end of the file.
Is this the desired behavior?

I can send a PR with the fix

Having a issue for video streaming

I'm the one who are using ros package named 'video_stream_opencv'.

While I'm using it, I met a problem getting video stream from the device.

Here is my H/W Spec and situation.

Board : Jetson TX2

Device : Fushicai USBTV007 Video Grabber [EasyCAP]

rosdistro : ROS- Kinetic

OS : Ubuntu 16.04

OpenCV : 3.4.1 (replace 3.3.1-dev cv2.so with 3.4.1 cv2.so)

So I tried to get a video stream through the Easycap.
The './test_video_resource.py' works well at the moment at it shows video stream.
But when I use 'webcam_launch', if keep showing 'VIDIOC_QUERYCTRL: Inappropriate ioctl for device' error message.

So would anyone can give me some advice to solve this problem?

noetic?

Hi,

as far as I can tell, the newest officially supported version is melodic. Is there a reason for this? In my build, the newest version of this works fine if I clone it into my (noetic) catkin workspace.
Are there plans to officially support noetic as well?
Otherwise, is there an official replacement?

Thanks

Invalid stop/start_frame.

Hello everyone,
First of all thanks for taking the time to check my issue. The error I get is the following:

[ERROR] [1623244822.830661872]: Invalid 'stop_frame' -2147483648 for video which has -2.76701e+17 frames. Setting internally (won't be shown in dynamic_reconfigure) 'stop_frame' to -2.76701e+17
[ERROR] [1623244822.830673509]: Invalid 'start_frame' 0, which exceeds 'stop_frame' -2147483648. Setting internally (won't be shown in dynamic_reconfigure) 'start_frame' to 0.

Here is my launch file.

<?xml version="1.0"?>
<launch>
   <!-- launch video stream -->
   <include file="$(find video_stream_opencv)/launch/camera.launch" >
        <!-- node name and ros graph name -->
        <arg name="camera_name" value="videofile" />
        <!-- full path to the video file -->
        <!-- wget http://techslides.com/demos/sample-videos/econVideo_2021-06-09-16-33-56_0.mkv -O /tmp/small.mp4 -->
        <arg name="video_stream_provider" value="/home/antonis/Desktop/test_econ_video/econVideo_2021-06-09-16-33-56_2.mkv" />
        <!-- set camera fps to (video files not affected) -->
        <arg name="set_camera_fps" value="27"/>
        <!-- set buffer queue size of frame capturing to -->
        <arg name="buffer_queue_size" value="1000" />
        <!-- throttling the querying of frames to -->
        <arg name="fps" value="27" />
        <!-- setting frame_id -->
        <arg name="frame_id" value="videofile_frame" />
        <!-- camera info loading, take care as it needs the "file:///" at the start , e.g.:
        "file:///$(find your_camera_package)/config/your_camera.yaml" -->
        <arg name="camera_info_url" value="" />
        <!-- flip the image horizontally (mirror it) -->
        <arg name="flip_horizontal" value="false" />
        <!-- flip the image vertically -->
        <arg name="flip_vertical" value="false" />
        <!-- enable looping playback -->
        <arg name="loop_videofile" value="false" />
        <!-- start frame of video -->
        <arg name="start_frame" default="0"/>
        <!-- stop frame of video, -1 means the end of video -->
        <arg name="stop_frame" default="-1"/>
        <!-- visualize on an image_view window the stream generated -->
        <arg name="visualize" value="false" />
   </include>
</launch>

Any ideas? Thanks in advance.

Invalid UE golomb code

I am using the rtsp_stream.launch file. Upon launching I keep getting a recurring error statement - 'Invalid UE golomb code', even though the visualization seems to work fine at first.
I have not found any general solution for this. However are a few cases, documented, where others have faced got this same message while using opencv for rtsp streaming. I am looking for a general explanation as to what the message signifies in general?

Also it may be relevant to mention, that my visualization also seems to be faulty, in case I choose to flip the frames horizontally and/or vertically. Every other frame or so, the visualization shows the un-filped after the first few seconds.

Cheers

The camera images turned permanently grey and black

Unfortunately after using the video_stream_opencv in docker all the cameras turned grey and black and restarting the machine does not solve it. This effect persists also when using other apps (Zoom etc.). If we plug in another camera, it works fine.

I wanted to ask what is the reason behind setting all the different device settings in the subscribe function.

cap->set(cv::CAP_PROP_BRIGHTNESS, latest_config.brightness);
I am considering if the failed call of these functions could have a permanent effect on the hardware? I'm not sure what otherwise could have caused it.

The image below presents how the output of the cameras looks now.

out

Method of determining video stream provider type is flawed

When the connection is opened, the cod determines the video stream provider type using a try catch statement. The way this works, leads the code to think that path based descriptions of a camera, like: /dev/v4l/by-id/usb-HD_Camera_Manufacturer_USB_2.0_Camera-video-index0 are for videofiles:

[ INFO] [1579536353.359840769]: Resource video_stream_provider: /dev/v4l/by-id/usb-HD_Camera_Manufacturer_USB_2.0_Camera-video-index0
[ INFO] [1579536353.359897282]: Getting video from provider: /dev/v4l/by-id/usb-HD_Camera_Manufacturer_USB_2.0_Camera-video-index0
[ INFO] [1579536354.439264150]: Video stream provider type detected: videofile

Then the node will ask for the frame count and try to set the frame pos. Somewhere this leads to an error:

VIDEOIO ERROR: V4L2: getting property #7 is not supported

That prints for every frame (I think)

Unable to force image width

Camera displays properly but forced image width is not accepted. I'm concerned this might hurt the accuracy of a camera calibration that uses the topics published by this node if it's publishing the wrong image width?

I do not have a calibration file because I'm trying to create one from the rtsp stream using this node.

roslaunch video_stream_opencv camera.launch video_stream_provider:=rtsp://192.168.1.1:554/h264 width:=640 height:=480
PARAMETERS
/camera/camera_stream/buffer_queue_size: 100
/camera/camera_stream/camera_info_url:
/camera/camera_stream/camera_name: camera
/camera/camera_stream/flip_horizontal: False
/camera/camera_stream/flip_vertical: False
/camera/camera_stream/fps: 30.0
/camera/camera_stream/frame_id: camera
/camera/camera_stream/height: 480
/camera/camera_stream/loop_videofile: False
/camera/camera_stream/set_camera_fps: 30.0
/camera/camera_stream/start_frame: 0
/camera/camera_stream/stop_frame: -1
/camera/camera_stream/video_stream_provider: rtsp://192.168.1....
/camera/camera_stream/width: 640
/rosdistro: melodic
/rosversion: 1.14.10
process[camera/camera_stream-1]: started with pid [9386]
[ INFO] [1619190027.680806948]: Initializing nodelet with 12 worker threads.
[ INFO] [1619190027.780440745]: Camera name: camera
[ INFO] [1619190027.780463526]: Provided camera_info_url: ''
[ INFO] [1619190027.780472029]: Publishing with frame_id: camera
[ INFO] [1619190027.780481436]: Setting camera FPS to: 30
[ INFO] [1619190027.780489365]: Throttling to fps: 30
[ INFO] [1619190027.780497527]: Setting buffer size for capturing frames to: 100
[ INFO] [1619190027.780505387]: Flip horizontal image is: false
[ INFO] [1619190027.780512194]: Flip vertical image is: false
[ INFO] [1619190027.780544536]: Video start frame is: 0
[ INFO] [1619190027.780556521]: Video stop frame is: -1
[ INFO] [1619190027.780569394]: Forced image width is: 640
[ INFO] [1619190027.780596154]: Forced image height is: 480
[ INFO] [1619190028.041820904]: using default calibration URL
[ INFO] [1619190028.041950479]: camera calibration URL: file:///root/.ros/camera_info/camera.yaml
[ INFO] [1619190028.042117590]: Unable to open camera calibration file [/root/.ros/camera_info/camera.yaml]
[ WARN] [1619190028.042185972]: Camera calibration file /root/.ros/camera_info/camera.yaml not found.
[ INFO] [1619190028.042328757]: Opening VideoCapture with provider: rtsp://192.168.1.1:554/h264
[ INFO] [1619190030.582899323]: Video stream provider type detected: rtsp_stream
[ INFO] [1619190030.583051765]: Camera reports FPS: 15
[ WARN] [1619190030.617485528]: No calibration file given, publishing a reasonable default camera info.
[ INFO] [1619190030.617566677]: The image width is: 640
[ INFO] [1619190030.617603730]: The image height is: 360

Could not capture frame video_file.launch

I'm able to play a video.avi file using roslanch video_stream_opencv video_file.launch

However, it doesn't loop the video though the argument loop_videofile is set to true.

Resource Not Found

Hello,

I have downloaded and installed this ROS package. I was able to build the src with no issues, I also executed the make install command and that did not have any issues. However, when I run the package I see the following errors. Any advice or help is much appreciated. Thanks!

osboxes@osboxes:~/catkin_ws/src/video_stream_opencv-master/launch$ roslaunch video_file.launch
... logging to /home/osboxes/.ros/log/51af9362-1628-11e7-a84f-080027f953fe/roslaunch-osboxes-4463.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last):
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/init.py", line 307, in main
p.start()
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 268, in start
self._start_infrastructure()
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 217, in _start_infrastructure
self._load_config()
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/parent.py", line 132, in _load_config
roslaunch_strs=self.roslaunch_strs, verbose=self.verbose)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/config.py", line 451, in load_config_default
loader.load(f, config, verbose=verbose)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 746, in load
self._load_launch(launch, ros_config, is_core=core, filename=filename, argv=argv, verbose=verbose)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 718, in _load_launch
self._recurse_load(ros_config, launch.childNodes, self.root_context, None, is_core, verbose)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 682, in _recurse_load
val = self._include_tag(tag, context, ros_config, default_machine, is_core, verbose)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 95, in call
return f(*args, **kwds)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 587, in _include_tag
inc_filename = self.resolve_args(tag.attributes['file'].value, context)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/xmlloader.py", line 183, in resolve_args
return substitution_args.resolve_args(args, context=context.resolve_dict, resolve_anon=self.resolve_anon)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 316, in resolve_args
resolved = _resolve_args(resolved, context, resolve_anon, commands)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 329, in _resolve_args
resolved = commands[command](resolved, a, args, context)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 142, in _find
source_path_to_packages=source_path_to_packages)
File "/opt/ros/indigo/lib/python2.7/dist-packages/roslaunch/substitution_args.py", line 188, in _find_executable
full_path = _get_executable_path(rp.get_path(args[0]), path)
File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 203, in get_path
raise ResourceNotFound(name, ros_paths=self._ros_paths)
ResourceNotFound: video_stream_opencv
ROS path [0]=/opt/ros/indigo/share/ros
ROS path [1]=/home/osboxes/rosbuild_ws/package_dir
ROS path [2]=/opt/ros/indigo/share
ROS path [3]=/opt/ros/indigo/stacks

Resource Not Found

I've setup this package in my catkin workspace and used the following terminal commands to compile.

  1. source /opt/ros/kinetic/setup.bash
  2. catkin_make

I then try to launch the system with the following command from the launch folder of the package (I assume this is the launch file to use a usb webcam)

  1. roslaunch webcam.launch

I then get the following error
raise ResourceNotFound(name, ros_paths=self._ros_paths)
ResourceNotFound: video_stream_opencv
ROS path [0]=/opt/ros/kinetic/share/ros
ROS path [1]=/opt/ros/kinetic/share

Any idea what's up here? I get a similar issue with all the launch files.

Image not retrieved when using simulation time

Hello and thank you all beforehand,

I've been using video_stream_opencv for retrieving video on a NVIDIA AGX Xavier Jetson from an IP camera, it works just perfectly.

Now I'm trying to set up a global clock for message syncronization on multiple machines using the timestamps on the messages. After some research, I found that you can set the use_sim_time parameter for nodes to listen to the /clock topic (more about this here). This way, all nodes should use the same time.

However, when using this method, the video_stream_opencv node doesn't publish anything. This is what the nodes outputs when running it:

process[hallway_cam/hallway_cam_stream-1]: started with pid [2892]
[ INFO] [1621502184.390573120]: Initializing nodelet with 8 worker threads.
[ INFO] [1621502184.761711424]: Camera name: hallway_cam
[ INFO] [1621502184.761863072]: Provided camera_info_url: ''
[ INFO] [1621502184.761924032]: Publishing with frame_id: hallway_cam
[ INFO] [1621502184.761973952]: Setting camera FPS to: 30
[ INFO] [1621502184.762024608]: Throttling to fps: 30
[ INFO] [1621502184.762195072]: Setting buffer size for capturing frames to: 100
[ INFO] [1621502184.762302464]: Flip horizontal image is: false
[ INFO] [1621502184.762405152]: Flip vertical image is: false
[ INFO] [1621502184.762487808]: Video start frame is: 0
[ INFO] [1621502184.762531744]: Video stop frame is: -1
[ INFO] [1621502185.304085152]: using default calibration URL
[ INFO] [1621502185.304503360]: camera calibration URL: file:///root/.ros/camera_info/hallway_cam.yaml
[ INFO] [1621502185.304866560]: Unable to open camera calibration file [/root/.ros/camera_info/hallway_cam.yaml]
[ WARN] [1621502185.305000832]: Camera calibration file /root/.ros/camera_info/hallway_cam.yaml not found.
[ INFO] [1621502185.305481248]: Opening VideoCapture with provider:
[ INFO] [1621502186.699953376]: Video stream provider type detected: rtsp_stream
[ INFO] [1621502186.700295424]: Camera reports FPS: 180000

Note that the output lines with the image dimensions are missing.

The node is launched with almost default params. This is my launch file:

<param name="use_sim_time" value="true"/>

<!-- Video input node -->
<include file="$(find video_stream_opencv)/launch/camera.launch" >
    <arg name="camera_name" value="hallway_cam" />
    <arg name="video_stream_provider" value="<my RTSP stream>" />
</include>

The system is unaffected if the other nodes use simulation time, it's only this node's problem.

Please tell me if you need more information, and thank you very much.

Immediate crash when using video_file.launch

Streaming from camera.launch works fine. But: running video_file.launch does crash immediately. I tried the small example mp4 movie, the same happens with my own movies. The log given down below is actually empty.

Cheers

matt@xps:~$ roslaunch video_stream_opencv video_file.launch 
... logging to /home/matt/.ros/log/9e67bfc0-90ac-11ea-a57d-d83bbfa23889/roslaunch-xps-10055.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://xps:33467/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.5
 * /videofile/videofile_stream/buffer_queue_size: 1000
 * /videofile/videofile_stream/camera_info_url: 
 * /videofile/videofile_stream/camera_name: videofile
 * /videofile/videofile_stream/flip_horizontal: False
 * /videofile/videofile_stream/flip_vertical: False
 * /videofile/videofile_stream/fps: 30.0
 * /videofile/videofile_stream/frame_id: videofile_frame
 * /videofile/videofile_stream/height: 0
 * /videofile/videofile_stream/loop_videofile: False
 * /videofile/videofile_stream/set_camera_fps: 30.0
 * /videofile/videofile_stream/start_frame: 0
 * /videofile/videofile_stream/stop_frame: -1
 * /videofile/videofile_stream/video_stream_provider: /tmp/small.mp4
 * /videofile/videofile_stream/width: 0

NODES
  /videofile/
    videofile_image_view (image_view/image_view)
    videofile_stream (video_stream_opencv/video_stream)

auto-starting new master
process[master]: started with pid [10066]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 9e67bfc0-90ac-11ea-a57d-d83bbfa23889
process[rosout-1]: started with pid [10077]
started core service [/rosout]
process[videofile/videofile_stream-2]: started with pid [10080]
process[videofile/videofile_image_view-3]: started with pid [10085]
[ INFO] [1588888166.402607238]: Initializing nodelet with 8 worker threads.
[ INFO] [1588888166.490555355]: Camera name: videofile
[ INFO] [1588888166.490587488]: Provided camera_info_url: ''
[ INFO] [1588888166.490600057]: Publishing with frame_id: videofile_frame
[ INFO] [1588888166.490617520]: Setting camera FPS to: 30
[ INFO] [1588888166.490636030]: Throttling to fps: 30
[ INFO] [1588888166.490648199]: Setting buffer size for capturing frames to: 1000
[ INFO] [1588888166.490658106]: Flip horizontal image is: false
[ INFO] [1588888166.490670467]: Flip vertical image is: false
[ INFO] [1588888166.490681324]: Video start frame is: 0
[ INFO] [1588888166.490698345]: Video stop frame is: -1
[ INFO] [1588888166.970952236]: using default calibration URL
[ INFO] [1588888166.971084083]: camera calibration URL: file:///home/matt/.ros/camera_info/videofile.yaml
[ INFO] [1588888166.971302834]: Unable to open camera calibration file [/home/matt/.ros/camera_info/videofile.yaml]
[ WARN] [1588888166.971404132]: Camera calibration file /home/matt/.ros/camera_info/videofile.yaml not found.
[ INFO] [1588888166.971790315]: Opening VideoCapture with provider: /tmp/small.mp4
[ INFO] [1588888167.016638356]: Video stream provider type detected: videofile
[ INFO] [1588888167.016784028]: Camera reports FPS: 30
[ WARN] [1588888167.053391812]: No calibration file given, publishing a reasonable default camera info.
[ INFO] [1588888167.053534105]: The image width is: 560
[ INFO] [1588888167.053590768]: The image height is: 320
[videofile/videofile_image_view-3] process has died [pid 10085, exit code -11, cmd /opt/ros/melodic/lib/image_view/image_view image:=image_raw __name:=videofile_image_view __log:=/home/matt/.ros/log/9e67bfc0-90ac-11ea-a57d-d83bbfa23889/videofile-videofile_image_view-3.log].
log file: /home/matt/.ros/log/9e67bfc0-90ac-11ea-a57d-d83bbfa23889/videofile-videofile_image_view-3*.log

Multiple camera support?

Would be possible to stream from more than one USB web camera at the same time? From launch files, I do not see this option and from the glance of code, I would say that it is also not possible?

Best,
Andrej

Failed to open nodelet

Successfully show video by running: ./test_video_resource.py videofile
However, when roslaunch video_stream_opencv video_file.launch video_stream_provider:=videofile Error msg shows:

**[ERROR] [1565440225.383388393]: Failed to load nodelet [/videofile/videofile_stream] of type [video_stream_opencv/VideoStream] even after refreshing the cache:
Failed to load library devel/lib//libvideo_stream_opencv.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = libyaml-cpp.so.0.5: cannot open shared object file: No such file or directory)
[ERROR] [1565440225.383557928]: The error before refreshing the cache was: Failed to load library devel/lib//libvideo_stream_opencv.so. Make sure that you are calling the PLUGINLIB_EXPORT_CLASS macro in the library code, and that names are consistent between this macro and your XML. Error string: Could not load library (Poco exception = libyaml-cpp.so.0.5: cannot open shared object file: No such file or directory)
**

Can you help? thanks

roslaunch camera.launch crashed

I use this package on my ARM device with usb video device. And ros version is kinetic on Ubuntu 16.04.

I run the following command with default setting visualize:=false, and the process died.

$ roslaunch video_stream_opencv camera.launch

... logging to /home/ros/.ros/log/ed042e50-65dc-11e7-b818-0242ac110002/roslaunch-4649243396b5-128.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://10.40.0.0:36986/

SUMMARY
========

PARAMETERS
 * /camera/camera_stream/camera_info_url: 
 * /camera/camera_stream/camera_name: camera
 * /camera/camera_stream/flip_horizontal: False
 * /camera/camera_stream/flip_vertical: False
 * /camera/camera_stream/fps: 30
 * /camera/camera_stream/frame_id: camera
 * /camera/camera_stream/height: 0
 * /camera/camera_stream/video_stream_provider: 0
 * /camera/camera_stream/width: 0
 * /rosdistro: kinetic
 * /rosversion: 1.12.7

NODES
  /camera/
    camera_stream (video_stream_opencv/video_stream)

ROS_MASTER_URI=http://10.32.0.1:11311

core service [/rosout] found
process[camera/camera_stream-1]: started with pid [137]
[ INFO] [1499741272.912546362]: Resource video_stream_provider: 0
[ INFO] [1499741272.922700947]: Getting video from provider: /dev/video0
[ INFO] [1499741273.120671036]: Camera name: camera
[ INFO] [1499741273.138510526]: Throttling to fps: 30
[ INFO] [1499741273.156993540]: Publishing with frame_id: camera
[ INFO] [1499741273.179787055]: Provided camera_info_url: ''
[ INFO] [1499741273.197188141]: Flip horizontal image is: false
[ INFO] [1499741273.217054989]: Flip vertical image is: false
[ INFO] [1499741273.243228908]: Opened the stream, starting to publish.
[ INFO] [1499741273.262241239]: using default calibration URL
[ INFO] [1499741273.270453463]: camera calibration URL: file:///home/ros/.ros/camera_info/camera.yaml
[ INFO] [1499741273.278792891]: Unable to open camera calibration file [/home/ros/.ros/camera_info/camera.yaml]
[ WARN] [1499741273.286748455]: Camera calibration file /home/ros/.ros/camera_info/camera.yaml not found.
select timeout
select timeout
OpenCV Error: Assertion failed (total() == 0 || data != NULL) in Mat, file /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/core/include/opencv2/core/mat.inl.hpp, line 431
terminate called after throwing an instance of 'cv::Exception'
  what():  /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/core/include/opencv2/core/mat.inl.hpp:431: error: (-215) total() == 0 || data != NULL in function Mat

[camera/camera_stream-1] process has died [pid 137, exit code -6, cmd /opt/ros/kinetic/lib/video_stream_opencv/video_stream camera:=image_raw __name:=camera_stream __log:=/home/ros/.ros/log/ed042e50-65dc-11e7-b818-0242ac110002/camera-camera_stream-1.log].
log file: /home/ros/.ros/log/ed042e50-65dc-11e7-b818-0242ac110002/camera-camera_stream-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done
Unhandled exception in thread started by 
sys.excepthook is missing
lost sys.stderr

The following is the log.

[roslaunch][INFO] 2017-07-11 02:47:49,270: Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
[roslaunch][INFO] 2017-07-11 02:47:49,310: Done checking log file disk usage. Usage is <1GB.
[roslaunch][INFO] 2017-07-11 02:47:49,321: roslaunch starting with args ['/opt/ros/kinetic/bin/roslaunch', 'video_stream_opencv', 'camera.launch']
[roslaunch][INFO] 2017-07-11 02:47:49,323: roslaunch env is {'ROS_DISTRO': 'kinetic', 'ROSLISP_PACKAGE_DIRECTORIES': '', 'HOME': '/home/ros', 'PATH': '/opt/ros/kinetic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'CMAKE_PREFIX_PATH': '/opt/ros/kinetic', 'LD_LIBRARY_PATH': '/opt/ros/kinetic/lib', 'LANG': 'en_US.UTF-8', 'TERM': 'xterm', 'SHLVL': '1', 'ROS_LOG_FILENAME': '/home/ros/.ros/log/ed042e50-65dc-11e7-b818-0242ac110002/roslaunch-4649243396b5-128.log', 'DEBIAN_FRONTEND': 'noninteractive', 'ROS_MASTER_URI': 'http://10.32.0.1:11311', 'PYTHONPATH': '/opt/ros/kinetic/lib/python2.7/dist-packages', 'ROS_ROOT': '/opt/ros/kinetic/share/ros', 'PKG_CONFIG_PATH': '/opt/ros/kinetic/lib/pkgconfig', 'ROS_PACKAGE_PATH': '/opt/ros/kinetic/share', '_': '/opt/ros/kinetic/bin/roslaunch', 'OLDPWD': '/home/ros/.ros', 'HOSTNAME': '4649243396b5', 'ROS_IP': '10.40.0.0', 'PWD': '/home/ros', 'ROS_ETC_DIR': '/opt/ros/kinetic/etc/ros', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'}
[roslaunch][INFO] 2017-07-11 02:47:49,325: starting in server mode
[roslaunch.parent][INFO] 2017-07-11 02:47:49,333: starting roslaunch parent run
[roslaunch][INFO] 2017-07-11 02:47:49,337: loading roscore config file /opt/ros/kinetic/etc/ros/roscore.xml
[roslaunch][INFO] 2017-07-11 02:47:50,323: Added core node of type [rosout/rosout] in namespace [/]
[roslaunch.config][INFO] 2017-07-11 02:47:50,325: loading config file /opt/ros/kinetic/share/video_stream_opencv/launch/camera.launch
[roslaunch][INFO] 2017-07-11 02:47:50,367: Added node of type [video_stream_opencv/video_stream] in namespace [/camera/]
[roslaunch][INFO] 2017-07-11 02:47:50,370: ... selected machine [] for node of type [video_stream_opencv/video_stream]
[roslaunch.pmon][INFO] 2017-07-11 02:47:50,383: start_process_monitor: creating ProcessMonitor
[roslaunch.pmon][INFO] 2017-07-11 02:47:50,386: created process monitor <ProcessMonitor(ProcessMonitor-1, initial daemon)>
[roslaunch.pmon][INFO] 2017-07-11 02:47:50,389: start_process_monitor: ProcessMonitor started
[roslaunch.parent][INFO] 2017-07-11 02:47:50,390: starting parent XML-RPC server
[roslaunch.server][INFO] 2017-07-11 02:47:50,393: starting roslaunch XML-RPC server
[roslaunch.server][INFO] 2017-07-11 02:47:50,395: waiting for roslaunch XML-RPC server to initialize
[xmlrpc][INFO] 2017-07-11 02:47:50,398: XML-RPC server binding to 0.0.0.0:0
[xmlrpc][INFO] 2017-07-11 02:47:50,402: Started XML-RPC server [http://10.40.0.0:36986/]
[xmlrpc][INFO] 2017-07-11 02:47:50,405: xml rpc node: starting XML-RPC server
[roslaunch][INFO] 2017-07-11 02:47:50,423: started roslaunch server http://10.40.0.0:36986/
[roslaunch.parent][INFO] 2017-07-11 02:47:50,433: ... parent XML-RPC server started
[roslaunch][INFO] 2017-07-11 02:47:50,443: master.is_running[http://10.32.0.1:11311]
[roslaunch][INFO] 2017-07-11 02:47:50,462: master.is_running[http://10.32.0.1:11311]
[roslaunch][INFO] 2017-07-11 02:47:50,475: ROS_MASTER_URI=http://10.32.0.1:11311
[roslaunch][INFO] 2017-07-11 02:47:50,507: setting /roslaunch/uris/host_10_40_0_0__36986' to http://10.40.0.0:36986/
[roslaunch][INFO] 2017-07-11 02:47:50,536: load_parameters starting ...
[roslaunch][INFO] 2017-07-11 02:47:50,578: ... load_parameters complete
[roslaunch][INFO] 2017-07-11 02:47:50,580: launch_nodes: launching local nodes ...
[roslaunch][INFO] 2017-07-11 02:47:50,582: ... preparing to launch node of type [video_stream_opencv/video_stream]
[roslaunch][INFO] 2017-07-11 02:47:50,584: create_node_process: package[video_stream_opencv] type[video_stream] machine[Machine(name[] env_loader[None] address[localhost] ssh_port[22] user[None] assignable[True] timeout[10.0])] master_uri[http://10.32.0.1:11311]
[roslaunch][INFO] 2017-07-11 02:47:50,586: process[camera/camera_stream-1]: env[{'ROS_DISTRO': 'kinetic', 'ROS_IP': '10.40.0.0', 'HOME': '/home/ros', 'PATH': '/opt/ros/kinetic/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'CMAKE_PREFIX_PATH': '/opt/ros/kinetic', 'ROS_LOG_FILENAME': '/home/ros/.ros/log/ed042e50-65dc-11e7-b818-0242ac110002/roslaunch-4649243396b5-128.log', 'LANG': 'en_US.UTF-8', 'TERM': 'xterm', 'SHLVL': '1', 'LD_LIBRARY_PATH': '/opt/ros/kinetic/lib', 'DEBIAN_FRONTEND': 'noninteractive', 'ROS_MASTER_URI': 'http://10.32.0.1:11311', 'PYTHONPATH': '/opt/ros/kinetic/lib/python2.7/dist-packages', 'ROS_ROOT': '/opt/ros/kinetic/share/ros', 'PKG_CONFIG_PATH': '/opt/ros/kinetic/lib/pkgconfig', 'ROS_PACKAGE_PATH': '/opt/ros/kinetic/share', 'ROS_NAMESPACE': u'/camera', '_': '/opt/ros/kinetic/bin/roslaunch', 'OLDPWD': '/home/ros/.ros', 'HOSTNAME': '4649243396b5', 'ROSLISP_PACKAGE_DIRECTORIES': '', 'PWD': '/home/ros', 'ROS_ETC_DIR': '/opt/ros/kinetic/etc/ros', 'LS_COLORS': 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:'}]
[roslaunch][INFO] 2017-07-11 02:47:50,783: process[camera/camera_stream-1]: args[[u'/opt/ros/kinetic/lib/video_stream_opencv/video_stream', u'camera:=image_raw', u'__name:=camera_stream']]
[roslaunch][INFO] 2017-07-11 02:47:50,786: ... created process [camera/camera_stream-1]
[roslaunch.pmon][INFO] 2017-07-11 02:47:50,789: ProcessMonitor.register[camera/camera_stream-1]
[roslaunch.pmon][INFO] 2017-07-11 02:47:50,791: ProcessMonitor.register[camera/camera_stream-1] complete
[roslaunch][INFO] 2017-07-11 02:47:50,793: ... registered process [camera/camera_stream-1]
[roslaunch][INFO] 2017-07-11 02:47:50,794: process[camera/camera_stream-1]: starting os process
[roslaunch][INFO] 2017-07-11 02:47:50,797: process[camera/camera_stream-1]: start w/ args [[u'/opt/ros/kinetic/lib/video_stream_opencv/video_stream', u'camera:=image_raw', u'__name:=camera_stream', u'__log:=/home/ros/.ros/log/ed042e50-65dc-11e7-b818-0242ac110002/camera-camera_stream-1.log']]
[roslaunch][INFO] 2017-07-11 02:47:50,799: process[camera/camera_stream-1]: cwd will be [/home/ros/.ros]
[roslaunch][INFO] 2017-07-11 02:47:51,631: process[camera/camera_stream-1]: started with pid [137]
[roslaunch][INFO] 2017-07-11 02:47:51,655: ... successfully launched [camera/camera_stream-1]
[roslaunch][INFO] 2017-07-11 02:47:51,658: ... launch_nodes complete
[roslaunch.pmon][INFO] 2017-07-11 02:47:51,667: registrations completed <ProcessMonitor(ProcessMonitor-1, started daemon -1238371216)>
[roslaunch.parent][INFO] 2017-07-11 02:47:51,672: ... roslaunch parent running, waiting for process exit
[roslaunch][INFO] 2017-07-11 02:47:51,681: spin
[roslaunch][ERROR] 2017-07-11 02:48:13,707: [camera/camera_stream-1] process has died [pid 137, exit code -6, cmd /opt/ros/kinetic/lib/video_stream_opencv/video_stream camera:=image_raw __name:=camera_stream __log:=/home/ros/.ros/log/ed042e50-65dc-11e7-b818-0242ac110002/camera-camera_stream-1.log].
log file: /home/ros/.ros/log/ed042e50-65dc-11e7-b818-0242ac110002/camera-camera_stream-1*.log
[roslaunch.pmon][INFO] 2017-07-11 02:48:13,717: ProcessMonitor.unregister[camera/camera_stream-1] starting
[roslaunch.pmon][INFO] 2017-07-11 02:48:13,719: ProcessMonitor.unregister[camera/camera_stream-1] complete
[roslaunch][INFO] 2017-07-11 02:48:13,727: all processes on machine have died, roslaunch will exit
[roslaunch.pmon][INFO] 2017-07-11 02:48:13,836: ProcessMonitor._post_run <ProcessMonitor(ProcessMonitor-1, started daemon -1238371216)>
[roslaunch.pmon][INFO] 2017-07-11 02:48:13,839: ProcessMonitor._post_run <ProcessMonitor(ProcessMonitor-1, started daemon -1238371216)>: remaining procs are []
[roslaunch.pmon][INFO] 2017-07-11 02:48:13,858: ProcessMonitor exit: cleaning up data structures and signals
[roslaunch.pmon][INFO] 2017-07-11 02:48:13,860: ProcessMonitor exit: pmon has shutdown
[roslaunch][INFO] 2017-07-11 02:48:13,864: process monitor is done spinning, initiating full shutdown
[roslaunch][INFO] 2017-07-11 02:48:13,866: runner.stop()
[roslaunch][INFO] 2017-07-11 02:48:13,868: shutting down processing monitor...
[roslaunch][INFO] 2017-07-11 02:48:13,878: shutting down processing monitor <ProcessMonitor(ProcessMonitor-1, stopped daemon -1238371216)>
[roslaunch.pmon][INFO] 2017-07-11 02:48:13,882: ProcessMonitor.shutdown <ProcessMonitor(ProcessMonitor-1, stopped daemon -1238371216)>
[roslaunch][INFO] 2017-07-11 02:48:13,885: ... shutting down processing monitor complete
[roslaunch][INFO] 2017-07-11 02:48:13,893: done
[roslaunch.pmon][INFO] 2017-07-11 02:48:13,899: ProcessMonitor.shutdown <ProcessMonitor(ProcessMonitor-1, stopped daemon -1238371216)>
[rospy.core][INFO] 2017-07-11 02:48:13,905: signal_shutdown [atexit]

And I also tried this following command.

$ rosrun video_stream_opencv test_video_resource.py 0

Trying to open resource: /dev/video0
Correctly opened resource, starting to show feed.
select timeout
select timeout
OpenCV Error: Assertion failed (total() == 0 || data != NULL) in Mat, file /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/core/include/opencv2/core/mat.inl.hpp, line 431
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/video_stream_opencv/test_video_resource.py", line 43, in <module>
    rval, frame = cap.read()
cv2.error: /tmp/binarydeb/ros-kinetic-opencv3-3.2.0/modules/core/include/opencv2/core/mat.inl.hpp:431: error: (-215) total() == 0 || data != NULL in function Mat

Feature Request: switch between UDP and TCP Mode

Rtsp streams are also possible over udp.
I've found just a workarround to set ENV-Variable:
export OPENCV_FFMPEG_CAPTURE_OPTIONS="rtsp_transport;udp"
bevor starting node via rosrun.

Would be nice to have a direct parameter in node for setting UDP mode.

Node continues to publish last frame after end of video

I'm using this package to stream a video as a stream of frames to a node which manipulates the frames and saves them to disk. I launch the camera.launch from this package in another launch file like this:

<include file="$(find video_stream_opencv)/launch/camera.launch">
	<arg name="camera_name" value="$(arg video_stream_topic_name)"/>
	<arg name="video_stream_provider" value="$(arg video_file)"/>
	<arg name="stop_frame" value="-1"/>
</include>

Once the video is finished (~1000 frames), it continues to publish the last frame indefinitely, while throwing the following error on console:

[ERROR] [1590444387.369692670]: Could not capture frame
[ERROR] [1590444387.402886483]: Could not capture frame
[ERROR] [1590444387.436512947]: Could not capture frame
[ERROR] [1590444387.470821575]: Could not capture frame
[ERROR] [1590444387.504174047]: Could not capture frame

framesQueue.pull(_drop_frame) never returns

Hi,
I experienced a strange thing when setting buffer_queue_size=1. After some time (less than 1min) the call of framesQueue.pull(_drop_frame) in do_capture() doesn't return. So I don't get any new frame.

This happens only on the Jetson TX2. Setting buffer_queue_size=2 seems to work.

Also maybe you could use boost::lockfree::spsc_queue. But I think you can't have a variable length of the queue though.

Cheers

adding retry for opening video stream

Would it be possible to add a retry or wait period for opening streams? It would be useful for me. It seems like it would be straightforward to add a wait loop around line 152 of video_stream.cpp, with the time to wait passed in as a parameter (with the default being zero I suppose). I don't mind making this change and opening a pull request, I did not see any contribution guidelines.

Thanks for your time!

thread error if set "reopen_on_read_failure" to be true

Because I got Error "Could not capture frame" sometimes, I set "reopen_on_read_failure" to be true.

However, this will result in the thread error as follows and shut down the camera node.

[ERROR] [1603808756.444539510]: Could not capture frame
[ WARN] [1603808756.444615546]: trying to reopen the device
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::thread_resource_error> >'
  what():  boost thread: trying joining itself: Resource deadlock avoided

Btw, I will always get frame dropping and I cannot find the reasons. Is that common? Three kinds of dropping messages are as follows.

[rtsp @ 0x7fbfc802db60] RTP timestamps don't match.
[rtsp @ 0x7fbfc802db60] Received packet without a start chunk; dropping frame.
[rtsp @ 0x7fbfc802db60] Missing packets; dropping frame.

Thanks a lot!

Compressed Depth Image Transport - Compression requires single-channel 32bit-floating point or 16bit raw depth images (input format is: bgr8)

running this file.launch in 1st terminal:

<launch>
	<arg name="camera_live" default="true" />
	<arg name="open_rviz" 	default="true" />
	<arg name="my_camera" 	default="Huawei_Mate_10_pro" />
	
	<node if="$(arg open_rviz)" pkg="rviz" type="rviz" name="ouster_rviz" output="screen" args="-d $(find ouster_ros)/only_huawei.rviz"/>

	<group if="$(arg camera_live)">
		<include file="$(find video_stream_opencv)/launch/camera.launch">
			<arg name="camera_name" 			value="$(arg my_camera)" />
			
			<!--<arg name="video_stream_provider" 	value="0" />
			<arg name="set_camera_fps" 			value="30"/>-->
			
			<!-- streaming url
	  		<arg name="set_camera_fps"			value="30"/> -->
			<arg name="video_stream_provider" 	value="http://192.168.43.26:8080/video?x.mjpeg" /> 

			<arg name="fps" 					value="10" />
			<arg name="frame_id" 			value="webcam_optical_frame" />
			<!-- camera.yaml-->
			<arg name="camera_info_url" 	value="file:///$(find ouster_ros)/huawei_calib.yaml" />
			<arg name="flip_horizontal" 	value="false" />
			<arg name="flip_vertical" 		value="false" />
			<arg name="buffer_queue_size" value="1000" />
			<arg name="width" 				value="0"/>
			<arg name="height" 				value="0"/>
			<arg name="visualize" 			value="false" />
		</include>
	</group>
</launch>

and rosbag record -a --duration=20s -O bag_file in 2nd terminal, I get the following error streaming on my 1st terminal:

[ERROR] [1597829296.595991253]: Compressed Depth Image Transport - Compression requires single-channel 32bit-floating point or 16bit raw depth images (input format is: bgr8)

Camera Setup:
Android phone, Huawei Mate10 Pro
Android App: IP webcam (tried video resolution: 640x480, 3264x1632)

yaml-cpp dependency missing

Hi,

I had to add the "yaml-cpp" as a dependency to the CMakeLists.txt.

Old line:
target_link_libraries(video_stream ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
changed to
target_link_libraries(video_stream ${catkin_LIBRARIES} ${OpenCV_LIBRARIES} yaml-cpp).

Otherwise I got a linker error searching for yaml-function.

Memory leak when subscribing to /videofile/image_raw topic

Houston, we have another problem.

There is a memory leak when subscribing to /videofile/image_raw topic. Valgrind sees the memory as always reachable (so technically speaking it's not a true leak), but the process ends up using several gigs of memory. When one stops image_view, memory is released correctly.

If you want to take a look at it, you can clone this branch:

https://github.com/aviogit/video_stream_opencv/tree/memory_leak_when_subscribing_to_slash_videofile_slash_image_raw

I found an excellent piece of code by @BloodAxe here: https://computer-vision-talks.com/hacking-opencv-for-fun-and-profit/

and now I can even see precise numbers. I'll try to understand why it happens, cv_bridge::CvImage::toImageMsg() does a deep copy, so I actually see no reason for this to happen.

http://docs.ros.org/kinetic/api/cv_bridge/html/c++/cv__bridge_8cpp_source.html

I'll try to look into this further...

speed

When I use this package, the video publish to ros is always speed up so much, I use the video to slam, so it always lost the track, I don't know why, do you have any idea?

how to improve the latency sourcing video with rtsp?

Hi all,

I try to use this driver to stream video through rtsp for a SLAM task. But when I run the testing python script to test the video source, I find the video has a big latency, like about 10 seconds which is intolerable to my project. Is there any method to narrow the latency?

Thanks in advance.
Duncan

Cannot open video streams with higer numbers

Hi!
I have found issue when opening my usb camera stream.

When cameras have index over 10, I can not open them. I always got an error:
Could not open the stream.

But using for example ffplay /dev/video12 works fine.

Some basic info:

  • branch: master
  • commit: 31d60f2
  • used camera: 2xRealSense + 2xELP Digital Camera
  • librealsense and realsense2_camera installed - RealSense works well
  • OpenCV ver.: 3.2.0

Roslaunch info:

started roslaunch server http://192.168.69.70:37235/

SUMMARY
========

PARAMETERS
 * /robot_0/camera_2d/back/camera_back/camera_info_url: file:////home/kom...
 * /robot_0/camera_2d/back/camera_back/flip_horizontal: False
 * /robot_0/camera_2d/back/camera_back/flip_vertical: False
 * /robot_0/camera_2d/back/camera_back/fps: 30
 * /robot_0/camera_2d/back/camera_back/frame_id: /robot_0/camera_2...
 * /robot_0/camera_2d/back/camera_back/height: 0
 * /robot_0/camera_2d/back/camera_back/video_stream_provider: 14
 * /robot_0/camera_2d/back/camera_back/width: 0
 * /robot_0/camera_2d/front/camera_front/camera_info_url: file:////home/kom...
 * /robot_0/camera_2d/front/camera_front/flip_horizontal: False
 * /robot_0/camera_2d/front/camera_front/flip_vertical: False
 * /robot_0/camera_2d/front/camera_front/fps: 30
 * /robot_0/camera_2d/front/camera_front/frame_id: /robot_0/camera_2...
 * /robot_0/camera_2d/front/camera_front/height: 0
 * /robot_0/camera_2d/front/camera_front/video_stream_provider: 12
 * /robot_0/camera_2d/front/camera_front/width: 0
 * /robot_0/camera_web_server/address: 0.0.0.0
 * /robot_0/camera_web_server/port: 8080
 * /robot_0/camera_web_server/ros_threads: 4
 * /rosdistro: melodic
 * /rosversion: 1.14.9

NODES
  /robot_0/
    camera_web_server (web_video_server/web_video_server)
  /robot_0/camera_2d/back/
    camera_back (video_stream_opencv/video_stream)
  /robot_0/camera_2d/front/
    camera_front (video_stream_opencv/video_stream)

auto-starting new master
process[master]: started with pid [2583]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to c1ff0b9c-f69a-11ea-9adc-0030180c50e2
process[rosout-1]: started with pid [2595]
started core service [/rosout]
process[robot_0/camera_2d/back/camera_back-2]: started with pid [2598]
process[robot_0/camera_2d/front/camera_front-3]: started with pid [2599]
process[robot_0/camera_web_server-4]: started with pid [2600]
[ INFO] [1600095513.887998462]: Initializing nodelet with 6 worker threads.
[ INFO] [1600095513.890201113]: Initializing nodelet with 6 worker threads.
[ INFO] [1600095514.288111301]: Waiting For connections on 0.0.0.0:8080
[ INFO] [1600095514.389199046]: Camera name: camera
[ INFO] [1600095514.389283225]: Provided camera_info_url: 'file:////home/komp1/catkin_ws/src/malamute_ros/malamute_external_devices/malamute_camera/params/rzezucha_back.yaml'
[ INFO] [1600095514.389340733]: Publishing with frame_id: /robot_0/camera_2d_back
[ INFO] [1600095514.389399940]: Setting camera FPS to: 30
[ INFO] [1600095514.389447129]: Throttling to fps: 30
[ INFO] [1600095514.389485751]: Setting buffer size for capturing frames to: 100
[ INFO] [1600095514.389519968]: Flip horizontal image is: false
[ INFO] [1600095514.389563040]: Flip vertical image is: false
[ INFO] [1600095514.389605951]: Video start frame is: 0
[ INFO] [1600095514.389639989]: Video stop frame is: -1
[ INFO] [1600095514.390394436]: Camera name: camera
[ INFO] [1600095514.390481451]: Provided camera_info_url: 'file:////home/komp1/catkin_ws/src/malamute_ros/malamute_external_devices/malamute_camera/params/rzezucha_front.yaml'
[ INFO] [1600095514.390562002]: Publishing with frame_id: /robot_0/camera_2d_front
[ INFO] [1600095514.390619381]: Setting camera FPS to: 30
[ INFO] [1600095514.390671888]: Throttling to fps: 30
[ INFO] [1600095514.390723763]: Setting buffer size for capturing frames to: 100
[ INFO] [1600095514.390773239]: Flip horizontal image is: false
[ INFO] [1600095514.390834396]: Flip vertical image is: false
[ INFO] [1600095514.390875188]: Video start frame is: 0
[ INFO] [1600095514.390911914]: Video stop frame is: -1
[ INFO] [1600095517.910135412]: camera calibration URL: file:////home/komp1/catkin_ws/src/malamute_ros/malamute_external_devices/malamute_camera/params/rzezucha_back.yaml
[ WARN] [1600095517.912627914]: [camera] does not match name camera_back in file //home/komp1/catkin_ws/src/malamute_ros/malamute_external_devices/malamute_camera/params/rzezucha_back.yaml
[ WARN] [1600095517.912846480]: CV version: 3.2.0
[ INFO] [1600095517.912944932]: Opening VideoCapture with provider: /dev/video14
VIDEOIO ERROR: V4L: index 14 is not correct!
[ INFO] [1600095518.202808537]: Video stream provider type detected: videodevice
[ INFO] [1600095518.202897880]: Backend can't provide camera FPS information
[ERROR] [1600095518.202946847]: Could not open the stream.
[ INFO] [1600095523.969846853]: camera calibration URL: file:////home/komp1/catkin_ws/src/malamute_ros/malamute_external_devices/malamute_camera/params/rzezucha_front.yaml
[ WARN] [1600095523.972285700]: [camera] does not match name camera_front in file //home/komp1/catkin_ws/src/malamute_ros/malamute_external_devices/malamute_camera/params/rzezucha_front.yaml
[ WARN] [1600095523.972506727]: CV version: 3.2.0
[ INFO] [1600095523.972623267]: Opening VideoCapture with provider: /dev/video12
VIDEOIO ERROR: V4L: index 12 is not correct!
[ INFO] [1600095524.174854449]: Video stream provider type detected: videodevice
[ INFO] [1600095524.174965253]: Backend can't provide camera FPS information
[ERROR] [1600095524.175013654]: Could not open the stream.

List of devices:

komp1@lc-desktop:~$ v4l2-ctl --list-devices
Intel(R) RealSense(TM) Depth Ca (usb-0000:00:14.0-1):
	/dev/video0
	/dev/video1
	/dev/video2
	/dev/video3
	/dev/video4
	/dev/video5

Intel(R) RealSense(TM) Depth Ca (usb-0000:00:14.0-2):
	/dev/video6
	/dev/video7
	/dev/video8
	/dev/video9
	/dev/video10
	/dev/video11

HD USB Camera: HD USB Camera (usb-0000:00:14.0-3):
	/dev/video12
	/dev/video13

HD USB Camera: HD USB Camera (usb-0000:00:14.0-4):
	/dev/video14
	/dev/video15

Camera launch file:

<launch>
    <arg name="robot_id" default="/robot_0" />
    <arg name="usb_cam_front" default="12" />
    <arg name="usb_cam_back" default="14" />
    <arg name="fps" default="30" />
    <arg name="front_camera_conf_file" default="rzezucha_front"/>
    <arg name="front_camera_info_url" default="file:///$(find malamute_camera)/params/$(arg front_camera_conf_file).yaml" />
    <arg name="back_camera_conf_file" default="rzezucha_back"/>
    <arg name="back_camera_info_url" default="file:///$(find malamute_camera)/params/$(arg back_camera_conf_file).yaml" />
  
    <arg name="flip_horizontal" default="false" />
    <arg name="flip_vertical" default="false" />
    <arg name="width" default="0"/>
    <arg name="height" default="0"/>
    <arg name="frame_id_front" default="$(arg robot_id)/camera_2d_front" />
    <arg name="frame_id_back" default="$(arg robot_id)/camera_2d_back" />

    <group ns="$(arg robot_id)/camera_2d/back">
        <node pkg="video_stream_opencv" type="video_stream" name="camera_back" output="screen">
            <remap from="camera" to="image_raw" />
            <param name="video_stream_provider" type="string" value="$(arg usb_cam_back)" />
            <param name="fps" type="int" value="$(arg fps)" />
            <param name="frame_id" type="string" value="$(arg frame_id_back)" />
            <param name="camera_info_url" type="string" value="$(arg back_camera_info_url)" />
            <param name="flip_horizontal" type="bool" value="$(arg flip_horizontal)" />
            <param name="flip_vertical" type="bool" value="$(arg flip_vertical)"/>
            <param name="width" type="int" value="$(arg width)" />
            <param name="height" type="int" value="$(arg height)" />

        </node>
    </group>

   <group ns="$(arg robot_id)/camera_2d/front">
        <node pkg="video_stream_opencv" type="video_stream" name="camera_front" output="screen">
            <remap from="camera" to="image_raw" />
            <param name="video_stream_provider" type="string" value="$(arg usb_cam_front)" />
            <param name="fps" type="int" value="$(arg fps)" />
            <param name="frame_id" type="string" value="$(arg frame_id_front)" />
            <param name="camera_info_url" type="string" value="$(arg front_camera_info_url)" />
            <param name="flip_horizontal" type="bool" value="$(arg flip_horizontal)" />
            <param name="flip_vertical" type="bool" value="$(arg flip_vertical)"/>
            <param name="width" type="int" value="$(arg width)" />
            <param name="height" type="int" value="$(arg height)" />
        </node>
    </group>

    <node pkg="web_video_server" type="web_video_server" name="camera_web_server" output="screen" ns="$(arg robot_id)">
        <param name="port" value="8080" />
        <param name="address" value="0.0.0.0" />
        <param name="ros_threads" value="4" />
    </node>
</launch>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.