43
#ifndef OPENCV_CORE_OPENGL_HPP
44
#define OPENCV_CORE_OPENGL_HPP
47
# error opengl.hpp header must be compiled as C++
50
#include "opencv2/core.hpp"
53
namespace
cv
{
namespace
ogl {
86
ARRAY_BUFFER = 0x8892,
87
ELEMENT_ARRAY_BUFFER = 0x8893,
88
PIXEL_PACK_BUFFER = 0x88EB,
89
PIXEL_UNPACK_BUFFER = 0x88EC
113
Buffer(
int
arows,
int
acols,
int
atype,
unsigned
int
abufId,
bool
autoRelease =
false);
121
Buffer(
Size
asize,
int
atype,
unsigned
int
abufId,
bool
autoRelease =
false);
130
Buffer(
int
arows,
int
acols,
int
atype,
Target
target = ARRAY_BUFFER,
bool
autoRelease =
false);
145
explicit
Buffer(InputArray arr,
Target
target = ARRAY_BUFFER,
bool
autoRelease =
false);
155
void
create(
int
arows,
int
acols,
int
atype,
Target
target = ARRAY_BUFFER,
bool
autoRelease =
false);
163
void
create(
Size
asize,
int
atype,
Target
target = ARRAY_BUFFER,
bool
autoRelease =
false);
187
void
copyFrom(InputArray arr,
Target
target = ARRAY_BUFFER,
bool
autoRelease =
false);
265
int
channels()
const;
266
int
elemSize()
const;
267
int
elemSize1()
const;
291
DEPTH_COMPONENT = 0x1902,
304
Texture2D(
int
arows,
int
acols,
Format
aformat,
unsigned
int
atexId,
bool
autoRelease =
false);
328
explicit
Texture2D(InputArray arr,
bool
autoRelease =
false);
337
void
create(
int
arows,
int
acols,
Format
aformat,
bool
autoRelease =
false);
368
void
copyFrom(InputArray arr,
bool
autoRelease =
false);
484
TRIANGLE_STRIP = 0x0005,
485
TRIANGLE_FAN = 0x0006,
518
using namespace
cv::ocl;
524
CV_EXPORTS
Context& initializeContextFromGL();
564
namespace
cv
{
namespace
cuda {
585
create(arows, acols, atype, target, autoRelease);
591
create(asize, atype, target, autoRelease);
597
create(asize.height, asize.width, atype, target, autoRelease);
601
int
cv::ogl::Buffer::rows()
const
607
int
cv::ogl::Buffer::cols()
const
613
cv::Size
cv::ogl::Buffer::size()
const
615
return
Size(cols_, rows_);
619
bool
cv::ogl::Buffer::empty()
const
621
return
rows_ == 0 || cols_ == 0;
625
int
cv::ogl::Buffer::type()
const
631
int
cv::ogl::Buffer::depth()
const
633
return
CV_MAT_DEPTH(type_);
637
int
cv::ogl::Buffer::channels()
const
639
return
CV_MAT_CN(type_);
643
int
cv::ogl::Buffer::elemSize()
const
645
return
CV_ELEM_SIZE(type_);
649
int
cv::ogl::Buffer::elemSize1()
const
659
create(arows, acols, aformat, autoRelease);
665
create(asize, aformat, autoRelease);
671
create(asize.height, asize.width, aformat, autoRelease);
675
int
cv::ogl::Texture2D::rows()
const
681
int
cv::ogl::Texture2D::cols()
const
687
cv::Size
cv::ogl::Texture2D::size()
const
689
return
Size(cols_, rows_);
693
bool
cv::ogl::Texture2D::empty()
const
695
return
rows_ == 0 || cols_ == 0;
718
bool
cv::ogl::Arrays::empty()
const
This type is very similar to InputArray except that it is used for input/output and output function p...
Definition:
mat.hpp:295
n-dimensional dense array class
Definition:
mat.hpp:802
Template class for 2D rectangles
Definition:
core/types.hpp:421
static Scalar_< double > all(double v0)
returns a scalar with all elements set to v0
Template class for specifying the size of an image or rectangle.
Definition:
core/types.hpp:316
Base storage class for GPU memory with reference counting.
Definition:
core/cuda.hpp:106
This class encapsulates a queue of asynchronous calls.
Definition:
core/cuda.hpp:849
Wrapper for OpenGL Client-Side Vertex arrays.
Definition:
opengl.hpp:407
void bind() const
Binds all vertex arrays.
void release()
Releases all inner buffers.
void resetNormalArray()
Resets vertex normals.
void resetTexCoordArray()
Resets vertex texture coordinates.
void resetColorArray()
Resets vertex colors.
void resetVertexArray()
Resets vertex coordinates.
void setTexCoordArray(InputArray texCoord)
Sets an array of vertex texture coordinates.
void setAutoRelease(bool flag)
Sets auto release mode all inner buffers.
void setVertexArray(InputArray vertex)
Sets an array of vertex coordinates.
int size() const
Returns the vertex count.
void setNormalArray(InputArray normal)
Sets an array of vertex normals.
void setColorArray(InputArray color)
Sets an array of vertex colors.
Arrays()
Default constructor
Smart pointer for OpenGL buffer object with reference counting.
Definition:
opengl.hpp:80
Buffer(Size asize, int atype, unsigned int abufId, bool autoRelease=false)
void create(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
Allocates memory for ogl::Buffer object.
void create(Size asize, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
void unmapDevice(cuda::Stream &stream)
Unmaps OpenGL buffer.
void copyTo(OutputArray arr) const
Copies from OpenGL buffer to host/device memory or another OpenGL buffer object.
Mat mapHost(Access access)
Maps OpenGL buffer to host memory.
void bind(Target target) const
Binds OpenGL buffer to the specified buffer binding point.
void copyTo(OutputArray arr, cuda::Stream &stream) const
cuda::GpuMat mapDevice()
map to device memory (blocking)
Buffer(InputArray arr, Target target=ARRAY_BUFFER, bool autoRelease=false)
Target
The target defines how you intend to use the buffer object.
Definition:
opengl.hpp:85
void unmapHost()
Unmaps OpenGL buffer.
static void unbind(Target target)
Unbind any buffers from the specified binding point.
Buffer(int arows, int acols, int atype, unsigned int abufId, bool autoRelease=false)
Buffer clone(Target target=ARRAY_BUFFER, bool autoRelease=false) const
Creates a full copy of the buffer object and the underlying data.
void release()
Decrements the reference counter and destroys the buffer object if needed.
cuda::GpuMat mapDevice(cuda::Stream &stream)
Maps OpenGL buffer to CUDA device memory.
void copyFrom(InputArray arr, Target target=ARRAY_BUFFER, bool autoRelease=false)
Copies from host/device memory to OpenGL buffer.
unsigned int bufId() const
get OpenGL opject id
void copyFrom(InputArray arr, cuda::Stream &stream, Target target=ARRAY_BUFFER, bool autoRelease=false)
Buffer()
The constructors.
Buffer(Size asize, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
Buffer(int arows, int acols, int atype, Target target=ARRAY_BUFFER, bool autoRelease=false)
void setAutoRelease(bool flag)
Sets auto release mode.
Smart pointer for OpenGL 2D texture memory with reference counting.
Definition:
opengl.hpp:284
Texture2D(int arows, int acols, Format aformat, unsigned int atexId, bool autoRelease=false)
Format
An Image Format describes the way that the images in Textures store their data.
Definition:
opengl.hpp:289
Texture2D(int arows, int acols, Format aformat, bool autoRelease=false)
void copyTo(OutputArray arr, int ddepth=CV_32F, bool autoRelease=false) const
Copies from OpenGL texture to host/device memory or another OpenGL texture object.
Texture2D(Size asize, Format aformat, bool autoRelease=false)
Texture2D(Size asize, Format aformat, unsigned int atexId, bool autoRelease=false)
void create(int arows, int acols, Format aformat, bool autoRelease=false)
Allocates memory for ogl::Texture2D object.
Texture2D(InputArray arr, bool autoRelease=false)
Texture2D()
The constructors.
void release()
Decrements the reference counter and destroys the texture object if needed.
void bind() const
Binds texture to current active texture unit for GL_TEXTURE_2D target.
void copyFrom(InputArray arr, bool autoRelease=false)
Copies from host/device memory to OpenGL texture.
void setAutoRelease(bool flag)
Sets auto release mode.
unsigned int texId() const
get OpenGL opject id
void create(Size asize, Format aformat, bool autoRelease=false)
CV_EXPORTS UMat mapGLBuffer(const Buffer &buffer, AccessFlag accessFlags=ACCESS_READ|ACCESS_WRITE)
Maps Buffer object to process on CL side (convert to UMat).
CV_EXPORTS void convertFromGLTexture2D(const Texture2D &texture, OutputArray dst)
Converts Texture2D object to OutputArray.
CV_EXPORTS void render(const Arrays &arr, InputArray indices, int mode=POINTS, Scalar color=Scalar::all(255))
CV_EXPORTS void convertToGLTexture2D(InputArray src, Texture2D &texture)
Converts InputArray to Texture2D object.
CV_EXPORTS void setGlDevice(int device=0)
Sets a CUDA device and initializes it for the current thread with OpenGL interoperability.
RenderModes
render mode
Definition:
opengl.hpp:478
CV_EXPORTS void unmapGLBuffer(UMat &u)
Unmaps Buffer object (releases UMat, previously mapped from Buffer).
#define CV_ELEM_SIZE1(type)
Definition:
cvdef.h:484
Target
Enum of target devices for computations.
Definition:
dnn/dnn.hpp:88
"black box" representation of the file storage associated with a file on disk.
Definition:
aruco.hpp:75
Definition:
cvstd_wrapper.hpp:74