- I am processing real time video from logitech c922 webcam in python. I can set width and hight using the below functions successfully:
However, I can’t able to set the focus type(manual) and FPS using below functions:
How to do it?
- I have attached python code which displays realtime video with FPS.
import cv2 import time font = cv2.FONT_HERSHEY_SIMPLEX camera = cv2.VideoCapture(0) camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080) #1080, 720, 360 camera.set(cv2.CAP_PROP_FRAME_WIDTH, 1920) #1920, 1280, 640 while True: start = time.time() ret, image = camera.read() [h, w, d] = image.shape if cv2.waitKey(1)& 0xFF == ord('q'): break; end = time.time() fps = "FPS: %.1f" % (1/(end - start)) cv2.putText(image, fps, (0, 25), font, 1, (0, 0, 255), 2) cv2.imshow('Image', image) camera.release() cv2.destroyAllWindows()
Actual problem is for 1080p resolution FPS is 30. But i am getting 46 fps(oscillating values) sometimes as per the above calculation, while using logitech c922 webcam.
how to calculate FPS exactly? Is there any other formula to find it? or Is there any explanation behind it? Please help to let me know about it…