Skip to content Skip to sidebar Skip to footer

I Am Trying Make The Raspberry Pi Camera Work With Opencv

I tried making this code work with the raspberry pi cam. how do you make the cv2.VideoCapture(0) recognise the raspberry pi camera as the designated camera import cv2 def diffImg

Solution 1:

You cannot use cv2.VideoCapture() for RaspiCam.

The cv2.VideoCapture() is only for USB camera, not for CSI camera.

If you want to use RaspiCam for capturing, you can refer this tutorial

Update: The answer is no longer correct since now you can use cv2.VideoCapture() as the comment mentioned bellow.

Solution 2:

Some time ago, I developed on a rasperry pi with raspicam, an interface for opencv. I thought that the video capture in pure cv only works for usb devices

You can download raspicam under http://sourceforge.net/projects/raspicam/files/

Solution 3:

From what I can understand, you need to find the location # of the raspberry pi camera and change

cam = cv2.VideoCapture(0)

to

cam = cv2.VideoCapture(Camera#) 

Solution 4:

Try the following:

video_capture = cv2.VideoCapture(
            get_jetson_gstreamer_source(), cv2.CAP_GSTREAMER
        )

Post a Comment for "I Am Trying Make The Raspberry Pi Camera Work With Opencv"