One of the series that I re-examine every time I need it. This is a method to set the frame size and FPS when handling a webcam using OpenCV.
video_input.set(cv2.CAP_PROP_FPS, 60) #Set camera FPS to 60 FPS
video_input.set(cv2.CAP_PROP_FRAME_WIDTH, 1280) #Set the width of the camera image to 1280
video_input.set(cv2.CAP_PROP_FRAME_HEIGHT, 720) #Set the vertical width of the camera image to 720
print video_input.get(cv2.CAP_PROP_FPS)
print video_input.get(cv2.CAP_PROP_FRAME_WIDTH)
print video_input.get(cv2.CAP_PROP_FRAME_HEIGHT)
The reason why I investigated it again is that it is the successor to the ace c920r in the USB 2.0 Web camera world. I bought the Logitech c922. [Logitech C922](https://www.amazon.co.jp/Logitech-%E3%83%AD%E3%82%B8%E3%82%AF%E3%83%BC%E3%83%AB- C922-% E3% 82% B9% E3% 83% 88% E3% 83% AA% E3% 83% BC% E3% 83% 9F% E3% 83% B3% E3% 82% B0-% E3% 82% A6% E3% 82% A7% E3% 83% 96% E3% 82% AB% E3% 83% A0 / dp / B01LYTKPDT "Logitech C922")
There is almost no difference in performance from c920r, but I was attracted to the notation of 720p (60fps) and purchased it. Even if it is a USB3.0 type industrial camera, it is rare for a Web camera that claims 60fps on a commercial machine.
Below, a trial shot video ↓ After all, object tracking is more stable when the frame rate is higher. [](https://www.youtube.com / watch? v = jOI7IaZHcVw)
The source code is below ↓ It also incorporates a program to change fps. [Ubuntu] [Python] Object tracking using dlib
that's all.
Recommended Posts