Merged the trunk r8589:8653 - all changes related to build warnings

This commit is contained in:
Andrey Kamaev
2012-06-15 13:04:17 +00:00
parent 73c152abc4
commit bd0e0b5800
438 changed files with 20374 additions and 19674 deletions

View File

@@ -1299,6 +1299,7 @@ public:
GPU_MAT = 9 << KIND_SHIFT
};
_InputArray();
_InputArray(const Mat& m);
_InputArray(const MatExpr& expr);
template<typename _Tp> _InputArray(const _Tp* vec, int n);
@@ -1328,6 +1329,10 @@ public:
virtual int channels(int i=-1) const;
virtual bool empty() const;
#ifdef OPENCV_CAN_BREAK_BINARY_COMPATIBILITY
virtual ~_InputArray();
#endif
int flags;
void* obj;
Size sz;
@@ -1384,6 +1389,10 @@ public:
virtual void create(int dims, const int* size, int type, int i=-1, bool allowTransposed=false, int fixedDepthMask=0) const;
virtual void release() const;
virtual void clear() const;
#ifdef OPENCV_CAN_BREAK_BINARY_COMPATIBILITY
virtual ~_OutputArray();
#endif
};
typedef const _InputArray& InputArray;
@@ -3970,7 +3979,7 @@ public:
CV_WRAP virtual bool isOpened() const;
//! closes the file and releases all the memory buffers
CV_WRAP virtual void release();
//! closes the file, releases all the memory buffers and returns the text string
//! closes the file, releases all the memory buffers and returns the text string
CV_WRAP string releaseAndGetString();
//! returns the first element of the top-level mapping

View File

@@ -666,7 +666,7 @@ CVAPI(int) cvSolveCubic( const CvMat* coeffs, CvMat* roots );
/* Finds all real and complex roots of a polynomial equation */
CVAPI(void) cvSolvePoly(const CvMat* coeffs, CvMat *roots2,
int maxiter CV_DEFAULT(20), int fig CV_DEFAULT(100));
int maxiter CV_DEFAULT(20), int fig CV_DEFAULT(100));
/****************************************************************************************\
* Matrix operations *
@@ -1127,9 +1127,9 @@ CVAPI(void) cvSetRemove( CvSet* set_header, int index );
/* Returns a set element by index. If the element doesn't belong to the set,
NULL is returned */
CV_INLINE CvSetElem* cvGetSetElem( const CvSet* set_header, int index )
CV_INLINE CvSetElem* cvGetSetElem( const CvSet* set_header, int idx )
{
CvSetElem* elem = (CvSetElem*)cvGetSeqElem( (CvSeq*)set_header, index );
CvSetElem* elem = (CvSetElem*)cvGetSeqElem( (CvSeq*)set_header, idx );
return elem && CV_IS_SET_ELEM( elem ) ? elem : 0;
}
@@ -1283,8 +1283,8 @@ CVAPI(void) cvRectangleR( CvArr* img, CvRect r,
CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8),
int shift CV_DEFAULT(0));
/* Draws a circle with specified center and radius.
Thickness works in the same way as with cvRectangle */
CVAPI(void) cvCircle( CvArr* img, CvPoint center, int radius,
@@ -1374,17 +1374,17 @@ CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2,
/* Font structure */
typedef struct CvFont
{
const char* nameFont; //Qt:nameFont
CvScalar color; //Qt:ColorFont -> cvScalar(blue_component, green_component, red\_component[, alpha_component])
int font_face; //Qt: bool italic /* =CV_FONT_* */
const int* ascii; /* font data and metrics */
const char* nameFont; //Qt:nameFont
CvScalar color; //Qt:ColorFont -> cvScalar(blue_component, green_component, red\_component[, alpha_component])
int font_face; //Qt: bool italic /* =CV_FONT_* */
const int* ascii; /* font data and metrics */
const int* greek;
const int* cyrillic;
float hscale, vscale;
float shear; /* slope coefficient: 0 - normal, >0 - italic */
int thickness; //Qt: weight /* letters thickness */
float dx; /* horizontal interval between letters */
int line_type; //Qt: PointSize
float shear; /* slope coefficient: 0 - normal, >0 - italic */
int thickness; //Qt: weight /* letters thickness */
float dx; /* horizontal interval between letters */
int line_type; //Qt: PointSize
}
CvFont;
@@ -1696,7 +1696,7 @@ CVAPI(double) cvGetTickFrequency( void );
/*********************************** CPU capabilities ***********************************/
#define CV_CPU_NONE 0
#define CV_CPU_NONE 0
#define CV_CPU_MMX 1
#define CV_CPU_SSE 2
#define CV_CPU_SSE2 3
@@ -1718,9 +1718,9 @@ CVAPI(void) cvSetNumThreads( int threads CV_DEFAULT(0) );
/* get index of the thread being executed */
CVAPI(int) cvGetThreadNum( void );
/********************************** Error Handling **************************************/
/* Get current OpenCV error status */
CVAPI(int) cvGetErrStatus( void );
@@ -1774,37 +1774,37 @@ CVAPI(int) cvStdErrReport( int status, const char* func_name, const char* err_ms
const char* file_name, int line, void* userdata );
CVAPI(int) cvGuiBoxReport( int status, const char* func_name, const char* err_msg,
const char* file_name, int line, void* userdata );
const char* file_name, int line, void* userdata );
#define OPENCV_ERROR(status,func,context) \
cvError((status),(func),(context),__FILE__,__LINE__)
#define OPENCV_ERRCHK(func,context) \
{if (cvGetErrStatus() >= 0) \
{OPENCV_ERROR(CV_StsBackTrace,(func),(context));}}
#define OPENCV_ASSERT(expr,func,context) \
{if (! (expr)) \
{OPENCV_ERROR(CV_StsInternal,(func),(context));}}
#define OPENCV_RSTERR() (cvSetErrStatus(CV_StsOk))
#define OPENCV_CALL( Func ) \
{ \
Func; \
}
}
/* CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */
#ifdef CV_NO_FUNC_NAMES
#define CV_FUNCNAME( Name )
#define cvFuncName ""
#else
#else
#define CV_FUNCNAME( Name ) \
static char cvFuncName[] = Name
#endif
/*
CV_ERROR macro unconditionally raises error with passed code and message.
After raising error, control will be transferred to the exit label.
@@ -1814,11 +1814,11 @@ static char cvFuncName[] = Name
cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ ); \
__CV_EXIT__; \
}
/* Simplified form of CV_ERROR */
#define CV_ERROR_FROM_CODE( code ) \
CV_ERROR( code, "" )
/*
CV_CHECK macro checks error status after CV (or IPL)
function call. If error detected, control will be transferred to the exit
@@ -1829,8 +1829,8 @@ static char cvFuncName[] = Name
if( cvGetErrStatus() < 0 ) \
CV_ERROR( CV_StsBackTrace, "Inner function failed." ); \
}
/*
CV_CALL macro calls CV (or IPL) function, checks error status and
signals a error if the function failed. Useful in "parent node"
@@ -1841,19 +1841,19 @@ static char cvFuncName[] = Name
Func; \
CV_CHECK(); \
}
/* Runtime assertion macro */
#define CV_ASSERT( Condition ) \
{ \
if( !(Condition) ) \
CV_ERROR( CV_StsInternal, "Assertion: " #Condition " failed" ); \
}
#define __CV_BEGIN__ {
#define __CV_END__ goto exit; exit: ; }
#define __CV_EXIT__ goto exit
#define __CV_EXIT__ goto exit
#ifdef __cplusplus
}

View File

@@ -48,6 +48,11 @@
#include "opencv2/core/core_c.h"
#include "opencv2/core/core.hpp"
#if defined _MSC_VER && _MSC_VER >= 1200
#pragma warning( disable: 4714 ) //__forceinline is not inlined
#pragma warning( disable: 4127 ) //conditional expression is constant
#endif
namespace cv
{

View File

@@ -366,12 +366,12 @@ namespace cv { namespace gpu
return m;
}
inline void GpuMat::assignTo(GpuMat& m, int type) const
inline void GpuMat::assignTo(GpuMat& m, int _type) const
{
if (type < 0)
if (_type < 0)
m = *this;
else
convertTo(m, type);
convertTo(m, _type);
}
inline size_t GpuMat::step1() const
@@ -434,9 +434,9 @@ namespace cv { namespace gpu
create(size_.height, size_.width, type_);
}
inline GpuMat GpuMat::operator()(Range rowRange, Range colRange) const
inline GpuMat GpuMat::operator()(Range _rowRange, Range _colRange) const
{
return GpuMat(*this, rowRange, colRange);
return GpuMat(*this, _rowRange, _colRange);
}
inline GpuMat GpuMat::operator()(Rect roi) const

View File

@@ -60,34 +60,34 @@
#endif
#if defined WIN32 || defined WINCE
#ifndef _WIN32_WINNT // This is needed for the declaration of TryEnterCriticalSection in winbase.h with Visual Studio 2005 (and older?)
#define _WIN32_WINNT 0x0400 // http://msdn.microsoft.com/en-us/library/ms686857(VS.85).aspx
#endif
#include <windows.h>
#undef small
#undef min
#undef max
# ifndef _WIN32_WINNT // This is needed for the declaration of TryEnterCriticalSection in winbase.h with Visual Studio 2005 (and older?)
# define _WIN32_WINNT 0x0400 // http://msdn.microsoft.com/en-us/library/ms686857(VS.85).aspx
# endif
# include <windows.h>
# undef small
# undef min
# undef max
#else
#include <pthread.h>
# include <pthread.h>
#endif
#ifdef __BORLANDC__
#ifndef WIN32
#define WIN32
#endif
#ifndef _WIN32
#define _WIN32
#endif
#define CV_DLL
#undef _CV_ALWAYS_PROFILE_
#define _CV_ALWAYS_NO_PROFILE_
# ifndef WIN32
# define WIN32
# endif
# ifndef _WIN32
# define _WIN32
# endif
# define CV_DLL
# undef _CV_ALWAYS_PROFILE_
# define _CV_ALWAYS_NO_PROFILE_
#endif
#ifndef FALSE
#define FALSE 0
# define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
# define TRUE 1
#endif
#define __BEGIN__ __CV_BEGIN__
@@ -95,7 +95,7 @@
#define EXIT __CV_EXIT__
#ifdef HAVE_IPP
#include "ipp.h"
# include "ipp.h"
CV_INLINE IppiSize ippiSize(int width, int height)
{
@@ -104,137 +104,132 @@ CV_INLINE IppiSize ippiSize(int width, int height)
}
#endif
#if defined __SSE2__ || _MSC_VER >= 1300
#include "emmintrin.h"
#define CV_SSE 1
#define CV_SSE2 1
#if defined __SSE3__ || _MSC_VER >= 1500
#include "pmmintrin.h"
#define CV_SSE3 1
#endif
#if defined __SSSE3__
#include "tmmintrin.h"
#define CV_SSSE3 1
#endif
#if defined __SSE2__ || (defined _MSC_VER && _MSC_VER >= 1300)
# include "emmintrin.h"
# define CV_SSE 1
# define CV_SSE2 1
# if defined __SSE3__ || (defined _MSC_VER && _MSC_VER >= 1500)
# include "pmmintrin.h"
# define CV_SSE3 1
# else
# define CV_SSE3 0
# endif
# if defined __SSSE3__
# include "tmmintrin.h"
# define CV_SSSE3 1
# else
# define CV_SSSE3 0
# endif
#else
#define CV_SSE 0
#define CV_SSE2 0
#define CV_SSE3 0
#define CV_SSSE3 0
# define CV_SSE 0
# define CV_SSE2 0
# define CV_SSE3 0
# define CV_SSSE3 0
#endif
#if defined ANDROID && defined __ARM_NEON__ && defined __GNUC__
#include "arm_neon.h"
#define CV_NEON 1
#if defined ANDROID && defined __ARM_NEON__
# include "arm_neon.h"
# define CV_NEON 1
#define CPU_HAS_NEON_FEATURE (true)
# define CPU_HAS_NEON_FEATURE (true)
//TODO: make real check using stuff from "cpu-features.h"
//((bool)android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON)
#else
#define CV_NEON 0
#define CPU_HAS_NEON_FEATURE (false)
#endif
#ifdef CV_ICC
#define CV_ENABLE_UNROLLED 0
#else
#define CV_ENABLE_UNROLLED 1
# define CV_NEON 0
# define CPU_HAS_NEON_FEATURE (false)
#endif
#ifndef IPPI_CALL
#define IPPI_CALL(func) CV_Assert((func) >= 0)
# define IPPI_CALL(func) CV_Assert((func) >= 0)
#endif
#ifdef HAVE_TBB
#include "tbb/tbb_stddef.h"
#if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
#include "tbb/tbb.h"
#include "tbb/task.h"
#undef min
#undef max
#else
#undef HAVE_TBB
#endif
# include "tbb/tbb_stddef.h"
# if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
# include "tbb/tbb.h"
# include "tbb/task.h"
# undef min
# undef max
# else
# undef HAVE_TBB
# endif
#endif
#ifdef HAVE_EIGEN
#include <Eigen/Core>
#include "opencv2/core/eigen.hpp"
# include <Eigen/Core>
# include "opencv2/core/eigen.hpp"
#endif
#ifdef __cplusplus
namespace cv
{
#ifdef HAVE_TBB
namespace cv
{
typedef tbb::blocked_range<int> BlockedRange;
template<typename Body> static inline
void parallel_for( const BlockedRange& range, const Body& body )
{
tbb::parallel_for(range, body);
}
template<typename Iterator, typename Body> static inline
void parallel_do( Iterator first, Iterator last, const Body& body )
{
tbb::parallel_do(first, last, body);
}
typedef tbb::split Split;
template<typename Body> static inline
void parallel_reduce( const BlockedRange& range, Body& body )
{
tbb::parallel_reduce(range, body);
}
typedef tbb::concurrent_vector<Rect> ConcurrentRectVector;
typedef tbb::concurrent_vector<double> ConcurrentDoubleVector;
}
#else
namespace cv
{
class BlockedRange
{
public:
BlockedRange() : _begin(0), _end(0), _grainsize(0) {}
BlockedRange(int b, int e, int g=1) : _begin(b), _end(e), _grainsize(g) {}
int begin() const { return _begin; }
int end() const { return _end; }
int grainsize() const { return _grainsize; }
protected:
int _begin, _end, _grainsize;
};
template<typename Body> static inline
void parallel_for( const BlockedRange& range, const Body& body )
{
body(range);
}
typedef std::vector<Rect> ConcurrentRectVector;
typedef std::vector<double> ConcurrentDoubleVector;
template<typename Iterator, typename Body> static inline
void parallel_do( Iterator first, Iterator last, const Body& body )
{
for( ; first != last; ++first )
body(*first);
}
class Split {};
template<typename Body> static inline
void parallel_reduce( const BlockedRange& range, Body& body )
{
body(range);
}
typedef tbb::blocked_range<int> BlockedRange;
template<typename Body> static inline
void parallel_for( const BlockedRange& range, const Body& body )
{
tbb::parallel_for(range, body);
}
template<typename Iterator, typename Body> static inline
void parallel_do( Iterator first, Iterator last, const Body& body )
{
tbb::parallel_do(first, last, body);
}
typedef tbb::split Split;
template<typename Body> static inline
void parallel_reduce( const BlockedRange& range, Body& body )
{
tbb::parallel_reduce(range, body);
}
typedef tbb::concurrent_vector<Rect> ConcurrentRectVector;
typedef tbb::concurrent_vector<double> ConcurrentDoubleVector;
#else
class BlockedRange
{
public:
BlockedRange() : _begin(0), _end(0), _grainsize(0) {}
BlockedRange(int b, int e, int g=1) : _begin(b), _end(e), _grainsize(g) {}
int begin() const { return _begin; }
int end() const { return _end; }
int grainsize() const { return _grainsize; }
protected:
int _begin, _end, _grainsize;
};
template<typename Body> static inline
void parallel_for( const BlockedRange& range, const Body& body )
{
body(range);
}
typedef std::vector<Rect> ConcurrentRectVector;
typedef std::vector<double> ConcurrentDoubleVector;
template<typename Iterator, typename Body> static inline
void parallel_do( Iterator first, Iterator last, const Body& body )
{
for( ; first != last; ++first )
body(*first);
}
class Split {};
template<typename Body> static inline
void parallel_reduce( const BlockedRange& range, Body& body )
{
body(range);
}
#endif
} //namespace cv
#define CV_INIT_ALGORITHM(classname, algname, memberinit) \
#define CV_INIT_ALGORITHM(classname, algname, memberinit) \
static Algorithm* create##classname() \
{ \
return new classname; \
@@ -261,7 +256,7 @@ CV_INLINE IppiSize ippiSize(int width, int height)
return &classname##_info(); \
}
#endif
#endif //__cplusplus
/* maximal size of vector to run matrix operations on it inline (i.e. w/o ipp calls) */
#define CV_MAX_INLINE_MAT_OP_SIZE 10
@@ -305,9 +300,9 @@ CV_INLINE IppiSize ippiSize(int width, int height)
#define CV_MAX_STRLEN 1024
#if 0 /*def CV_CHECK_FOR_NANS*/
#define CV_CHECK_NANS( arr ) cvCheckArray((arr))
# define CV_CHECK_NANS( arr ) cvCheckArray((arr))
#else
#define CV_CHECK_NANS( arr )
# define CV_CHECK_NANS( arr )
#endif
/****************************************************************************************\
@@ -316,38 +311,38 @@ CV_INLINE IppiSize ippiSize(int width, int height)
/* get alloca declaration */
#ifdef __GNUC__
#undef alloca
#define alloca __builtin_alloca
#define CV_HAVE_ALLOCA 1
# undef alloca
# define alloca __builtin_alloca
# define CV_HAVE_ALLOCA 1
#elif defined WIN32 || defined _WIN32 || \
defined WINCE || defined _MSC_VER || defined __BORLANDC__
#include <malloc.h>
#define CV_HAVE_ALLOCA 1
# include <malloc.h>
# define CV_HAVE_ALLOCA 1
#elif defined HAVE_ALLOCA_H
#include <alloca.h>
#define CV_HAVE_ALLOCA 1
# include <alloca.h>
# define CV_HAVE_ALLOCA 1
#elif defined HAVE_ALLOCA
#include <stdlib.h>
#define CV_HAVE_ALLOCA 1
# include <stdlib.h>
# define CV_HAVE_ALLOCA 1
#else
#undef CV_HAVE_ALLOCA
# undef CV_HAVE_ALLOCA
#endif
#ifdef __GNUC__
#define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x)))
# define CV_DECL_ALIGNED(x) __attribute__ ((aligned (x)))
#elif defined _MSC_VER
#define CV_DECL_ALIGNED(x) __declspec(align(x))
# define CV_DECL_ALIGNED(x) __declspec(align(x))
#else
#define CV_DECL_ALIGNED(x)
# define CV_DECL_ALIGNED(x)
#endif
#if CV_HAVE_ALLOCA
/* ! DO NOT make it an inline function */
#define cvStackAlloc(size) cvAlignPtr( alloca((size) + CV_MALLOC_ALIGN), CV_MALLOC_ALIGN )
# define cvStackAlloc(size) cvAlignPtr( alloca((size) + CV_MALLOC_ALIGN), CV_MALLOC_ALIGN )
#endif
#ifndef CV_IMPL
#define CV_IMPL CV_EXTERN_C
# define CV_IMPL CV_EXTERN_C
#endif
#define CV_DBG_BREAK() { volatile int* crashMe = 0; *crashMe = 0; }
@@ -687,25 +682,25 @@ typedef enum CvStatus
CV_UNSUPPORTED_DEPTH_ERR = -101,
CV_UNSUPPORTED_FORMAT_ERR = -100,
CV_BADARG_ERR = -49, //ipp comp
CV_NOTDEFINED_ERR = -48, //ipp comp
CV_BADARG_ERR = -49, //ipp comp
CV_NOTDEFINED_ERR = -48, //ipp comp
CV_BADCHANNELS_ERR = -47, //ipp comp
CV_BADRANGE_ERR = -44, //ipp comp
CV_BADSTEP_ERR = -29, //ipp comp
CV_BADCHANNELS_ERR = -47, //ipp comp
CV_BADRANGE_ERR = -44, //ipp comp
CV_BADSTEP_ERR = -29, //ipp comp
CV_BADFLAG_ERR = -12,
CV_DIV_BY_ZERO_ERR = -11, //ipp comp
CV_BADCOEF_ERR = -10,
CV_BADFLAG_ERR = -12,
CV_DIV_BY_ZERO_ERR = -11, //ipp comp
CV_BADCOEF_ERR = -10,
CV_BADFACTOR_ERR = -7,
CV_BADPOINT_ERR = -6,
CV_BADSCALE_ERR = -4,
CV_OUTOFMEM_ERR = -3,
CV_NULLPTR_ERR = -2,
CV_BADSIZE_ERR = -1,
CV_NO_ERR = 0,
CV_OK = CV_NO_ERR
CV_BADFACTOR_ERR = -7,
CV_BADPOINT_ERR = -6,
CV_BADSCALE_ERR = -4,
CV_OUTOFMEM_ERR = -3,
CV_NULLPTR_ERR = -2,
CV_BADSIZE_ERR = -1,
CV_NO_ERR = 0,
CV_OK = CV_NO_ERR
}
CvStatus;
@@ -720,8 +715,7 @@ CvFuncTable;
typedef struct CvBigFuncTable
{
void* fn_2d[CV_DEPTH_MAX*4];
}
CvBigFuncTable;
} CvBigFuncTable;
#define CV_INIT_FUNC_TAB( tab, FUNCNAME, FLAG ) \
(tab).fn_2d[CV_8U] = (void*)FUNCNAME##_8u##FLAG; \
@@ -732,13 +726,14 @@ CvBigFuncTable;
(tab).fn_2d[CV_32F] = (void*)FUNCNAME##_32f##FLAG; \
(tab).fn_2d[CV_64F] = (void*)FUNCNAME##_64f##FLAG
#ifdef __cplusplus
//! OpenGL extension table
class CV_EXPORTS CvOpenGlFuncTab
{
public:
virtual ~CvOpenGlFuncTab();
virtual void genBuffers(int n, unsigned int* buffers) const = 0;
virtual void genBuffers(int n, unsigned int* buffers) const = 0;
virtual void deleteBuffers(int n, const unsigned int* buffers) const = 0;
virtual void bufferData(unsigned int target, ptrdiff_t size, const void* data, unsigned int usage) const = 0;
@@ -764,4 +759,6 @@ CV_EXPORTS bool icvCheckGlError(const char* file, const int line, const char* fu
#define CV_CheckGlError() CV_DbgAssert( (::icvCheckGlError(__FILE__, __LINE__)) )
#endif
#endif
#endif //__cplusplus
#endif // __OPENCV_CORE_INTERNAL_HPP__

File diff suppressed because it is too large Load Diff

View File

@@ -47,282 +47,287 @@
#include "opencv2/core/core.hpp"
namespace cv
namespace cv
{
//! Smart pointer for OpenGL buffer memory with reference counting.
class CV_EXPORTS GlBuffer
//! Smart pointer for OpenGL buffer memory with reference counting.
class CV_EXPORTS GlBuffer
{
public:
enum Usage
{
public:
enum Usage
{
ARRAY_BUFFER = 0x8892, // buffer will use for OpenGL arrays (vertices, colors, normals, etc)
TEXTURE_BUFFER = 0x88EC // buffer will ise for OpenGL textures
};
//! create empty buffer
explicit GlBuffer(Usage usage);
//! create buffer
GlBuffer(int rows, int cols, int type, Usage usage);
GlBuffer(Size size, int type, Usage usage);
//! copy from host/device memory
GlBuffer(InputArray mat, Usage usage);
void create(int rows, int cols, int type, Usage usage);
inline void create(Size size, int type, Usage usage) { create(size.height, size.width, type, usage); }
inline void create(int rows, int cols, int type) { create(rows, cols, type, usage()); }
inline void create(Size size, int type) { create(size.height, size.width, type, usage()); }
void release();
//! copy from host/device memory
void copyFrom(InputArray mat);
void bind() const;
void unbind() const;
//! map to host memory
Mat mapHost();
void unmapHost();
//! map to device memory
gpu::GpuMat mapDevice();
void unmapDevice();
inline int rows() const { return rows_; }
inline int cols() const { return cols_; }
inline Size size() const { return Size(cols_, rows_); }
inline bool empty() const { return rows_ == 0 || cols_ == 0; }
inline int type() const { return type_; }
inline int depth() const { return CV_MAT_DEPTH(type_); }
inline int channels() const { return CV_MAT_CN(type_); }
inline int elemSize() const { return CV_ELEM_SIZE(type_); }
inline int elemSize1() const { return CV_ELEM_SIZE1(type_); }
inline Usage usage() const { return usage_; }
class Impl;
private:
int rows_;
int cols_;
int type_;
Usage usage_;
Ptr<Impl> impl_;
ARRAY_BUFFER = 0x8892, // buffer will use for OpenGL arrays (vertices, colors, normals, etc)
TEXTURE_BUFFER = 0x88EC // buffer will ise for OpenGL textures
};
template <> CV_EXPORTS void Ptr<GlBuffer::Impl>::delete_obj();
//! create empty buffer
explicit GlBuffer(Usage usage);
//! Smart pointer for OpenGL 2d texture memory with reference counting.
class CV_EXPORTS GlTexture
//! create buffer
GlBuffer(int rows, int cols, int type, Usage usage);
GlBuffer(Size size, int type, Usage usage);
//! copy from host/device memory
GlBuffer(InputArray mat, Usage usage);
void create(int rows, int cols, int type, Usage usage);
void create(Size size, int type, Usage usage);
void create(int rows, int cols, int type);
void create(Size size, int type);
void release();
//! copy from host/device memory
void copyFrom(InputArray mat);
void bind() const;
void unbind() const;
//! map to host memory
Mat mapHost();
void unmapHost();
//! map to device memory
gpu::GpuMat mapDevice();
void unmapDevice();
inline int rows() const { return rows_; }
inline int cols() const { return cols_; }
inline Size size() const { return Size(cols_, rows_); }
inline bool empty() const { return rows_ == 0 || cols_ == 0; }
inline int type() const { return type_; }
inline int depth() const { return CV_MAT_DEPTH(type_); }
inline int channels() const { return CV_MAT_CN(type_); }
inline int elemSize() const { return CV_ELEM_SIZE(type_); }
inline int elemSize1() const { return CV_ELEM_SIZE1(type_); }
inline Usage usage() const { return usage_; }
class Impl;
private:
int rows_;
int cols_;
int type_;
Usage usage_;
Ptr<Impl> impl_;
};
template <> CV_EXPORTS void Ptr<GlBuffer::Impl>::delete_obj();
//! Smart pointer for OpenGL 2d texture memory with reference counting.
class CV_EXPORTS GlTexture
{
public:
//! create empty texture
GlTexture();
//! create texture
GlTexture(int rows, int cols, int type);
GlTexture(Size size, int type);
//! copy from host/device memory
explicit GlTexture(InputArray mat, bool bgra = true);
void create(int rows, int cols, int type);
void create(Size size, int type);
void release();
//! copy from host/device memory
void copyFrom(InputArray mat, bool bgra = true);
void bind() const;
void unbind() const;
inline int rows() const { return rows_; }
inline int cols() const { return cols_; }
inline Size size() const { return Size(cols_, rows_); }
inline bool empty() const { return rows_ == 0 || cols_ == 0; }
inline int type() const { return type_; }
inline int depth() const { return CV_MAT_DEPTH(type_); }
inline int channels() const { return CV_MAT_CN(type_); }
inline int elemSize() const { return CV_ELEM_SIZE(type_); }
inline int elemSize1() const { return CV_ELEM_SIZE1(type_); }
class Impl;
private:
int rows_;
int cols_;
int type_;
Ptr<Impl> impl_;
GlBuffer buf_;
};
template <> CV_EXPORTS void Ptr<GlTexture::Impl>::delete_obj();
//! OpenGL Arrays
class CV_EXPORTS GlArrays
{
public:
inline GlArrays()
: vertex_(GlBuffer::ARRAY_BUFFER), color_(GlBuffer::ARRAY_BUFFER), bgra_(true), normal_(GlBuffer::ARRAY_BUFFER), texCoord_(GlBuffer::ARRAY_BUFFER)
{
public:
//! create empty texture
GlTexture();
//! create texture
GlTexture(int rows, int cols, int type);
GlTexture(Size size, int type);
//! copy from host/device memory
explicit GlTexture(InputArray mat, bool bgra = true);
void create(int rows, int cols, int type);
inline void create(Size size, int type) { create(size.height, size.width, type); }
void release();
//! copy from host/device memory
void copyFrom(InputArray mat, bool bgra = true);
void bind() const;
void unbind() const;
inline int rows() const { return rows_; }
inline int cols() const { return cols_; }
inline Size size() const { return Size(cols_, rows_); }
inline bool empty() const { return rows_ == 0 || cols_ == 0; }
inline int type() const { return type_; }
inline int depth() const { return CV_MAT_DEPTH(type_); }
inline int channels() const { return CV_MAT_CN(type_); }
inline int elemSize() const { return CV_ELEM_SIZE(type_); }
inline int elemSize1() const { return CV_ELEM_SIZE1(type_); }
class Impl;
private:
int rows_;
int cols_;
int type_;
Ptr<Impl> impl_;
GlBuffer buf_;
};
template <> CV_EXPORTS void Ptr<GlTexture::Impl>::delete_obj();
//! OpenGL Arrays
class CV_EXPORTS GlArrays
{
public:
inline GlArrays()
: vertex_(GlBuffer::ARRAY_BUFFER), color_(GlBuffer::ARRAY_BUFFER), bgra_(true), normal_(GlBuffer::ARRAY_BUFFER), texCoord_(GlBuffer::ARRAY_BUFFER)
{
}
void setVertexArray(InputArray vertex);
inline void resetVertexArray() { vertex_.release(); }
void setColorArray(InputArray color, bool bgra = true);
inline void resetColorArray() { color_.release(); }
void setNormalArray(InputArray normal);
inline void resetNormalArray() { normal_.release(); }
void setTexCoordArray(InputArray texCoord);
inline void resetTexCoordArray() { texCoord_.release(); }
void bind() const;
void unbind() const;
inline int rows() const { return vertex_.rows(); }
inline int cols() const { return vertex_.cols(); }
inline Size size() const { return vertex_.size(); }
inline bool empty() const { return vertex_.empty(); }
private:
GlBuffer vertex_;
GlBuffer color_;
bool bgra_;
GlBuffer normal_;
GlBuffer texCoord_;
};
//! OpenGL Font
class CV_EXPORTS GlFont
{
public:
enum Weight
{
WEIGHT_LIGHT = 300,
WEIGHT_NORMAL = 400,
WEIGHT_SEMIBOLD = 600,
WEIGHT_BOLD = 700,
WEIGHT_BLACK = 900
};
enum Style
{
STYLE_NORMAL = 0,
STYLE_ITALIC = 1,
STYLE_UNDERLINE = 2
};
static Ptr<GlFont> get(const std::string& family, int height = 12, Weight weight = WEIGHT_NORMAL, Style style = STYLE_NORMAL);
void draw(const char* str, int len) const;
inline const std::string& family() const { return family_; }
inline int height() const { return height_; }
inline Weight weight() const { return weight_; }
inline Style style() const { return style_; }
private:
GlFont(const std::string& family, int height, Weight weight, Style style);
std::string family_;
int height_;
Weight weight_;
Style style_;
unsigned int base_;
GlFont(const GlFont&);
GlFont& operator =(const GlFont&);
};
//! render functions
//! render texture rectangle in window
CV_EXPORTS void render(const GlTexture& tex,
Rect_<double> wndRect = Rect_<double>(0.0, 0.0, 1.0, 1.0),
Rect_<double> texRect = Rect_<double>(0.0, 0.0, 1.0, 1.0));
//! render mode
namespace RenderMode {
enum {
POINTS = 0x0000,
LINES = 0x0001,
LINE_LOOP = 0x0002,
LINE_STRIP = 0x0003,
TRIANGLES = 0x0004,
TRIANGLE_STRIP = 0x0005,
TRIANGLE_FAN = 0x0006,
QUADS = 0x0007,
QUAD_STRIP = 0x0008,
POLYGON = 0x0009
};
}
//! render OpenGL arrays
CV_EXPORTS void render(const GlArrays& arr, int mode = RenderMode::POINTS, Scalar color = Scalar::all(255));
void setVertexArray(InputArray vertex);
inline void resetVertexArray() { vertex_.release(); }
CV_EXPORTS void render(const std::string& str, const Ptr<GlFont>& font, Scalar color, Point2d pos);
void setColorArray(InputArray color, bool bgra = true);
inline void resetColorArray() { color_.release(); }
//! OpenGL camera
class CV_EXPORTS GlCamera
void setNormalArray(InputArray normal);
inline void resetNormalArray() { normal_.release(); }
void setTexCoordArray(InputArray texCoord);
inline void resetTexCoordArray() { texCoord_.release(); }
void bind() const;
void unbind() const;
inline int rows() const { return vertex_.rows(); }
inline int cols() const { return vertex_.cols(); }
inline Size size() const { return vertex_.size(); }
inline bool empty() const { return vertex_.empty(); }
private:
GlBuffer vertex_;
GlBuffer color_;
bool bgra_;
GlBuffer normal_;
GlBuffer texCoord_;
};
//! OpenGL Font
class CV_EXPORTS GlFont
{
public:
enum Weight
{
public:
GlCamera();
void lookAt(Point3d eye, Point3d center, Point3d up);
void setCameraPos(Point3d pos, double yaw, double pitch, double roll);
void setScale(Point3d scale);
void setProjectionMatrix(const Mat& projectionMatrix, bool transpose = true);
void setPerspectiveProjection(double fov, double aspect, double zNear, double zFar);
void setOrthoProjection(double left, double right, double bottom, double top, double zNear, double zFar);
void setupProjectionMatrix() const;
void setupModelViewMatrix() const;
private:
Point3d eye_;
Point3d center_;
Point3d up_;
Point3d pos_;
double yaw_;
double pitch_;
double roll_;
bool useLookAtParams_;
Point3d scale_;
Mat projectionMatrix_;
double fov_;
double aspect_;
double left_;
double right_;
double bottom_;
double top_;
double zNear_;
double zFar_;
bool perspectiveProjection_;
WEIGHT_LIGHT = 300,
WEIGHT_NORMAL = 400,
WEIGHT_SEMIBOLD = 600,
WEIGHT_BOLD = 700,
WEIGHT_BLACK = 900
};
namespace gpu
enum Style
{
//! set a CUDA device to use OpenGL interoperability
CV_EXPORTS void setGlDevice(int device = 0);
}
STYLE_NORMAL = 0,
STYLE_ITALIC = 1,
STYLE_UNDERLINE = 2
};
static Ptr<GlFont> get(const std::string& family, int height = 12, Weight weight = WEIGHT_NORMAL, Style style = STYLE_NORMAL);
void draw(const char* str, int len) const;
inline const std::string& family() const { return family_; }
inline int height() const { return height_; }
inline Weight weight() const { return weight_; }
inline Style style() const { return style_; }
private:
GlFont(const std::string& family, int height, Weight weight, Style style);
std::string family_;
int height_;
Weight weight_;
Style style_;
unsigned int base_;
GlFont(const GlFont&);
GlFont& operator =(const GlFont&);
};
//! render functions
//! render texture rectangle in window
CV_EXPORTS void render(const GlTexture& tex,
Rect_<double> wndRect = Rect_<double>(0.0, 0.0, 1.0, 1.0),
Rect_<double> texRect = Rect_<double>(0.0, 0.0, 1.0, 1.0));
//! render mode
namespace RenderMode {
enum {
POINTS = 0x0000,
LINES = 0x0001,
LINE_LOOP = 0x0002,
LINE_STRIP = 0x0003,
TRIANGLES = 0x0004,
TRIANGLE_STRIP = 0x0005,
TRIANGLE_FAN = 0x0006,
QUADS = 0x0007,
QUAD_STRIP = 0x0008,
POLYGON = 0x0009
};
}
//! render OpenGL arrays
CV_EXPORTS void render(const GlArrays& arr, int mode = RenderMode::POINTS, Scalar color = Scalar::all(255));
CV_EXPORTS void render(const std::string& str, const Ptr<GlFont>& font, Scalar color, Point2d pos);
//! OpenGL camera
class CV_EXPORTS GlCamera
{
public:
GlCamera();
void lookAt(Point3d eye, Point3d center, Point3d up);
void setCameraPos(Point3d pos, double yaw, double pitch, double roll);
void setScale(Point3d scale);
void setProjectionMatrix(const Mat& projectionMatrix, bool transpose = true);
void setPerspectiveProjection(double fov, double aspect, double zNear, double zFar);
void setOrthoProjection(double left, double right, double bottom, double top, double zNear, double zFar);
void setupProjectionMatrix() const;
void setupModelViewMatrix() const;
private:
Point3d eye_;
Point3d center_;
Point3d up_;
Point3d pos_;
double yaw_;
double pitch_;
double roll_;
bool useLookAtParams_;
Point3d scale_;
Mat projectionMatrix_;
double fov_;
double aspect_;
double left_;
double right_;
double bottom_;
double top_;
double zNear_;
double zFar_;
bool perspectiveProjection_;
};
inline void GlBuffer::create(Size _size, int _type, Usage _usage) { create(_size.height, _size.width, _type, _usage); }
inline void GlBuffer::create(int _rows, int _cols, int _type) { create(_rows, _cols, _type, usage()); }
inline void GlBuffer::create(Size _size, int _type) { create(_size.height, _size.width, _type, usage()); }
inline void GlTexture::create(Size _size, int _type) { create(_size.height, _size.width, _type); }
namespace gpu
{
//! set a CUDA device to use OpenGL interoperability
CV_EXPORTS void setGlDevice(int device = 0);
}
} // namespace cv
#endif // __cplusplus

File diff suppressed because it is too large Load Diff

View File

@@ -43,122 +43,132 @@
#ifndef __OPENCV_CORE_TYPES_H__
#define __OPENCV_CORE_TYPES_H__
#if !defined _CRT_SECURE_NO_DEPRECATE && _MSC_VER > 1300
#define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio 2005 warnings */
#if !defined _CRT_SECURE_NO_DEPRECATE && defined _MSC_VER
# if _MSC_VER > 1300
# define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio 2005 warnings */
# endif
#endif
#ifndef SKIP_INCLUDES
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#if !defined _MSC_VER && !defined __BORLANDC__
#include <stdint.h>
# include <stdint.h>
#endif
#if defined __ICL
#define CV_ICC __ICL
#elif defined __ICC
#define CV_ICC __ICC
#elif defined __ECL
#define CV_ICC __ECL
#elif defined __ECC
#define CV_ICC __ECC
#elif defined __INTEL_COMPILER
#define CV_ICC __INTEL_COMPILER
#endif
#if defined __ICL
# define CV_ICC __ICL
#elif defined __ICC
# define CV_ICC __ICC
#elif defined __ECL
# define CV_ICC __ECL
#elif defined __ECC
# define CV_ICC __ECC
#elif defined __INTEL_COMPILER
# define CV_ICC __INTEL_COMPILER
#endif
#if (_MSC_VER >= 1400 && defined _M_X64) || (__GNUC__ >= 4 && defined __x86_64__)
#if defined WIN32
#include <intrin.h>
#endif
#if __SSE2__ || !defined __GNUC__
#include <emmintrin.h>
#endif
#endif
#if defined CV_ICC && !defined CV_ENABLE_UNROLLED
# define CV_ENABLE_UNROLLED 0
#else
# define CV_ENABLE_UNROLLED 1
#endif
#if defined __BORLANDC__
#include <fastmath.h>
#else
#include <math.h>
#endif
#if (defined _M_X64 && defined _MSC_VER && _MSC_VER >= 1400) || (__GNUC__ >= 4 && defined __x86_64__)
# if defined WIN32
# include <intrin.h>
# endif
# if __SSE2__ || !defined __GNUC__
# include <emmintrin.h>
# endif
#endif
#if defined __BORLANDC__
# include <fastmath.h>
#else
# include <math.h>
#endif
#ifdef HAVE_IPL
# ifndef __IPL_H__
# if defined WIN32 || defined _WIN32
# include <ipl.h>
# else
# include <ipl/ipl.h>
# endif
# endif
#elif defined __IPL_H__
# define HAVE_IPL
#endif
#ifdef HAVE_IPL
#ifndef __IPL_H__
#if defined WIN32 || defined _WIN32
#include <ipl.h>
#else
#include <ipl/ipl.h>
#endif
#endif
#elif defined __IPL_H__
#define HAVE_IPL
#endif
#endif // SKIP_INCLUDES
#if defined WIN32 || defined _WIN32
#define CV_CDECL __cdecl
#define CV_STDCALL __stdcall
# define CV_CDECL __cdecl
# define CV_STDCALL __stdcall
#else
#define CV_CDECL
#define CV_STDCALL
# define CV_CDECL
# define CV_STDCALL
#endif
#ifndef CV_EXTERN_C
#ifdef __cplusplus
#define CV_EXTERN_C extern "C"
#define CV_DEFAULT(val) = val
#else
#define CV_EXTERN_C
#define CV_DEFAULT(val)
#endif
# ifdef __cplusplus
# define CV_EXTERN_C extern "C"
# define CV_DEFAULT(val) = val
# else
# define CV_EXTERN_C
# define CV_DEFAULT(val)
# endif
#endif
#ifndef CV_EXTERN_C_FUNCPTR
#ifdef __cplusplus
#define CV_EXTERN_C_FUNCPTR(x) extern "C" { typedef x; }
#else
#define CV_EXTERN_C_FUNCPTR(x) typedef x
#endif
# ifdef __cplusplus
# define CV_EXTERN_C_FUNCPTR(x) extern "C" { typedef x; }
# else
# define CV_EXTERN_C_FUNCPTR(x) typedef x
# endif
#endif
#ifndef CV_INLINE
#if defined __cplusplus
#define CV_INLINE inline
#elif (defined WIN32 || defined _WIN32 || defined WINCE) && !defined __GNUC__
#define CV_INLINE __inline
#else
#define CV_INLINE static
#endif
# if defined __cplusplus
# define CV_INLINE inline
# elif (defined WIN32 || defined _WIN32 || defined WINCE) && !defined __GNUC__
# define CV_INLINE __inline
# else
# define CV_INLINE static
# endif
#endif /* CV_INLINE */
#if (defined WIN32 || defined _WIN32 || defined WINCE) && defined CVAPI_EXPORTS
#define CV_EXPORTS __declspec(dllexport)
# define CV_EXPORTS __declspec(dllexport)
#else
#define CV_EXPORTS
# define CV_EXPORTS
#endif
#ifndef CVAPI
#define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL
# define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL
#endif
#if defined _MSC_VER || defined __BORLANDC__
typedef __int64 int64;
typedef unsigned __int64 uint64;
#define CV_BIG_INT(n) n##I64
#define CV_BIG_UINT(n) n##UI64
typedef __int64 int64;
typedef unsigned __int64 uint64;
# define CV_BIG_INT(n) n##I64
# define CV_BIG_UINT(n) n##UI64
#else
typedef int64_t int64;
typedef uint64_t uint64;
#define CV_BIG_INT(n) n##LL
#define CV_BIG_UINT(n) n##ULL
typedef int64_t int64;
typedef uint64_t uint64;
# define CV_BIG_INT(n) n##LL
# define CV_BIG_UINT(n) n##ULL
#endif
#ifndef HAVE_IPL
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned char uchar;
typedef unsigned short ushort;
#endif
typedef signed char schar;
@@ -203,7 +213,7 @@ Cv64suf;
typedef int CVStatus;
enum {
enum {
CV_StsOk= 0, /* everithing is ok */
CV_StsBackTrace= -1, /* pseudo error for back trace */
CV_StsError= -2, /* unknown /unspecified error */
@@ -241,8 +251,8 @@ enum {
CV_StsInplaceNotSupported= -203, /* in-place operation is not supported */
CV_StsObjectNotFound= -204, /* request can't be completed */
CV_StsUnmatchedFormats= -205, /* formats of input/output arrays differ */
CV_StsBadFlag= -206, /* flag is wrong or not supported */
CV_StsBadPoint= -207, /* bad CvPoint */
CV_StsBadFlag= -206, /* flag is wrong or not supported */
CV_StsBadPoint= -207, /* bad CvPoint */
CV_StsBadMask= -208, /* bad format of mask (neither 8uC1 nor 8sC1)*/
CV_StsUnmatchedSizes= -209, /* sizes of input/output structures do not match */
CV_StsUnsupportedFormat= -210, /* the data format/type is not supported by the function*/
@@ -250,8 +260,8 @@ enum {
CV_StsParseError= -212, /* invalid syntax/structure of the parsed file */
CV_StsNotImplemented= -213, /* the requested function/feature is not implemented */
CV_StsBadMemBlock= -214, /* an allocated block has been corrupted */
CV_StsAssert= -215, /* assertion failed */
CV_GpuNotSupported= -216,
CV_StsAssert= -215, /* assertion failed */
CV_GpuNotSupported= -216,
CV_GpuApiCallError= -217,
CV_OpenGlNotSupported= -218,
CV_OpenGlApiCallError= -219
@@ -262,7 +272,7 @@ enum {
\****************************************************************************************/
#ifdef HAVE_TEGRA_OPTIMIZATION
# include "tegra_round.hpp"
# include "tegra_round.hpp"
#endif
#define CV_PI 3.1415926535897932384626433832795
@@ -271,11 +281,11 @@ enum {
#define CV_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) = (t))
#ifndef MIN
#define MIN(a,b) ((a) > (b) ? (b) : (a))
# define MIN(a,b) ((a) > (b) ? (b) : (a))
#endif
#ifndef MAX
#define MAX(a,b) ((a) < (b) ? (b) : (a))
# define MAX(a,b) ((a) < (b) ? (b) : (a))
#endif
/* min & max without jumps */
@@ -285,9 +295,9 @@ enum {
/* absolute value without jumps */
#ifndef __cplusplus
#define CV_IABS(a) (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0))
# define CV_IABS(a) (((a) ^ ((a) < 0 ? -1 : 0)) - ((a) < 0 ? -1 : 0))
#else
#define CV_IABS(a) abs(a)
# define CV_IABS(a) abs(a)
#endif
#define CV_CMP(a,b) (((a) > (b)) - ((a) < (b)))
#define CV_SIGN(a) CV_CMP((a),0)
@@ -306,11 +316,11 @@ CV_INLINE int cvRound( double value )
}
return t;
#elif defined HAVE_LRINT || defined CV_ICC || defined __GNUC__
# ifdef HAVE_TEGRA_OPTIMIZATION
# ifdef HAVE_TEGRA_OPTIMIZATION
TEGRA_ROUND(value);
# else
# else
return (int)lrint(value);
# endif
# endif
#else
// while this is not IEEE754-compliant rounding, it's usually a good enough approximation
return (int)(value + (value >= 0 ? 0.5 : -0.5));
@@ -318,7 +328,7 @@ CV_INLINE int cvRound( double value )
}
#if defined __SSE2__ || (defined _M_IX86_FP && 2 == _M_IX86_FP)
#include "emmintrin.h"
# include "emmintrin.h"
#endif
CV_INLINE int cvFloor( double value )
@@ -1886,6 +1896,6 @@ typedef struct CvModuleInfo
}
CvModuleInfo;
#endif /*_CXCORE_TYPES_H_*/
#endif /*__OPENCV_CORE_TYPES_H__*/
/* End of file. */