Reputation: 32525
I have a desktop with Windows 10 and an elgato capture card. I am using OpenCV to capture the frames of the video for processing. So far, everything works perfectly fine:
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame', gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
The next step I want to do is utilize the Remote Development Extensions. This extension, with VS Code, works perfectly fine for my other python projects. This is the first project I am writing that utilizes a hardware device, but my linux container cannot access the hardware that the host has access to. I attempted to search for a solution, but all I have found is a way for using the --device
parameter in my docker
command with the examples pointing from a *nix device path to another *nix device path.
I did come across a post from the docker desktop team that is over two (2) years old saying that you cannot access hardware from a windows host to a linux container. I'm not sure if that is still the case, and I'm not sure if the remote containers extension has a way to access the devices... there is some magic that goes on in that the extension installs a vscode-server on the container, so I'm not sure if that would allow hardware access?
Upvotes: 0
Views: 1387
Reputation: 43
According to Microsoft's Official documentation, you can't share a device from a Windows Host to a Linux container. You can however share a device to a Windows container, but I guess this isn't what you want.
You can however use docker-machine to share your devices, this is because docker-machine uses a Virtual Machine such a VirtualBox instead of their custom engine to run the container's processes.
Once you have docker-machine installed you can simply execute the command
docker-machine create --driver virtualbox <A name for the machine>
Then you open VirtualBox which should be in your programs and add the device manually.
Upvotes: 2