I am running Ubuntu 16.04 in a VirtualBox VM on a Windows 10 machine and wanted to access the laptop’s webcam from a Python script running in the Ubuntu VM. The trick (as described here) is to enter this line on the host while the VM is running:
VboxManage controlvm "vmname" webcam attach .0
where vmname is the name of the VM to be modified.
There doesn’t seem to be any need to add a USB filter for the webcam – doing that doesn’t seem to help at all.
The only problem with this is that the change isn’t permanent – it has to be run each time the VM is started. Simplest way to deal with that is to start the VM from a batch file:
cd "c:\Program Files\Oracle\VirtualBox" VboxManage startvm "vmname" VboxManage controlvm "vmname" webcam attach .0
Incidentally, this attaches the default webcam. Individual ones can be specified using .1, .2 etc. Use:
VboxManage list webcams
to get a list of webcams and aliases.