Access webcam using OpenCV (Python) in Docker?

后端 未结 2 2228
甜味超标
甜味超标 2021-02-19 01:48

I\'m trying to use Docker for one of our projects which uses OpenCV to process webcam feed (Python). But I can\'t seem to get access to the webcam within docker, here\'s the cod

相关标签:
2条回答
  • 2021-02-19 02:27

    Try to use this:

    -v /dev/video0:/dev/video0
    

    in place of

    --device=/dev/video0 
    

    and execute:

    $ xhost + 
    

    before docker run

    0 讨论(0)
  • 2021-02-19 02:30

    The Dockerfile in the link you provided doesn't specify how opencv was installed, can you provide the Dockerfile you used? Or how you installed opencv?

    VideoCapture(0) won't work if you install opencv via pip.

    You're using --device=/dev/video0:/dev/video0 correctly.

    0 讨论(0)
提交回复
热议问题