I am working on a project with OpenCV. It is running on a Raspberry Pi 3 B+. When i start the camera, and do some visual processing the framerate becomes really low and there is a lot of lag. My question is: Would lowering the camera resolution solve my problem(if yes how do I do it)?

1 Answer 1


If you are using the full resolution and a high frame rate, it is very likely that the processor and/or memory is getting exhausted (depending on what kind of processing you are doing). So, yes, lowering the camera resolution may solve the problem.
You do not say what programming language you are using. In python you can change the resolution like this:

import cv2

cap = cv2.VideoCapture(0)

cap.set(3, 640)  # Set horizontal resolution
cap.set(4, 480)  # Set vertical resolution

_, img = cap.read()
cv2.imwrite("lower_res.jpeg", img)

Further reference here: https://docs.opencv.org/3.3.0/d8/dfe/classcv_1_1VideoCapture.html#a8c6d8c2d37505b5ca61ffd4bb54e9a7c


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.