OpenCV (via python) on Linux: Set frame width/height?

前端 未结 5 1735
庸人自扰
庸人自扰 2021-01-02 00:02

I\'m using openCV via python on linux (ubuntu 12.04), and I have a logitech c920 from which I\'d like to grab images. Cheese is able to grab frames up to really high resolut

5条回答
  •  渐次进展
    2021-01-02 00:39

    It seems to be variable by cammera.

    AFIK, Logitech cameras have particularly bad linux support (though It;s gotten better) Most of their issues are with advanced features like focus control. i would advise sticking with basic cameras (IE manual focus Logitech cameras) just to play it safe.

    My built in laptop camera has no issue and displays at normal resolution.
    My external logitech pro has issues initalizing.

    However, I can overcome the resolution issue with these two lines.

    Yes, they are the same as you used.

    cv.SetCaptureProperty(self.capture,cv.CV_CAP_PROP_FRAME_WIDTH, 1280)
    cv.SetCaptureProperty(self.capture,cv.CV_CAP_PROP_FRAME_HEIGHT, 720)
    

    My Logitech still throws errors but the resolution is fine.

    Please make sure the resolution you set is a supported by your camera or v4l will yell at you. If I set an unsupported native resolution, I have zero success.

提交回复
热议问题