• [opencv&opengl]多窗口显示


    OPENGL:

    main()函数

        int window1 = 0,window2 = 0;
        glutInit(&argc,argv);
        glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
        glutInitWindowSize(ImageWidth,ImageHeight);
    
        glutInitWindowPosition(1920,0);
        window1 = glutCreateWindow("1");
        glutDisplayFunc(display1);
    
        glutInitWindowPosition(1920+1280,0);
        window2 = glutCreateWindow("2");
        glutDisplayFunc(display2);
    
        glutMainLoop();
    void display1()
    {
        glClear(GL_COLOR_BUFFER_BIT);
        glDrawPixels(ImageWidth,ImageHeight,GL_BGR_EXT,GL_UNSIGNED_BYTE,PixelData1);
        glutSwapBuffers();
    }
    
    void display2()
    {
        glClear(GL_COLOR_BUFFER_BIT);
        glDrawPixels(ImageWidth,ImageHeight,GL_BGR_EXT,GL_UNSIGNED_BYTE,PixelData2);
        glutSwapBuffers();
    }

    OPENCV:

        stringstream winName;
        for(int i = 0;i < DISPLAYWINDOWS;i++)
        {
            winName.clear();winName.str("");
            winName<<i;
            namedWindow(winName.str(),CV_WINDOW_NORMAL);
            cv::moveWindow(winName.str(),1920 + ImageWidth * i,0);
            setWindowProperty(winName.str(), CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN );
        }
        
        for(int i = 0;i < DISPLAYWINDOWS;i++)
        {
            winName.clear();winName.str("");
            winName<<i;
            imshow(winName.str(),disLoop[i]);
            waitKey(1);
        }
    主要用到的是moveWindow这个函数。

    代码下载:https://github.com/zhanxiage1994/multi-WindowsDisplay.git
  • 相关阅读:
    sws_getContext函数参数介绍
    FFmpeg 将YUV数据转RGB
    信号槽同步
    git stash
    Qt 事件
    Qt 信号与槽函数
    微信红包的算法实现
    Python正则表达式中的re.S
    hive函数 -- split 字符串分割函数
    python None与Null
  • 原文地址:https://www.cnblogs.com/zhanxiage1994/p/6151326.html
Copyright © 2020-2023  润新知