Getting screen size on OpenCV

后端 未结 6 2010
独厮守ぢ
独厮守ぢ 2021-02-19 09:04

How do I get the computer screen resolution on OpenCV? I need to show two images side by side using the whole screen width, OpenCV requires the exact window size I wanna create.

6条回答
  •  日久生厌
    2021-02-19 09:16

    Using opencv instead of OS functions:

    cv.namedWindow("dst", cv.WND_PROP_FULLSCREEN)
    cv.setWindowProperty("dst",cv.WND_PROP_FULLSCREEN,cv.WINDOW_FULLSCREEN)
    (a,b,screenWidth,screenHeight) = cv.getWindowImageRect('dst')
    

    So I create a window in full-screen mode and ask for its width and height

    It should work for any OS, but it worked only for Windows. Under Linux, the window wasn't full-screen.

提交回复
热议问题