本文整理汇总了C++中InputArray::getOGlTexture2D方法的典型用法代码示例。如果您正苦于以下问题:C++ InputArray::getOGlTexture2D方法的具体用法?C++ InputArray::getOGlTexture2D怎么用?C++ InputArray::getOGlTexture2D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputArray
的用法示例。
在下文中一共展示了InputArray::getOGlTexture2D方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setAutoRelease
void cv::ogl::Buffer::copyFrom(InputArray arr, Target target, bool autoRelease)
{
#ifndef HAVE_OPENGL
(void) arr;
(void) target;
(void) autoRelease;
throw_nogl();
#else
const int kind = arr.kind();
if (kind == _InputArray::OPENGL_TEXTURE)
{
ogl::Texture2D tex = arr.getOGlTexture2D();
tex.copyTo(*this);
setAutoRelease(autoRelease);
return;
}
const Size asize = arr.size();
const int atype = arr.type();
create(asize, atype, target, autoRelease);
switch (kind)
{
case _InputArray::OPENGL_BUFFER:
{
ogl::Buffer buf = arr.getOGlBuffer();
impl_->copyFrom(buf.bufId(), asize.area() * CV_ELEM_SIZE(atype));
break;
}
case _InputArray::GPU_MAT:
{
#if !defined HAVE_CUDA || defined(CUDA_DISABLER)
throw_nocuda();
#else
GpuMat dmat = arr.getGpuMat();
impl_->copyFrom(dmat.data, dmat.step, dmat.cols * dmat.elemSize(), dmat.rows);
#endif
break;
}
default:
{
Mat mat = arr.getMat();
CV_Assert( mat.isContinuous() );
impl_->copyFrom(asize.area() * CV_ELEM_SIZE(atype), mat.data);
}
}
#endif
}
示例2: switch
GpuMat cv::superres::arrGetGpuMat(InputArray arr, GpuMat& buf)
{
switch (arr.kind())
{
case _InputArray::GPU_MAT:
return arr.getGpuMat();
case _InputArray::OPENGL_BUFFER:
arr.getOGlBuffer().copyTo(buf);
return buf;
case _InputArray::OPENGL_TEXTURE:
arr.getOGlTexture2D().copyTo(buf);
return buf;
default:
buf.upload(arr.getMat());
return buf;
}
}
示例3: imshow
void cv::imshow( const std::string& winname, InputArray _img )
{
#ifndef HAVE_OPENGL
Mat img = _img.getMat();
CvMat c_img = img;
cvShowImage(winname.c_str(), &c_img);
#else
const double useGl = getWindowProperty(winname, WND_PROP_OPENGL);
if (useGl <= 0)
{
Mat img = _img.getMat();
CvMat c_img = img;
cvShowImage(winname.c_str(), &c_img);
}
else
{
const double autoSize = getWindowProperty(winname, WND_PROP_AUTOSIZE);
if (autoSize > 0)
{
Size size = _img.size();
resizeWindow(winname, size.width, size.height);
}
setOpenGlContext(winname);
if (_img.kind() == _InputArray::OPENGL_TEXTURE)
{
cv::ogl::Texture2D& tex = wndTexs[winname];
tex = _img.getOGlTexture2D();
tex.setAutoRelease(false);
setOpenGlDrawCallback(winname, glDrawTextureCallback, &tex);
}
else
{
cv::ogl::Texture2D& tex = ownWndTexs[winname];
if (_img.kind() == _InputArray::GPU_MAT)
{
cv::ogl::Buffer& buf = ownWndBufs[winname];
buf.copyFrom(_img);
buf.setAutoRelease(false);
tex.copyFrom(buf);
tex.setAutoRelease(false);
}
else
{
tex.copyFrom(_img);
}
tex.setAutoRelease(false);
setOpenGlDrawCallback(winname, glDrawTextureCallback, &tex);
}
updateWindow(winname);
}
#endif
}