1

cap = cv2.VideoCapture(0)

When I run this, it activates webcam of laptop. I want to view the USB camera connected to the Pi on my Windows PC's screen. Both are connected to the same LAN. I want to use the PC as the processor, and the Pi to capture camera input. The Pi is located remotely. How can I achieve this?

1
  • You cannot interface hardware on other machines over network. It is impossible (I would love to but the network is too slow) You must start the camera on Pi, then send the video stream over network. Which format you use is depends on your requirements.
    – WillyWonka
    Nov 9, 2016 at 8:01

2 Answers 2

3

If your network is fast enough for USB traffic, you can use USB/IP to access your USB camera remotely. Run the usbipd server on the RPi to export the webcam and usbip client on your laptop to "attach" it.

Note that RPi is quite limited in terms of data rates, so don't expect high framerates.

2

You'll need to capture and stream the video from the Pi to your desktop. There's an example of streaming mjpeg video from a device using Python/Flask, to a second device running Python/OpenCV here on chioka.in. The example is a little too long to post in full, and may require some tweaking to get it working with a USB camera on the Pi. This should work fine if it's run when the Pi boots, meaning that your camera feed starts when the Pi does and stops when it's shut down.

If you would like to be able to trigger starting and stopping the camera you'd be best off doing some further research on Flask and implementing suitable controls in the index.html file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.