Skip to content

VideoCapture.set() not working correctly? #529

@oliver-wm

Description

@oliver-wm

Expected behaviour

vc = cv2.VideoCapture(TARGET)
vc.set(cv2.CAP_PROP_FRAME_WIDTH,1920)
vc.set(cv2.CAP_PROP_FRAME_HEIGHT,1080)
vc.set(cv2.CAP_PROP_FPS, 30.0)
vc.set(cv2.CAP_PROP_SATURATION, 50)
vc.set(cv2.CAP_PROP_SHARPNESS,100)

if not vc.isOpened():
    sys.stderr.write('could not connect to camera! \n')
    sys.exit(1)

while True:
    success,frame = vc.read()
    if not success:
        sys.stderr.write('could not read image from cam \n')
        sys.exit(1)
    cv2.imshow('my webcam', frame)
    # cv2.imwrite('capture_%02d.png' % count,frame)
    if cv2.waitKey(1) == 27:
        break  # esc to quit

cv2.destroyAllWindows()
vc.release()
vc = None

Actual behaviour

only getting 5 fps when should be 30, not sure why? Camera supports 30fps.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions