Getting screen size on OpenCV

后端 未结 6 2004
独厮守ぢ
独厮守ぢ 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:28

    In Linux, try this

    #include 
    int main()
    {
     char *command="xrandr | grep '*'";
     FILE *fpipe = (FILE*)popen(command,"r");
     char line[256];
     while ( fgets( line, sizeof(line), fpipe))
     {
      printf("%s", line);
     }
     pclose(fpipe);
     return 0;
    }
    

    In Windows,

    http://cppkid.wordpress.com/2009/01/07/how-to-get-the-screen-resolution-in-pixels/

提交回复
热议问题