Video_stream_opencv not working

asked 2020-02-27 19:51:50 -0500

tyler gravatar image

updated 2020-02-28 07:08:19 -0500

gvdhoorn gravatar image

When I try to run the rosrun video_stream_opencv test_video_resource.py 0 command I end up with these errors:

Trying to open resource: /dev/video0
Correctly opened resource, starting to show feed.
select timeout
select timeout
OpenCV Error: Assertion failed (!buf.empty() && buf.isContinuous()) in imdecode_, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgcodecs/src/loadsave.cpp, line 637
Traceback (most recent call last):
  File "/home/tjcheem/capstone/src/video_stream_opencv/scripts/test_video_resource.py", line 43, in <module>
    rval, frame = cap.read()
cv2.error: /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgcodecs/src/loadsave.cpp:637: error: (-215) !buf.empty() && buf.isContinuous() in function imdecode_

Furthermore, when I try to run the webcam launch file I end up with these errors:

... logging to /home/tjcheem/.ros/log/27688d20-59c3-11ea-804a-000c2948c311/roslaunch-ubuntu-7287.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://ubuntu:41307/

SUMMARY
========

PARAMETERS
 * /rosdistro: melodic
 * /rosversion: 1.14.3
 * /webcam/webcam_stream/buffer_queue_size: 1000
 * /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: 15.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: 15.0
 * /webcam/webcam_stream/start_frame: 0
 * /webcam/webcam_stream/stop_frame: -1
 * /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 [7302]
process[webcam/webcam_image_view-2]: started with pid [7303]
[ INFO] [1582854331.874860490]: Initializing nodelet with 2 worker threads.
[ INFO] [1582854332.063075820]: Camera name: webcam
[ INFO] [1582854332.063322096]: Provided camera_info_url: ''
[ INFO] [1582854332.063426599]: Publishing with frame_id: webcam_optical_frame
[ INFO] [1582854332.063532089]: Setting camera FPS to: 15
[ INFO] [1582854332.063632842]: Throttling to fps: 15
[ INFO] [1582854332.063749599]: Setting buffer size for capturing frames to: 1000
[ INFO] [1582854332.063833109]: Flip horizontal image is: false
[ INFO] [1582854332.063938326]: Flip vertical image is: false
[ INFO] [1582854332.064020095]: Video start frame is: 0
[ INFO] [1582854332.064113726]: Video stop frame is: -1
[ INFO] [1582854332.333450200]: using default calibration URL
[ INFO] [1582854332.333989683]: camera calibration URL: file:///home/tjcheem/.ros/camera_info/webcam.yaml
[ INFO] [1582854332.334456532]: Unable to open camera calibration file [/home/tjcheem/.ros/camera_info/webcam.yaml]
[ WARN] [1582854332.335029738]: Camera calibration file /home/tjcheem/.ros/camera_info/webcam.yaml not found.
[ INFO] [1582854332.335961343]: Opening VideoCapture with provider: /dev/video0
[ INFO] [1582854332.543976203]: Video stream provider type detected: videodevice
[ INFO] [1582854332.544255475]: Camera reports FPS: 30
VIDIOC_S_CTRL: Invalid argument
select timeout
select timeout
OpenCV Error: Assertion failed (!buf.empty() && buf.isContinuous()) in imdecode_, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgcodecs/src/loadsave.cpp, line 637
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/imgcodecs/src/loadsave.cpp:637: error: (-215) !buf.empty() && buf.isContinuous() in function imdecode_

[webcam/webcam_stream-1] process has died [pid 7302, exit code -6, cmd /home/tjcheem/capstone/devel/lib/video_stream_opencv/video_stream camera:=image_raw __name:=webcam_stream __log:=/home/tjcheem/.ros ...
(more)
edit retag flag offensive close merge delete