Trouble in getting 60 fps using webcam(Logitech c922 pro stream)

asked 2018-01-27 06:56:25 -0600

Toyas gravatar image

I am using OpenCV 3.1.0 which I have installed using Anaconda menpo and python 3.5 System config: i7 6700HQ 8 GB ram This is the code:

Blockquote

import cv2
import time 
cap = cv2.VideoCapture(1)
cap.set(5, 60)

framecount = 0
prevMillis = 0

print(cap.get(5))

def fpsCount():
    global prevMillis
    global framecount
    millis = int(round(time.time() * 1000))
    framecount += 1
    if millis - prevMillis > 1000:
        print(framecount)
        prevMillis = millis 
        framecount = 0

while True:
    __, frame = cap.read()
    #frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    #blur = cv2.blur(frame, (5, 5))
    #ret, thresh = cv2.threshold(blur, 170, 255, 0)
    cv2.imshow("Image", frame)


    fpsCount()    
    k = cv2.waitKey(1) & 0xff
    if k == 27:
        break



cap.release()
cv2.destroyAllWindows()

It prints 60.0000 first indicating cap set is executed properly. But the FPS counting function that I have written prints 30 fps max. I really need 60 FPS for my application. Can anyone help in getting 60 FPS with Logitech c922.

edit retag flag offensive close merge delete