I am trying make the raspberry pi camera work with opencv

后端 未结 5 1494
闹比i
闹比i 2021-01-16 10:31

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

         


        
相关标签:
5条回答
  • 2021-01-16 11:00

    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

    0 讨论(0)
  • 2021-01-16 11:11

    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#) 
    
    0 讨论(0)
  • 2021-01-16 11:14

    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/

    0 讨论(0)
  • 2021-01-16 11:19

    Try the following:

    video_capture = cv2.VideoCapture(
                get_jetson_gstreamer_source(), cv2.CAP_GSTREAMER
            )
    
    0 讨论(0)
  • 2021-01-16 11:24

    The problem is that you are not coding safely.

    If you had check the return of the method, you would know instantly that 0 is not the index of your camera:

    import sys
    
    cam = cv2.VideoCapture(0)  
    if not cam:
        print("!!! Failed VideoCapture: invalid parameter!")
        sys.exit()
    

    Try numbers > 0.

    0 讨论(0)
提交回复
热议问题