Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I set webcam resolution with opencv in python?

I'm trying to get the maximum resolution that my webcam has..! But I have no idea how to do it.. Does anyone had this problem before? Please give me some comments below. Thanks. Here's my codes.

vs = VideoStream(src=0).start()

fileStream = False

time.sleep(1.0)

total = 0

pre = 0

while True:

if fileStream and not vs.more():

    break

frame = vs.read()
frame = cv2.flip(frame,1)
frame = imutils.resize(frame, width=1280)
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

...