Lag with opencv
See original GitHub issueFirst of all, i’d like to say thank you for your previous solving of blue raw.
opencv preview is lagging about 2 seconde on preview i have a lag of about 2s with logitech webcam C920
I try this script in python without lagging:
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
while(True):
# Capture frame-by-frame
ret, frame = cap.read()
# Display the resulting frame
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
Steps to reproduce the bug
- take a photo
- preview is late about 2-3 sec
- See error.
Is alpha or resizing, can cause this delay? Is it possible to downsample preview to erase latency?
Environment
- OS [Raspbian Buster]
- Camera [Logitech C920]
- Pibooth version [1.1.4]
Thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (5 by maintainers)
Top Results From Across the Web
OpenCV VideoCapture lag due to the capture buffer
In a nutshell: the time needed to query a frame is measured; if it is too low, it means the frame was read...
Read more >My video preview is lagging so bad, what's the problem?
Hello, I have problem that my video preview from cv2 is lagging around 2 fps even my webcam has 30 fps specification.
Read more >OpenCV camera lag - Jetson Nano - NVIDIA Developer Forums
Someone knows why there's that lag in OpenCV, and how can I solve that? I need to show both cameras at once. NV...
Read more >Fixing opencv lag - Programming - Chief Delphi
We did our image processing in python using OpenCV in a single thread, and didn't have any lag problems. Here are some thoughts...
Read more >How to get rid the lag of webcam when using opencv? - Reddit
My project has a face recognition, but my web cam is lag. I already fix the lag when I am coding in my...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In my case the camera was not using the right codec. I used this command to get all the available Codecs.
v4l2-ctl --list-formats-extmy camera used YUYV which was capable of 6 fps at 1920x1080.
Changed the settings to
cam.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter.fourcc('M','J','P','G'))whichs had NO result eighter.insted of accesssing the camer by index i used
reversingCam = cv2.VideoCapture("/dev/video0")which made things working.heres my whole Code:
OpenCV camera improved in
piboothv2.0.2Please re-open the issue if you are still facing to the same issue.
BR anxuae