OpenCV 4.12.0
開源計算機視覺
載入中...
搜尋中...
無匹配項
OpenGL支援

詳細描述

函式

void cv::imshow (const String &winname, const ogl::Texture2D &tex)
 在指定視窗中顯示 OpenGL 2D 紋理。
 
void cv::setOpenGlContext (const String &winname)
 將指定視窗設定為當前OpenGL上下文。
 
void cv::setOpenGlDrawCallback (const String &winname, OpenGlDrawCallback onOpenGlDraw, void *userdata=0)
 設定一個回撥函式,用於在顯示的影像上進行繪製。
 
void cv::updateWindow (const String &winname)
 強制視窗重新繪製其上下文並呼叫繪製回撥(參見 cv::setOpenGlDrawCallback)。
 

函式文件

◆ imshow()

void cv::imshow ( const String & 視窗名稱,
const ogl::Texture2D & tex )
Python
cv.imshow(winname, mat) ->

#include <opencv2/highgui.hpp>

在指定視窗中顯示 OpenGL 2D 紋理。

引數
視窗名稱視窗名稱。
texOpenGL 2D 紋理資料。

◆ setOpenGlContext()

void cv::setOpenGlContext ( const String & 視窗名稱)

#include <opencv2/highgui.hpp>

將指定視窗設定為當前OpenGL上下文。

引數
視窗名稱視窗名稱。

◆ setOpenGlDrawCallback()

void cv::setOpenGlDrawCallback ( const String & 視窗名稱,
OpenGlDrawCallback onOpenGlDraw,
void * userdata = 0 )

#include <opencv2/highgui.hpp>

設定一個回撥函式,用於在顯示的影像上進行繪製。

函式 setOpenGlDrawCallback 可用於在視窗上繪製 3D 資料。請參閱下面的回撥函式示例

void on_opengl(void* param)
{
glLoadIdentity();
glTranslated(0.0, 0.0, -1.0);
glRotatef( 55, 1, 0, 0 );
glRotatef( 45, 0, 1, 0 );
glRotatef( 0, 0, 0, 1 );
static const int coords[6][4][3] = {
{ { +1, -1, -1 }, { -1, -1, -1 }, { -1, +1, -1 }, { +1, +1, -1 } },
{ { +1, +1, -1 }, { -1, +1, -1 }, { -1, +1, +1 }, { +1, +1, +1 } },
{ { +1, -1, +1 }, { +1, -1, -1 }, { +1, +1, -1 }, { +1, +1, +1 } },
{ { -1, -1, -1 }, { -1, -1, +1 }, { -1, +1, +1 }, { -1, +1, -1 } },
{ { +1, -1, +1 }, { -1, -1, +1 }, { -1, -1, -1 }, { +1, -1, -1 } },
{ { -1, -1, +1 }, { +1, -1, +1 }, { +1, +1, +1 }, { -1, +1, +1 } }
};
for (int i = 0; i < 6; ++i) {
glColor3ub( i*20, 100+i*10, i*42 );
glBegin(GL_QUADS);
for (int j = 0; j < 4; ++j) {
glVertex3d(0.2 * coords[i][j][0], 0.2 * coords[i][j][1], 0.2 * coords[i][j][2]);
}
glEnd();
}
}
引數
視窗名稱視窗名稱。
onOpenGlDraw指向每幀呼叫的函式的指標。該函式應原型化為 void Foo(void*) 。
使用者資料傳遞給回撥函式的指標。(可選

◆ updateWindow()

void cv::updateWindow ( const String & 視窗名稱)

#include <opencv2/highgui.hpp>

強制視窗重新繪製其上下文並呼叫繪製回撥(參見 cv::setOpenGlDrawCallback)。

引數
視窗名稱視窗名稱。