I am trying make the raspberry pi camera work with opencv

后端 未结 5 1546
闹比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: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.

提交回复
热议问题