Hello, I have problem that my video preview from cv2 is lagging around 2 fps even my webcam has 30 fps specification. And when I rendering my code, it needs more than 30 sec to respond. What’s the problem? My PC or anything else?
Thanks for help
Hello, I have problem that my video preview from cv2 is lagging around 2 fps even my webcam has 30 fps specification. And when I rendering my code, it needs more than 30 sec to respond. What’s the problem? My PC or anything else?
Thanks for help
welcome.
print timestamps in your code at relevant points.
post your code, any data, the output including timestamps. also precisely describe all hardware that might be involved, certainly the make and model of your camera.
For my project, I use pyzbar module and this is my code
from cv2 import cv2
import numpy
from pyzbar.pyzbar import decode
#img = cv2.imread('12.jpg')
cap = cv2.VideoCapture(0)
cap.set(3,640)
cap.set(4,480)
while True:
success, img = cap.read()
for barcode in decode(img):
print(barcode.data)
myData = barcode.data.decode('utf-8')
print(myData)
pts = numpy.array([barcode.polygon],numpy.int32)
pts = pts.reshape((-1,1,2))
cv2.polylines(img,[pts],True,(255,0,255),5)
pts2 = barcode.rect
cv2.putText(img,myData,(pts2[0],pts2[1]),cv2.FONT_HERSHEY_SIMPLEX,0.9,(225,0,225),2)
cv2.imshow("Result",img)
cv2.waitKey(5000)
I use 2 camera actually in the same times. My Web camera is NYK A90 NEMESIS with specification 30 fps autofocus. there is no problem in normal use, but when I use to compile my code, i just get 1 frame per 2 sec. My PC has Intel Core i3 4th gen. Can you help me to solve this?
Thanks for helping me
(You don’t compile Rython code, you just run it…)
General debugging:
…And then… Your waitKey waits 5000 ms for each frame…
Oh, my mistake
I dont know the purpose of waitkey actually haha. I’m newbie here so I’ll learn more. Sorry and thank you so much for your help