\r
#ifdef HAVE_OPENGL\r
#include <GL/gl.h>\r
- #include <Gl/glu.h>\r
+ #include <GL/glu.h>\r
\r
#ifdef HAVE_CUDA\r
#include <cuda_gl_interop.h>\r
////////////////////////////////////////////////////////////////////////\r
// GpuMat\r
\r
-cv::gpu::GpuMat::GpuMat(const GpuMat& m) \r
+cv::gpu::GpuMat::GpuMat(const GpuMat& m)\r
: flags(m.flags), rows(m.rows), cols(m.cols), step(m.step), data(m.data), refcount(m.refcount), datastart(m.datastart), dataend(m.dataend)\r
{\r
if (refcount)\r
CV_XADD(refcount, 1);\r
}\r
\r
-cv::gpu::GpuMat::GpuMat(int rows_, int cols_, int type_, void* data_, size_t step_) : \r
- flags(Mat::MAGIC_VAL + (type_ & TYPE_MASK)), rows(rows_), cols(cols_), \r
+cv::gpu::GpuMat::GpuMat(int rows_, int cols_, int type_, void* data_, size_t step_) :\r
+ flags(Mat::MAGIC_VAL + (type_ & TYPE_MASK)), rows(rows_), cols(cols_),\r
step(step_), data((uchar*)data_), refcount(0),\r
datastart((uchar*)data_), dataend((uchar*)data_)\r
{\r
}\r
else\r
{\r
- if (rows == 1) \r
+ if (rows == 1)\r
step = minstep;\r
\r
CV_DbgAssert(step >= minstep);\r
dataend += step * (rows - 1) + minstep;\r
}\r
\r
-cv::gpu::GpuMat::GpuMat(Size size_, int type_, void* data_, size_t step_) : \r
+cv::gpu::GpuMat::GpuMat(Size size_, int type_, void* data_, size_t step_) :\r
flags(Mat::MAGIC_VAL + (type_ & TYPE_MASK)), rows(size_.height), cols(size_.width),\r
step(step_), data((uchar*)data_), refcount(0),\r
datastart((uchar*)data_), dataend((uchar*)data_)\r
}\r
else\r
{\r
- if (rows == 1) \r
+ if (rows == 1)\r
step = minstep;\r
\r
CV_DbgAssert(step >= minstep);\r
rows = cols = 0;\r
}\r
\r
-cv::gpu::GpuMat::GpuMat(const GpuMat& m, Rect roi) : \r
+cv::gpu::GpuMat::GpuMat(const GpuMat& m, Rect roi) :\r
flags(m.flags), rows(roi.height), cols(roi.width),\r
step(m.step), data(m.data + roi.y*step), refcount(m.refcount),\r
datastart(m.datastart), dataend(m.dataend)\r
rows = cols = 0;\r
}\r
\r
-cv::gpu::GpuMat::GpuMat(const Mat& m) : \r
- flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0) \r
-{ \r
- upload(m); \r
+cv::gpu::GpuMat::GpuMat(const Mat& m) :\r
+ flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0)\r
+{\r
+ upload(m);\r
}\r
\r
GpuMat& cv::gpu::GpuMat::operator = (const GpuMat& m)\r
void cv::gpu::GpuMat::swap(GpuMat& b)\r
{\r
std::swap(flags, b.flags);\r
- std::swap(rows, b.rows); \r
+ std::swap(rows, b.rows);\r
std::swap(cols, b.cols);\r
- std::swap(step, b.step); \r
+ std::swap(step, b.step);\r
std::swap(data, b.data);\r
std::swap(datastart, b.datastart);\r
std::swap(dataend, b.dataend);\r
\r
GpuMat& cv::gpu::GpuMat::adjustROI(int dtop, int dbottom, int dleft, int dright)\r
{\r
- Size wholeSize; \r
+ Size wholeSize;\r
Point ofs;\r
locateROI(wholeSize, ofs);\r
\r
size_t esz = elemSize();\r
\r
- int row1 = std::max(ofs.y - dtop, 0); \r
+ int row1 = std::max(ofs.y - dtop, 0);\r
int row2 = std::min(ofs.y + rows + dbottom, wholeSize.height);\r
\r
int col1 = std::max(ofs.x - dleft, 0);\r
int col2 = std::min(ofs.x + cols + dright, wholeSize.width);\r
\r
data += (row1 - ofs.y) * step + (col1 - ofs.x) * esz;\r
- rows = row2 - row1; \r
+ rows = row2 - row1;\r
cols = col2 - col1;\r
\r
if (esz * cols == step || rows == 1)\r
\r
namespace\r
{\r
- void throw_nogpu() \r
- { \r
- CV_Error(CV_GpuNotSupported, "The library is compiled without GPU support"); \r
+ void throw_nogpu()\r
+ {\r
+ CV_Error(CV_GpuNotSupported, "The library is compiled without GPU support");\r
}\r
\r
class EmptyFuncTable : public GpuFuncTable\r
\r
#else // HAVE_CUDA\r
\r
-namespace cv { namespace gpu { namespace device \r
+namespace cv { namespace gpu { namespace device\r
{\r
void copy_to_with_mask(DevMem2Db src, DevMem2Db dst, int depth, DevMem2Db mask, int channels, cudaStream_t stream);\r
\r
\r
namespace cv { namespace gpu\r
{\r
- CV_EXPORTS void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask, cudaStream_t stream = 0) \r
- { \r
+ CV_EXPORTS void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask, cudaStream_t stream = 0)\r
+ {\r
::cv::gpu::device::copy_to_with_mask(src, dst, src.depth(), mask, src.channels(), stream);\r
}\r
\r
CV_EXPORTS void convertTo(const GpuMat& src, GpuMat& dst)\r
{\r
::cv::gpu::device::convert_gpu(src.reshape(1), src.depth(), dst.reshape(1), dst.depth(), 1.0, 0.0, 0);\r
- } \r
+ }\r
\r
CV_EXPORTS void convertTo(const GpuMat& src, GpuMat& dst, double alpha, double beta, cudaStream_t stream = 0)\r
{\r
{\r
typedef void (*caller_t)(GpuMat& src, Scalar s, cudaStream_t stream);\r
\r
- static const caller_t callers[] = \r
+ static const caller_t callers[] =\r
{\r
kernelSetCaller<uchar>, kernelSetCaller<schar>, kernelSetCaller<ushort>, kernelSetCaller<short>, kernelSetCaller<int>,\r
kernelSetCaller<float>, kernelSetCaller<double>\r
{\r
typedef void (*caller_t)(GpuMat& src, Scalar s, const GpuMat& mask, cudaStream_t stream);\r
\r
- static const caller_t callers[] = \r
+ static const caller_t callers[] =\r
{\r
kernelSetCaller<uchar>, kernelSetCaller<schar>, kernelSetCaller<ushort>, kernelSetCaller<short>, kernelSetCaller<int>,\r
kernelSetCaller<float>, kernelSetCaller<double>\r
\r
cudaSafeCall( cudaDeviceSynchronize() );\r
}\r
- }; \r
+ };\r
\r
//////////////////////////////////////////////////////////////////////////\r
// Set\r
- \r
+\r
template<int SDEPTH, int SCN> struct NppSetFunc\r
{\r
typedef typename NPPTypeTraits<SDEPTH>::npp_type src_t;\r
\r
cudaSafeCall( cudaDeviceSynchronize() );\r
}\r
- }; \r
+ };\r
\r
template<int SDEPTH, int SCN> struct NppSetMaskFunc\r
{\r
\r
cudaSafeCall( cudaDeviceSynchronize() );\r
}\r
- }; \r
+ };\r
\r
class CudaFuncTable : public GpuFuncTable\r
{\r
public:\r
- void copy(const Mat& src, GpuMat& dst) const \r
- { \r
+ void copy(const Mat& src, GpuMat& dst) const\r
+ {\r
cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyHostToDevice) );\r
}\r
void copy(const GpuMat& src, Mat& dst) const\r
- { \r
+ {\r
cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyDeviceToHost) );\r
}\r
void copy(const GpuMat& src, GpuMat& dst) const\r
- { \r
+ {\r
cudaSafeCall( cudaMemcpy2D(dst.data, dst.step, src.data, src.step, src.cols * src.elemSize(), src.rows, cudaMemcpyDeviceToDevice) );\r
}\r
\r
- void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask) const \r
- { \r
+ void copyWithMask(const GpuMat& src, GpuMat& dst, const GpuMat& mask) const\r
+ {\r
::cv::gpu::copyWithMask(src, dst, mask);\r
}\r
\r
- void convert(const GpuMat& src, GpuMat& dst) const \r
- { \r
+ void convert(const GpuMat& src, GpuMat& dst) const\r
+ {\r
typedef void (*caller_t)(const GpuMat& src, GpuMat& dst);\r
static const caller_t callers[7][7][7] =\r
{\r
- { \r
+ {\r
/* 8U -> 8U */ {0, 0, 0, 0},\r
/* 8U -> 8S */ {::cv::gpu::convertTo, ::cv::gpu::convertTo, ::cv::gpu::convertTo, ::cv::gpu::convertTo},\r
/* 8U -> 16U */ {NppCvt<CV_8U, CV_16U, nppiConvert_8u16u_C1R>::cvt,::cv::gpu::convertTo,::cv::gpu::convertTo,NppCvt<CV_8U, CV_16U, nppiConvert_8u16u_C4R>::cvt},\r
func(src, dst);\r
}\r
\r
- void convert(const GpuMat& src, GpuMat& dst, double alpha, double beta) const \r
- { \r
+ void convert(const GpuMat& src, GpuMat& dst, double alpha, double beta) const\r
+ {\r
::cv::gpu::convertTo(src, dst, alpha, beta);\r
}\r
\r
cudaFree(devPtr);\r
}\r
};\r
- \r
+\r
const GpuFuncTable* gpuFuncTable()\r
{\r
static CudaFuncTable funcTable;\r
CV_Assert(mask.empty() || mask.type() == CV_8UC1);\r
CV_DbgAssert(!empty());\r
\r
- gpuFuncTable()->setTo(*this, s, mask); \r
+ gpuFuncTable()->setTo(*this, s, mask);\r
\r
return *this;\r
}\r
\r
namespace\r
{\r
- void throw_nogl() \r
+ void throw_nogl()\r
{\r
#ifndef HAVE_OPENGL\r
- CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support"); \r
+ CV_Error(CV_OpenGlNotSupported, "The library is compiled without OpenGL support");\r
#else\r
- CV_Error(CV_OpenGlNotSupported, "OpenGL context doesn't exist"); \r
+ CV_Error(CV_OpenGlNotSupported, "OpenGL context doesn't exist");\r
#endif\r
}\r
\r
#endif\r
\r
namespace\r
- { \r
+ {\r
const GLenum gl_types[] = {GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE};\r
\r
#ifdef HAVE_CUDA\r
if (!glFuncTab()->isGlContextInitialized())\r
throw_nogl();\r
\r
- cudaSafeCall( cudaGLSetGLDevice(device) ); \r
+ cudaSafeCall( cudaGLSetGLDevice(device) );\r
\r
g_isCudaGlDeviceInitialized = true;\r
#endif\r
cudaGraphicsResource_t resource_;\r
};\r
\r
- inline CudaGlInterop::CudaGlInterop() : resource_(0) \r
+ inline CudaGlInterop::CudaGlInterop() : resource_(0)\r
{\r
}\r
\r
- CudaGlInterop::~CudaGlInterop() \r
- { \r
+ CudaGlInterop::~CudaGlInterop()\r
+ {\r
if (resource_)\r
{\r
cudaGraphicsUnregisterResource(resource_);\r
resource_ = 0;\r
- } \r
+ }\r
}\r
\r
void CudaGlInterop::registerBuffer(unsigned int buffer)\r
void* dst_ptr;\r
size_t num_bytes;\r
cudaSafeCall( cudaGraphicsResourceGetMappedPointer(&dst_ptr, &num_bytes, resource_) );\r
- \r
+\r
const void* src_ptr = mat.ptr();\r
size_t widthBytes = mat.cols * mat.elemSize();\r
\r
#endif\r
};\r
\r
-inline cv::gpu::GlBuffer::Impl::Impl() : buffer_(0) \r
+inline cv::gpu::GlBuffer::Impl::Impl() : buffer_(0)\r
{\r
}\r
\r
-cv::gpu::GlBuffer::Impl::Impl(int rows, int cols, int type, unsigned int target) : buffer_(0) \r
-{ \r
+cv::gpu::GlBuffer::Impl::Impl(int rows, int cols, int type, unsigned int target) : buffer_(0)\r
+{\r
if (!glFuncTab()->isGlContextInitialized())\r
throw_nogl();\r
\r
CV_DbgAssert(rows > 0 && cols > 0);\r
CV_DbgAssert(CV_MAT_DEPTH(type) >= 0 && CV_MAT_DEPTH(type) <= CV_64F);\r
- \r
+\r
glFuncTab()->genBuffers(1, &buffer_);\r
CV_CheckGlError();\r
+ CV_Assert(buffer_ != 0);\r
\r
size_t size = rows * cols * CV_ELEM_SIZE(type);\r
\r
CV_CheckGlError();\r
\r
glFuncTab()->bindBuffer(target, 0);\r
- \r
+\r
#ifdef HAVE_CUDA\r
if (g_isCudaGlDeviceInitialized)\r
cudaGlInterop_.registerBuffer(buffer_);\r
#endif\r
}\r
\r
-cv::gpu::GlBuffer::Impl::Impl(const Mat& m, unsigned int target) : buffer_(0) \r
-{ \r
+cv::gpu::GlBuffer::Impl::Impl(const Mat& m, unsigned int target) : buffer_(0)\r
+{\r
if (!glFuncTab()->isGlContextInitialized())\r
throw_nogl();\r
\r
CV_DbgAssert(m.rows > 0 && m.cols > 0);\r
CV_DbgAssert(m.depth() >= 0 && m.depth() <= CV_64F);\r
CV_Assert(m.isContinuous());\r
- \r
+\r
glFuncTab()->genBuffers(1, &buffer_);\r
CV_CheckGlError();\r
+ CV_Assert(buffer_ != 0);\r
\r
size_t size = m.rows * m.cols * m.elemSize();\r
\r
CV_CheckGlError();\r
\r
glFuncTab()->bindBuffer(target, 0);\r
- \r
+\r
#ifdef HAVE_CUDA\r
if (g_isCudaGlDeviceInitialized)\r
cudaGlInterop_.registerBuffer(buffer_);\r
#endif\r
}\r
\r
-cv::gpu::GlBuffer::Impl::~Impl() \r
-{ \r
+cv::gpu::GlBuffer::Impl::~Impl()\r
+{\r
try\r
{\r
if (buffer_)\r
\r
#ifdef HAVE_CUDA\r
\r
-void cv::gpu::GlBuffer::Impl::copyFrom(const GpuMat& mat, cudaStream_t stream) \r
+void cv::gpu::GlBuffer::Impl::copyFrom(const GpuMat& mat, cudaStream_t stream)\r
{\r
if (!g_isCudaGlDeviceInitialized)\r
cvError(CV_GpuApiCallError, "copyFrom", "cuda GL device wasn't initialized, call setGlDevice", __FILE__, __LINE__);\r
\r
#endif // HAVE_CUDA\r
\r
-inline void cv::gpu::GlBuffer::Impl::bind(unsigned int target) const \r
+inline void cv::gpu::GlBuffer::Impl::bind(unsigned int target) const\r
{\r
CV_Assert(buffer_ != 0);\r
\r
- glFuncTab()->bindBuffer(target, buffer_); \r
+ glFuncTab()->bindBuffer(target, buffer_);\r
CV_CheckGlError();\r
}\r
\r
inline void cv::gpu::GlBuffer::Impl::unbind(unsigned int target) const\r
-{ \r
+{\r
glFuncTab()->bindBuffer(target, 0);\r
}\r
\r
#endif\r
}\r
\r
-cv::gpu::GlBuffer::GlBuffer(const GlBuffer& other) \r
+cv::gpu::GlBuffer::GlBuffer(const GlBuffer& other)\r
: rows(other.rows), cols(other.cols), type_(other.type_), usage_(other.usage_), impl_(other.impl_)\r
{\r
}\r
\r
glGenTextures(1, &tex_);\r
CV_CheckGlError();\r
+ CV_Assert(tex_ != 0);\r
\r
glBindTexture(GL_TEXTURE_2D, tex_);\r
CV_CheckGlError();\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); \r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
CV_CheckGlError();\r
\r
GLenum format = cn == 1 ? GL_LUMINANCE : cn == 3 ? GL_BGR : GL_BGRA;\r
\r
glGenTextures(1, &tex_);\r
CV_CheckGlError();\r
+ CV_Assert(tex_ != 0);\r
\r
glBindTexture(GL_TEXTURE_2D, tex_);\r
CV_CheckGlError();\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); \r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
CV_CheckGlError();\r
\r
GLenum format = cn == 1 ? GL_LUMINANCE : (cn == 3 ? (bgra ? GL_BGR : GL_RGB) : (bgra ? GL_BGRA : GL_RGBA));\r
int depth = buf.depth();\r
int cn = buf.channels();\r
\r
- CV_DbgAssert(buf.rows() > 0 && buf.cols() > 0);\r
+ CV_DbgAssert(buf.rows > 0 && buf.cols > 0);\r
CV_Assert(cn == 1 || cn == 3 || cn == 4);\r
CV_Assert(depth >= 0 && depth <= CV_32F);\r
CV_Assert(buf.usage() == GlBuffer::TEXTURE_BUFFER);\r
\r
glGenTextures(1, &tex_);\r
CV_CheckGlError();\r
+ CV_Assert(tex_ != 0);\r
\r
glBindTexture(GL_TEXTURE_2D, tex_);\r
CV_CheckGlError();\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);\r
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);\r
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); \r
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\r
CV_CheckGlError();\r
\r
GLenum format = cn == 1 ? GL_LUMINANCE : (cn == 3 ? (bgra ? GL_BGR : GL_RGB) : (bgra ? GL_BGRA : GL_RGBA));\r
#endif\r
}\r
\r
-cv::gpu::GlTexture::GlTexture(const GlTexture& other) \r
+cv::gpu::GlTexture::GlTexture(const GlTexture& other)\r
: rows(other.rows), cols(other.cols), type_(other.type_), impl_(other.impl_)\r
{\r
}\r
////////////////////////////////////////////////////////////////////////\r
// GlArrays\r
\r
-void cv::gpu::GlArrays::setVertexArray(const GlBuffer& vertex) \r
-{ \r
+void cv::gpu::GlArrays::setVertexArray(const GlBuffer& vertex)\r
+{\r
CV_Assert(vertex.usage() == GlBuffer::ARRAY_BUFFER);\r
\r
int cn = vertex.channels();\r
CV_Assert(cn == 2 || cn == 3 || cn == 4);\r
CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
\r
- vertex_ = vertex; \r
+ vertex_ = vertex;\r
}\r
\r
-void cv::gpu::GlArrays::setVertexArray(const GpuMat& vertex) \r
-{ \r
+void cv::gpu::GlArrays::setVertexArray(const GpuMat& vertex)\r
+{\r
int cn = vertex.channels();\r
int depth = vertex.depth();\r
\r
CV_Assert(cn == 2 || cn == 3 || cn == 4);\r
CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
\r
- vertex_.copyFrom(vertex); \r
+ vertex_.copyFrom(vertex);\r
}\r
\r
-void cv::gpu::GlArrays::setVertexArray(InputArray vertex) \r
-{ \r
+void cv::gpu::GlArrays::setVertexArray(InputArray vertex)\r
+{\r
int cn = vertex.channels();\r
int depth = vertex.depth();\r
\r
CV_Assert(cn == 2 || cn == 3 || cn == 4);\r
CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
\r
- vertex_.copyFrom(vertex); \r
+ vertex_.copyFrom(vertex);\r
}\r
\r
-void cv::gpu::GlArrays::setColorArray(const GlBuffer& color, bool bgra) \r
-{ \r
+void cv::gpu::GlArrays::setColorArray(const GlBuffer& color, bool bgra)\r
+{\r
CV_Assert(color.usage() == GlBuffer::ARRAY_BUFFER);\r
\r
int cn = color.channels();\r
\r
CV_Assert((cn == 3 && !bgra) || cn == 4);\r
\r
- color_ = color; \r
- bgra_ = bgra; \r
+ color_ = color;\r
+ bgra_ = bgra;\r
}\r
\r
-void cv::gpu::GlArrays::setColorArray(const GpuMat& color, bool bgra) \r
-{ \r
+void cv::gpu::GlArrays::setColorArray(const GpuMat& color, bool bgra)\r
+{\r
int cn = color.channels();\r
\r
CV_Assert((cn == 3 && !bgra) || cn == 4);\r
\r
- color_.copyFrom(color); \r
- bgra_ = bgra; \r
+ color_.copyFrom(color);\r
+ bgra_ = bgra;\r
}\r
\r
-void cv::gpu::GlArrays::setColorArray(InputArray color, bool bgra) \r
-{ \r
+void cv::gpu::GlArrays::setColorArray(InputArray color, bool bgra)\r
+{\r
int cn = color.channels();\r
\r
CV_Assert((cn == 3 && !bgra) || cn == 4);\r
\r
- color_.copyFrom(color); \r
- bgra_ = bgra; \r
+ color_.copyFrom(color);\r
+ bgra_ = bgra;\r
}\r
\r
-void cv::gpu::GlArrays::setNormalArray(const GlBuffer& normal) \r
-{ \r
+void cv::gpu::GlArrays::setNormalArray(const GlBuffer& normal)\r
+{\r
CV_Assert(normal.usage() == GlBuffer::ARRAY_BUFFER);\r
\r
int cn = normal.channels();\r
CV_Assert(cn == 3);\r
CV_Assert(depth == CV_8S || depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
\r
- normal_ = normal; \r
+ normal_ = normal;\r
}\r
\r
-void cv::gpu::GlArrays::setNormalArray(const GpuMat& normal) \r
-{ \r
+void cv::gpu::GlArrays::setNormalArray(const GpuMat& normal)\r
+{\r
int cn = normal.channels();\r
int depth = normal.depth();\r
\r
CV_Assert(cn == 3);\r
CV_Assert(depth == CV_8S || depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
\r
- normal_.copyFrom(normal); \r
+ normal_.copyFrom(normal);\r
}\r
\r
-void cv::gpu::GlArrays::setNormalArray(InputArray normal) \r
-{ \r
+void cv::gpu::GlArrays::setNormalArray(InputArray normal)\r
+{\r
int cn = normal.channels();\r
int depth = normal.depth();\r
\r
CV_Assert(cn == 3);\r
CV_Assert(depth == CV_8S || depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
\r
- normal_.copyFrom(normal); \r
+ normal_.copyFrom(normal);\r
}\r
\r
-void cv::gpu::GlArrays::setTexCoordArray(const GlBuffer& texCoord) \r
-{ \r
+void cv::gpu::GlArrays::setTexCoordArray(const GlBuffer& texCoord)\r
+{\r
CV_Assert(texCoord.usage() == GlBuffer::ARRAY_BUFFER);\r
\r
int cn = texCoord.channels();\r
CV_Assert(cn >= 1 && cn <= 4);\r
CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
\r
- texCoord_ = texCoord; \r
+ texCoord_ = texCoord;\r
}\r
\r
-void cv::gpu::GlArrays::setTexCoordArray(const GpuMat& texCoord) \r
-{ \r
+void cv::gpu::GlArrays::setTexCoordArray(const GpuMat& texCoord)\r
+{\r
int cn = texCoord.channels();\r
int depth = texCoord.depth();\r
\r
CV_Assert(cn >= 1 && cn <= 4);\r
CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
\r
- texCoord_.copyFrom(texCoord); \r
+ texCoord_.copyFrom(texCoord);\r
}\r
\r
-void cv::gpu::GlArrays::setTexCoordArray(InputArray texCoord) \r
-{ \r
+void cv::gpu::GlArrays::setTexCoordArray(InputArray texCoord)\r
+{\r
int cn = texCoord.channels();\r
int depth = texCoord.depth();\r
\r
CV_Assert(cn >= 1 && cn <= 4);\r
CV_Assert(depth == CV_16S || depth == CV_32S || depth == CV_32F || depth == CV_64F);\r
\r
- texCoord_.copyFrom(texCoord); \r
+ texCoord_.copyFrom(texCoord);\r
}\r
\r
void cv::gpu::GlArrays::bind() const\r
color_.bind();\r
\r
int cn = color_.channels();\r
- int format = cn == 3 ? cn : (bgra_ ? GL_BGRA : 4); \r
+ int format = cn == 3 ? cn : (bgra_ ? GL_BGRA : 4);\r
\r
glColorPointer(format, gl_types[color_.depth()], 0, 0);\r
CV_CheckGlError();\r
glBegin(GL_QUADS);\r
glTexCoord2d(texRect.x, texRect.y);\r
glVertex2d(wndRect.x, wndRect.y);\r
- \r
+\r
glTexCoord2d(texRect.x, texRect.y + texRect.height);\r
glVertex2d(wndRect.x, (wndRect.y + wndRect.height));\r
- \r
+\r
glTexCoord2d(texRect.x + texRect.width, texRect.y + texRect.height);\r
glVertex2d(wndRect.x + wndRect.width, (wndRect.y + wndRect.height));\r
- \r
+\r
glTexCoord2d(texRect.x + texRect.width, texRect.y);\r
glVertex2d(wndRect.x + wndRect.width, wndRect.y);\r
glEnd();\r
////////////////////////////////////////////////////////////////////////\r
// GlCamera\r
\r
-cv::gpu::GlCamera::GlCamera() : \r
+cv::gpu::GlCamera::GlCamera() :\r
eye_(0.0, 0.0, -5.0), center_(0.0, 0.0, 0.0), up_(0.0, 1.0, 0.0),\r
pos_(0.0, 0.0, -5.0), yaw_(0.0), pitch_(0.0), roll_(0.0),\r
useLookAtParams_(false),\r
\r
if (uncaught_exception())\r
{\r
- const char* errorStr = cvErrorStr(code); \r
- const char* function = func ? func : "unknown function"; \r
+ const char* errorStr = cvErrorStr(code);\r
+ const char* function = func ? func : "unknown function";\r
\r
cerr << "OpenCV Error: " << errorStr << "(" << error_string << ") in " << function << ", file " << file << ", line " << line;\r
- cerr.flush(); \r
+ cerr.flush();\r
}\r
- else \r
+ else\r
cv::error( cv::Exception(code, error_string, func, file, line) );\r
}\r
\r