问题
cap = cv2.VideoCapture(0) is not opening web camera when executing the command in Google Colab.
回答1:
Since Colab is running in your browser, you'll want to use web APIs to access local hardware like a camera.
Here's an example showing how to capture an image from your local webcam in Colab: https://colab.research.google.com/notebooks/snippets/advanced_outputs.ipynb#scrollTo=2viqYx97hPMi
来源:https://stackoverflow.com/questions/54389727/how-to-use-cap-cv2-videocapture0-in-google-colab