1

How webcam can be accessed from local PC to remote server in order to do remote development? My remote server configuration is

  • Ubuntu 16.04
  • OpenCV 4
  • Python 3.6

I'm using PyCharm 2019.1.3 in my local PC to use as remote development. All the other configurations, code (debugging) etc. is working fine, just camera is not accessing.

  • All the files (code and data) are on my remote server
  • The development (adding/editing files) will happen at the remote server
  • The code will execute on remote server from local PC

I searched on internet and some related questions but it's for Docker Access webcam using OpenCV (Python) in Docker? and another https://answers.opencv.org/question/199105/videoio-error-v4l-cant-open-camera-by-index-0/
But didn't solve my problem.

if video_file is not None:
    video = cv2.VideoCapture(video_file)
    assert video.isOpened()
else:
    if disable_vidgear:
        video = cv2.VideoCapture(camera_id)
        assert video.isOpened()
    else:
        video = CamGear(camera_id).start()

I'm passing video_file (file name and path) and camera_id (which is 0) in arguments. It works fine if code is in local PC.

When I run the code on server, I got this error "VIDEOIO ERROR: V4L: can't open camera by index 0". I tried with different index (-1, 0, 1, 2 etc) and same error.

I hope to get some valuable suggestions from experts.

0 Answers0