45 #ifndef OPENCV_CORE_BASE_HPP
46 #define OPENCV_CORE_BASE_HPP
49 # error base.hpp header must be compiled as C++
52 #include "opencv2/opencv_modules.hpp"
57 #include "opencv2/core/cvdef.h"
58 #include "opencv2/core/cvstd.hpp"
300 #ifdef CV_STATIC_ANALYSIS
304 #define CV_Error(code, msg) do { (void)(code); (void)(msg); abort(); } while (0)
305 #define CV_Error_(code, args) do { (void)(code); (void)(cv::format args); abort(); } while (0)
306 #define CV_Assert( expr ) do { if (!(expr)) abort(); } while (0)
320 #define CV_Error( code, msg ) cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
334 #define CV_Error_( code, args ) cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ )
342 #define CV_Assert( expr ) do { if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ ); } while(0)
347 #if !defined(__OPENCV_BUILD)
348 #ifndef CV_ErrorNoReturn
349 #define CV_ErrorNoReturn CV_Error
351 #ifndef CV_ErrorNoReturn_
352 #define CV_ErrorNoReturn_ CV_Error_
356 #define CV_Assert_1 CV_Assert
357 #define CV_Assert_2( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_1( __VA_ARGS__ ))
358 #define CV_Assert_3( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_2( __VA_ARGS__ ))
359 #define CV_Assert_4( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_3( __VA_ARGS__ ))
360 #define CV_Assert_5( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_4( __VA_ARGS__ ))
361 #define CV_Assert_6( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_5( __VA_ARGS__ ))
362 #define CV_Assert_7( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_6( __VA_ARGS__ ))
363 #define CV_Assert_8( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_7( __VA_ARGS__ ))
364 #define CV_Assert_9( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_8( __VA_ARGS__ ))
365 #define CV_Assert_10( expr, ... ) CV_Assert_1(expr); __CV_EXPAND(CV_Assert_9( __VA_ARGS__ ))
367 #define CV_Assert_N(...) do { __CV_EXPAND(__CV_CAT(CV_Assert_, __CV_VA_NUM_ARGS(__VA_ARGS__)) (__VA_ARGS__)); } while(0)
371 #if defined _DEBUG || defined CV_STATIC_ANALYSIS
372 # define CV_DbgAssert(expr) CV_Assert(expr)
375 # define CV_DbgAssert(expr)
403 template<
typename _Tp,
typename _AccTp>
static inline
408 #if CV_ENABLE_UNROLLED
409 for( ; i <= n - 4; i += 4 )
411 _AccTp v0 = a[i], v1 = a[i+1], v2 = a[i+2], v3 = a[i+3];
412 s += v0*v0 + v1*v1 + v2*v2 + v3*v3;
423 template<
typename _Tp,
typename _AccTp>
static inline
428 #if CV_ENABLE_UNROLLED
429 for(; i <= n - 4; i += 4 )
440 template<
typename _Tp,
typename _AccTp>
static inline
444 for(
int i = 0; i < n; i++ )
449 template<
typename _Tp,
typename _AccTp>
static inline
454 #if CV_ENABLE_UNROLLED
455 for(; i <= n - 4; i += 4 )
457 _AccTp v0 = _AccTp(a[i] - b[i]), v1 = _AccTp(a[i+1] - b[i+1]), v2 = _AccTp(a[i+2] - b[i+2]), v3 = _AccTp(a[i+3] - b[i+3]);
458 s += v0*v0 + v1*v1 + v2*v2 + v3*v3;
463 _AccTp v = _AccTp(a[i] - b[i]);
469 static inline float normL2Sqr(
const float* a,
const float* b,
int n)
472 for(
int i = 0; i < n; i++ )
474 float v = a[i] - b[i];
480 template<
typename _Tp,
typename _AccTp>
static inline
481 _AccTp
normL1(
const _Tp* a,
const _Tp* b,
int n)
485 #if CV_ENABLE_UNROLLED
486 for(; i <= n - 4; i += 4 )
488 _AccTp v0 = _AccTp(a[i] - b[i]), v1 = _AccTp(a[i+1] - b[i+1]), v2 = _AccTp(a[i+2] - b[i+2]), v3 = _AccTp(a[i+3] - b[i+3]);
494 _AccTp v = _AccTp(a[i] - b[i]);
500 inline float normL1(
const float* a,
const float* b,
int n)
503 for(
int i = 0; i < n; i++ )
513 for(
int i = 0; i < n; i++ )
520 template<
typename _Tp,
typename _AccTp>
static inline
521 _AccTp
normInf(
const _Tp* a,
const _Tp* b,
int n)
524 for(
int i = 0; i < n; i++ )
526 _AccTp v0 = a[i] - b[i];
561 CV_EXPORTS int LU(
float* A,
size_t astep,
int m,
float* b,
size_t bstep,
int n);
563 CV_EXPORTS int LU(
double* A,
size_t astep,
int m,
double* b,
size_t bstep,
int n);
573 template<
typename _Tp,
int cn>
class Vec;
574 template<
typename _Tp,
int m,
int n>
class Matx;
576 template<
typename _Tp>
class Complex;
577 template<
typename _Tp>
class Point_;
578 template<
typename _Tp>
class Point3_;
579 template<
typename _Tp>
class Size_;
580 template<
typename _Tp>
class Rect_;
581 template<
typename _Tp>
class Scalar_;
598 template<
typename _Tp>
class Mat_;
626 template <
typename _Tp>
class GpuMat_;
631 CV_EXPORTS unsigned long long getIppFeatures();
632 CV_EXPORTS void setIppStatus(
int status,
const char *
const funcname = NULL,
const char *
const filename = NULL,
644 #ifndef DISABLE_OPENCV_3_COMPATIBILITY
645 static inline bool useIPP_NE() {
return useIPP_NotExact(); }
646 static inline void setUseIPP_NE(
bool flag) { setUseIPP_NotExact(flag); }
660 #include "opencv2/core/neon_utils.hpp"
661 #include "opencv2/core/vsx_utils.hpp"
662 #include "opencv2/core/check.hpp"
A complex number class.
Definition: types.hpp:80
Class for matching keypoint descriptors.
Definition: types.hpp:842
Data structure for salient point detectors.
Definition: types.hpp:745
Matrix read-only iterator.
Definition: mat.hpp:3149
Matrix expression representation This is a list of implemented matrix operations that can be combined...
Definition: mat.hpp:3586
Matrix read-write iterator.
Definition: mat.hpp:3202
Template matrix class derived from Mat.
Definition: mat.hpp:2230
n-dimensional dense array class
Definition: mat.hpp:812
Template class for small matrices whose type and size are known at compilation time.
Definition: matx.hpp:100
Template class for 3D points specified by its coordinates x, y and z.
Definition: types.hpp:255
Template class for 2D points specified by its coordinates x and y.
Definition: types.hpp:163
Random Number Generator.
Definition: core.hpp:2889
Template class specifying a continuous subsequence (slice) of a sequence.
Definition: types.hpp:623
Template class for 2D rectangles.
Definition: types.hpp:444
The class represents rotated (i.e. not up-right) rectangles on a plane.
Definition: types.hpp:531
Template class for a 4-element vector derived from Vec.
Definition: types.hpp:670
Template class for specifying the size of an image or rectangle.
Definition: types.hpp:335
Template Read-Only Sparse Matrix Iterator Class.
Definition: mat.hpp:3338
Read-Only Sparse Matrix Iterator.
Definition: mat.hpp:3260
Template Read-Write Sparse Matrix Iterator Class.
Definition: mat.hpp:3372
Read-write Sparse Matrix Iterator.
Definition: mat.hpp:3304
Template sparse n-dimensional array class derived from SparseMat.
Definition: mat.hpp:3013
The class SparseMat represents multi-dimensional sparse numerical arrays.
Definition: mat.hpp:2735
The class defining termination criteria for iterative algorithms.
Definition: types.hpp:886
Template class for short numerical vectors, a partial case of Matx.
Definition: matx.hpp:369
CmpTypes
comparison types
Definition: base.hpp:211
BorderTypes
Definition: base.hpp:268
GemmFlags
generalized matrix multiplication flags
Definition: base.hpp:220
DecompTypes
matrix decomposition types
Definition: base.hpp:133
NormTypes
Definition: base.hpp:159
DftFlags
Definition: base.hpp:225
@ CMP_GE
src1 is greater than or equal to src2.
Definition: base.hpp:213
@ CMP_LE
src1 is less than or equal to src2.
Definition: base.hpp:215
@ CMP_LT
src1 is less than src2.
Definition: base.hpp:214
@ CMP_NE
src1 is unequal to src2.
Definition: base.hpp:216
@ CMP_EQ
src1 is equal to src2.
Definition: base.hpp:211
@ CMP_GT
src1 is greater than src2.
Definition: base.hpp:212
@ BORDER_REFLECT101
same as BORDER_REFLECT_101
Definition: base.hpp:276
@ BORDER_ISOLATED
Interpolation restricted within the ROI boundaries.
Definition: base.hpp:278
@ BORDER_WRAP
cdefgh|abcdefgh|abcdefg
Definition: base.hpp:272
@ BORDER_REFLECT
fedcba|abcdefgh|hgfedcb
Definition: base.hpp:271
@ BORDER_TRANSPARENT
uvwxyz|abcdefgh|ijklmno - Treats outliers as transparent.
Definition: base.hpp:274
@ BORDER_REPLICATE
aaaaaa|abcdefgh|hhhhhhh
Definition: base.hpp:270
@ BORDER_REFLECT_101
gfedcb|abcdefgh|gfedcba
Definition: base.hpp:273
@ BORDER_CONSTANT
iiiiii|abcdefgh|iiiiiii with some specified i
Definition: base.hpp:269
@ BORDER_DEFAULT
same as BORDER_REFLECT_101
Definition: base.hpp:277
@ GEMM_1_T
transposes src1
Definition: base.hpp:220
@ GEMM_2_T
transposes src2
Definition: base.hpp:221
@ GEMM_3_T
transposes src3
Definition: base.hpp:222
@ DECOMP_NORMAL
Definition: base.hpp:151
@ DECOMP_LU
Definition: base.hpp:135
@ DECOMP_CHOLESKY
Definition: base.hpp:143
@ DECOMP_EIG
Definition: base.hpp:140
@ DECOMP_SVD
Definition: base.hpp:138
@ DECOMP_QR
Definition: base.hpp:145
@ NORM_RELATIVE
flag
Definition: base.hpp:206
@ NORM_HAMMING
Definition: base.hpp:199
@ NORM_L2
Definition: base.hpp:185
@ NORM_HAMMING2
Definition: base.hpp:204
@ NORM_MINMAX
flag
Definition: base.hpp:207
@ NORM_TYPE_MASK
bit-mask which can be used to separate norm type from norm flags
Definition: base.hpp:205
@ NORM_L1
Definition: base.hpp:176
@ NORM_L2SQR
Definition: base.hpp:194
@ NORM_INF
Definition: base.hpp:168
@ DFT_COMPLEX_OUTPUT
Definition: base.hpp:243
@ DFT_ROWS
Definition: base.hpp:236
@ DFT_REAL_OUTPUT
Definition: base.hpp:252
@ DCT_ROWS
Definition: base.hpp:263
@ DFT_INVERSE
Definition: base.hpp:228
@ DFT_SCALE
Definition: base.hpp:231
@ DCT_INVERSE
Definition: base.hpp:258
@ DFT_COMPLEX_INPUT
Definition: base.hpp:256
std::string String
Definition: cvstd.hpp:151
CvSize size
Definition: core_c.h:112
const char const char ** filename
Definition: core_c.h:2630
const CvArr CvArr * x
Definition: core_c.h:1195
const CvArr * y
Definition: core_c.h:1187
signed char schar
Definition: interface.h:48
unsigned char uchar
Definition: interface.h:51
unsigned short ushort
Definition: interface.h:52
softfloat abs(softfloat a)
Absolute value.
Definition: softfloat.hpp:444
#define CV_EXPORTS
Definition: cvdef.h:435
CV_EXPORTS int LU(float *A, size_t astep, int m, float *b, size_t bstep, int n)
CV_EXPORTS_W float cubeRoot(float val)
Computes the cube root of an argument.
#define CV_EXPORTS_W
Definition: cvdef.h:472
Hamming HammingLUT
Definition: base.hpp:393
#define CV_NORETURN
Definition: cvdef.h:735
_Tp cv_abs(_Tp x)
Definition: base.hpp:397
CV_EXPORTS_W float fastAtan2(float y, float x)
Calculates the angle of a 2D vector in degrees.
CV_EXPORTS bool Cholesky(float *A, size_t astep, int m, float *b, size_t bstep, int n)
static _AccTp normL1(const _Tp *a, int n)
Definition: base.hpp:424
CV_EXPORTS CV_NORETURN void error(int _code, const String &_err, const char *_func, const char *_file, int _line)
Signals an error and raises the exception.
static _AccTp normL2Sqr(const _Tp *a, int n)
Definition: base.hpp:404
static _AccTp normInf(const _Tp *a, int n)
Definition: base.hpp:441
CV_EXPORTS_W void line(InputOutputArray img, Point pt1, Point pt2, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
Draws a line segment connecting two points.
Code
error codes
Definition: base.hpp:68
@ BadDepth
input image depth is not supported by the function
Definition: base.hpp:86
@ BadNumChannel1U
Definition: base.hpp:85
@ StsAutoTrace
tracing
Definition: base.hpp:77
@ HeaderIsNull
image header is NULL
Definition: base.hpp:78
@ StsUnmatchedFormats
formats of input/output arrays differ
Definition: base.hpp:105
@ BadStep
image step is wrong, this may happen for a non-continuous matrix.
Definition: base.hpp:82
@ OpenCLDoubleNotSupported
Definition: base.hpp:121
@ StsBadSize
the input/output structure size is incorrect
Definition: base.hpp:101
@ StsInplaceNotSupported
in-place operation is not supported
Definition: base.hpp:103
@ BadModelOrChSeq
Definition: base.hpp:83
@ StsNoMem
insufficient memory
Definition: base.hpp:73
@ StsUnsupportedFormat
the data format/type is not supported by the function
Definition: base.hpp:110
@ StsKernelStructContentErr
incorrect transform kernel content
Definition: base.hpp:99
@ BadOffset
offset is invalid
Definition: base.hpp:80
@ StsVecLengthErr
incorrect vector length
Definition: base.hpp:97
@ StsBadMemBlock
an allocated block has been corrupted
Definition: base.hpp:114
@ OpenCLInitError
OpenCL initialization error.
Definition: base.hpp:122
@ StsFilterOffsetErr
incorrect filter offset value
Definition: base.hpp:100
@ BadNumChannels
bad number of channels, for example, some functions accept only single channel matrices.
Definition: base.hpp:84
@ StsFilterStructContentErr
incorrect filter structure content
Definition: base.hpp:98
@ StsBadMask
bad format of mask (neither 8uC1 nor 8sC1)
Definition: base.hpp:108
@ OpenCLNoAMDBlasFft
Definition: base.hpp:123
@ StsUnmatchedSizes
sizes of input/output structures do not match
Definition: base.hpp:109
@ BadAlign
incorrect input align
Definition: base.hpp:90
@ BadTileSize
Definition: base.hpp:92
@ BadCOI
input COI is not supported
Definition: base.hpp:93
@ GpuApiCallError
GPU API call error.
Definition: base.hpp:117
@ StsNoConv
iteration didn't converge
Definition: base.hpp:76
@ StsDivByZero
division by zero
Definition: base.hpp:102
@ BadROISize
incorrect input roi
Definition: base.hpp:94
@ StsParseError
invalid syntax/structure of the parsed file
Definition: base.hpp:112
@ BadImageSize
image size is invalid
Definition: base.hpp:79
@ GpuNotSupported
no CUDA support
Definition: base.hpp:116
@ MaskIsTiled
Definition: base.hpp:95
@ OpenCLApiCallError
OpenCL API call error.
Definition: base.hpp:120
@ OpenGlApiCallError
OpenGL API call error.
Definition: base.hpp:119
@ BadAlphaChannel
Definition: base.hpp:87
@ StsBadPoint
bad CvPoint
Definition: base.hpp:107
@ StsAssert
assertion failed
Definition: base.hpp:115
@ StsInternal
internal error (bad state)
Definition: base.hpp:72
@ StsNotImplemented
the requested function/feature is not implemented
Definition: base.hpp:113
@ StsOk
everything is ok
Definition: base.hpp:69
@ StsBadFlag
flag is wrong or not supported
Definition: base.hpp:106
@ BadOrigin
incorrect input origin
Definition: base.hpp:89
@ StsError
unknown /unspecified error
Definition: base.hpp:71
@ StsBackTrace
pseudo error for back trace
Definition: base.hpp:70
@ StsNullPtr
null pointer
Definition: base.hpp:96
@ StsObjectNotFound
request can't be completed
Definition: base.hpp:104
@ BadOrder
number of dimensions is out of range
Definition: base.hpp:88
@ StsOutOfRange
some of parameters are out of range
Definition: base.hpp:111
@ OpenGlNotSupported
no OpenGL support
Definition: base.hpp:118
@ BadDataPtr
Definition: base.hpp:81
@ BadCallBack
Definition: base.hpp:91
@ StsBadArg
function arg/param is bad
Definition: base.hpp:74
@ StsBadFunc
unsupported function
Definition: base.hpp:75
"black box" representation of the file storage associated with a file on disk.
Definition: calib3d.hpp:441
ResultType operator()(const unsigned char *a, const unsigned char *b, int size) const
int ResultType
Definition: base.hpp:386
unsigned char ValueType
Definition: base.hpp:385