Python OpenCV access webcam maximum resolution

前端 未结 6 1592
栀梦
栀梦 2020-12-16 12:44

I am trying to acquire images from my webcam using a python code that imports OpenCV. The code is the following:

import sys
sys.path.append(\"C:\\\\opencv\\         


        
6条回答
  •  有刺的猬
    2020-12-16 13:07

    I used the different resolutions to set image resolution from List of common resolutions by looping over

    def set_res(cap, x,y):
        cap.set(cv.CV_CAP_PROP_FRAME_WIDTH, int(x))
        cap.set(cv.CV_CAP_PROP_FRAME_HEIGHT, int(y))
        return str(cap.get(cv.CV_CAP_PROP_FRAME_WIDTH)),str(cap.get(cv.CV_CAP_PROP_FRAME_HEIGHT))
    

    It seems that OpenCV or my camera allows only certain resolutions.

    • 160.0 x 120.0

    • 176.0 x 144.0

    • 320.0 x 240.0

    • 352.0 x 288.0

    • 640.0 x 480.0

    • 1024.0 x 768.0

    • 1280.0 x 1024.0

提交回复
热议问题