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"
98 StsFilterStructContentErr= -29,
99 StsKernelStructContentErr= -30,
100 StsFilterOffsetErr= -31,
103 StsInplaceNotSupported= -203,
104 StsObjectNotFound= -204,
105 StsUnmatchedFormats= -205,
109 StsUnmatchedSizes= -209,
110 StsUnsupportedFormat= -210,
113 StsNotImplemented= -213,
114 StsBadMemBlock= -214,
116 GpuNotSupported= -216,
117 GpuApiCallError= -217,
118 OpenGlNotSupported= -218,
119 OpenGlApiCallError= -219,
120 OpenCLApiCallError= -220,
121 OpenCLDoubleNotSupported= -221,
122 OpenCLInitError= -222,
123 OpenCLNoAMDBlasFft= -223
298CV_EXPORTS CV_NORETURN
void error(
int _code,
const String& _err,
const char* _func,
const char* _file,
int _line);
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)
385 typedef unsigned char ValueType;
386 typedef int ResultType;
390 ResultType
operator()(
const unsigned char* a,
const unsigned char* b,
int size )
const;
397template<
typename _Tp>
inline _Tp cv_abs(_Tp x) {
return std::abs(x); }
398inline int cv_abs(uchar x) {
return x; }
399inline int cv_abs(schar x) {
return std::abs(x); }
400inline int cv_abs(ushort x) {
return x; }
401inline int cv_abs(
short x) {
return std::abs(x); }
403template<
typename _Tp,
typename _AccTp>
static inline
404_AccTp normL2Sqr(
const _Tp* a,
int n)
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;
423template<
typename _Tp,
typename _AccTp>
static inline
424_AccTp normL1(
const _Tp* a,
int n)
428#if CV_ENABLE_UNROLLED
429 for(; i <= n - 4; i += 4 )
431 s += (_AccTp)cv_abs(a[i]) + (_AccTp)cv_abs(a[i+1]) +
432 (_AccTp)cv_abs(a[i+2]) + (_AccTp)cv_abs(a[i+3]);
440template<
typename _Tp,
typename _AccTp>
static inline
441_AccTp normInf(
const _Tp* a,
int n)
444 for(
int i = 0; i < n; i++ )
445 s =
std::max(s, (_AccTp)cv_abs(a[i]));
449template<
typename _Tp,
typename _AccTp>
static inline
450_AccTp normL2Sqr(
const _Tp* a,
const _Tp* b,
int n)
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]);
469static 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];
480template<
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]);
500inline float normL1(
const float* a,
const float* b,
int n)
503 for(
int i = 0; i < n; i++ )
510inline int normL1(
const uchar* a,
const uchar* b,
int n)
513 for(
int i = 0; i < n; i++ )
520template<
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];
561CV_EXPORTS
int LU(
float* A,
size_t astep,
int m,
float* b,
size_t bstep,
int n);
563CV_EXPORTS
int LU(
double* A,
size_t astep,
int m,
double* b,
size_t bstep,
int n);
565CV_EXPORTS
bool Cholesky(
float* A,
size_t astep,
int m,
float* b,
size_t bstep,
int n);
567CV_EXPORTS
bool Cholesky(
double* A,
size_t astep,
int m,
double* b,
size_t bstep,
int n);
573template<
typename _Tp,
int cn>
class Vec;
574template<
typename _Tp,
int m,
int n>
class Matx;
576template<
typename _Tp>
class Complex;
577template<
typename _Tp>
class Point_;
578template<
typename _Tp>
class Point3_;
579template<
typename _Tp>
class Size_;
580template<
typename _Tp>
class Rect_;
581template<
typename _Tp>
class Scalar_;
584class CV_EXPORTS
Range;
593class CV_EXPORTS
UMat;
598template<
typename _Tp>
class Mat_;
611 class CV_EXPORTS Buffer;
612 class CV_EXPORTS Texture2D;
613 class CV_EXPORTS Arrays;
618 class CV_EXPORTS GpuMat;
619 class CV_EXPORTS HostMem;
620 class CV_EXPORTS Stream;
621 class CV_EXPORTS Event;
626 template <
typename _Tp>
class GpuMat_;
631CV_EXPORTS
unsigned long long getIppFeatures();
632CV_EXPORTS
void setIppStatus(
int status,
const char *
const funcname = NULL,
const char *
const filename = NULL,
634CV_EXPORTS
int getIppStatus();
635CV_EXPORTS String getIppErrorLocation();
636CV_EXPORTS_W
bool useIPP();
637CV_EXPORTS_W
void setUseIPP(
bool flag);
638CV_EXPORTS_W String getIppVersion();
642CV_EXPORTS_W
bool useIPP_NotExact();
643CV_EXPORTS_W
void setUseIPP_NotExact(
bool flag);
644#ifndef DISABLE_OPENCV_3_COMPATIBILITY
645static inline bool useIPP_NE() {
return useIPP_NotExact(); }
646static 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: core/types.hpp:75
Class for matching keypoint descriptors
Definition: core/types.hpp:809
Data structure for salient point detectors.
Definition: core/types.hpp:712
Template matrix class derived from Mat
Definition: mat.hpp:2199
Matrix read-only iterator
Definition: mat.hpp:3118
Matrix expression representation This is a list of implemented matrix operations that can be combined...
Definition: mat.hpp:3555
n-dimensional dense array class
Definition: mat.hpp:802
Matrix read-write iterator
Definition: mat.hpp:3171
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: core/types.hpp:240
Template class for 2D points specified by its coordinates x and y.
Definition: core/types.hpp:158
Random Number Generator
Definition: core.hpp:2783
Template class specifying a continuous subsequence (slice) of a sequence.
Definition: core/types.hpp:590
Template class for 2D rectangles
Definition: core/types.hpp:421
The class represents rotated (i.e. not up-right) rectangles on a plane.
Definition: core/types.hpp:504
Template class for a 4-element vector derived from Vec.
Definition: core/types.hpp:637
Template class for specifying the size of an image or rectangle.
Definition: core/types.hpp:316
Template sparse n-dimensional array class derived from SparseMat
Definition: mat.hpp:2982
Template Read-Only Sparse Matrix Iterator Class.
Definition: mat.hpp:3307
Read-Only Sparse Matrix Iterator.
Definition: mat.hpp:3229
The class SparseMat represents multi-dimensional sparse numerical arrays.
Definition: mat.hpp:2704
Template Read-Write Sparse Matrix Iterator Class.
Definition: mat.hpp:3341
Read-write Sparse Matrix Iterator
Definition: mat.hpp:3273
The class defining termination criteria for iterative algorithms.
Definition: core/types.hpp:853
Template class for short numerical vectors, a partial case of Matx
Definition: matx.hpp:342
CmpTypes
comparison types
Definition: base.hpp:211
BorderTypes
Definition: base.hpp:268
CV_EXPORTS_W void max(InputArray src1, InputArray src2, OutputArray dst)
Calculates per-element maximum of two arrays or an array and a scalar.
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
do not look outside of ROI
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
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
softfloat abs(softfloat a)
Absolute value
Definition: softfloat.hpp:444
CV_EXPORTS softfloat cbrt(const softfloat &a)
Cube root
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.
CV_EXPORTS CV_NORETURN void error(const Exception &exc)
Signals an error and raises the exception.
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)
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.
"black box" representation of the file storage associated with a file on disk.
Definition: aruco.hpp:75
ResultType operator()(const unsigned char *a, const unsigned char *b, int size) const