OpenCV  3.0.0-dev
Open Source Computer Vision
Modules | Namespaces | Classes | Macros | Typedefs | Enumerations | Functions
Utility and system functions and macros

Modules

 NEON utilities
 

Namespaces

 cv::Error
 

Classes

class  cv::Allocator< _Tp >
 
class  cv::AutoBuffer< _Tp, fixed_size >
 Automatically Allocated Buffer Class. More...
 
class  cv::AutoLock
 
class  cv::CommandLineParser
 Designed for command line parsing. More...
 
class  cv::Exception
 Class passed to an error. More...
 
struct  cv::Hamming
 
class  cv::Mutex
 
class  cv::ParallelLoopBody
 Base class for parallel data processors. More...
 
class  cv::Allocator< _Tp >::rebind< U >
 
class  cv::TLSData< T >
 
class  cv::TLSDataContainer
 

Macros

#define CV_Assert(expr)   if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )
 Checks a condition at runtime and throws exception if it fails. More...
 
#define CV_DbgAssert(expr)
 
#define CV_Error(code, msg)   cv::error( code, msg, CV_Func, __FILE__, __LINE__ )
 Call the error handler. More...
 
#define CV_Error_(code, args)   cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ )
 Call the error handler. More...
 
#define CV_ErrorNoReturn(code, msg)   cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )
 
#define CV_ErrorNoReturn_(code, args)   cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )
 
#define CV_Func   ""
 

Typedefs

typedef int(* cv::ErrorCallback) (int status, const char *func_name, const char *err_msg, const char *file_name, int line, void *userdata)
 
typedef Hamming cv::HammingLUT
 

Enumerations

enum  { cv::Hamming::normType = NORM_HAMMING }
 
enum  cv::Error::Code {
  cv::Error::StsOk = 0,
  cv::Error::StsBackTrace = -1,
  cv::Error::StsError = -2,
  cv::Error::StsInternal = -3,
  cv::Error::StsNoMem = -4,
  cv::Error::StsBadArg = -5,
  cv::Error::StsBadFunc = -6,
  cv::Error::StsNoConv = -7,
  cv::Error::StsAutoTrace = -8,
  cv::Error::HeaderIsNull = -9,
  cv::Error::BadImageSize = -10,
  cv::Error::BadOffset = -11,
  cv::Error::BadDataPtr = -12,
  cv::Error::BadStep = -13,
  cv::Error::BadModelOrChSeq = -14,
  cv::Error::BadNumChannels = -15,
  cv::Error::BadNumChannel1U = -16,
  cv::Error::BadDepth = -17,
  cv::Error::BadAlphaChannel = -18,
  cv::Error::BadOrder = -19,
  cv::Error::BadOrigin = -20,
  cv::Error::BadAlign = -21,
  cv::Error::BadCallBack = -22,
  cv::Error::BadTileSize = -23,
  cv::Error::BadCOI = -24,
  cv::Error::BadROISize = -25,
  cv::Error::MaskIsTiled = -26,
  cv::Error::StsNullPtr = -27,
  cv::Error::StsVecLengthErr = -28,
  cv::Error::StsFilterStructContentErr = -29,
  cv::Error::StsKernelStructContentErr = -30,
  cv::Error::StsFilterOffsetErr = -31,
  cv::Error::StsBadSize = -201,
  cv::Error::StsDivByZero = -202,
  cv::Error::StsInplaceNotSupported = -203,
  cv::Error::StsObjectNotFound = -204,
  cv::Error::StsUnmatchedFormats = -205,
  cv::Error::StsBadFlag = -206,
  cv::Error::StsBadPoint = -207,
  cv::Error::StsBadMask = -208,
  cv::Error::StsUnmatchedSizes = -209,
  cv::Error::StsUnsupportedFormat = -210,
  cv::Error::StsOutOfRange = -211,
  cv::Error::StsParseError = -212,
  cv::Error::StsNotImplemented = -213,
  cv::Error::StsBadMemBlock = -214,
  cv::Error::StsAssert = -215,
  cv::Error::GpuNotSupported = -216,
  cv::Error::GpuApiCallError = -217,
  cv::Error::OpenGlNotSupported = -218,
  cv::Error::OpenGlApiCallError = -219,
  cv::Error::OpenCLApiCallError = -220,
  cv::Error::OpenCLDoubleNotSupported = -221,
  cv::Error::OpenCLInitError = -222,
  cv::Error::OpenCLNoAMDBlasFft = -223
}
 error codes More...
 
enum  cv::SortFlags {
  cv::SORT_EVERY_ROW = 0,
  cv::SORT_EVERY_COLUMN = 1,
  cv::SORT_ASCENDING = 0,
  cv::SORT_DESCENDING = 16
}
 

Functions

template<typename _Tp >
static _Tp * cv::alignPtr (_Tp *ptr, int n=(int) sizeof(_Tp))
 Aligns a pointer to the specified number of bytes. More...
 
static size_t cv::alignSize (size_t sz, int n)
 Aligns a buffer size to the specified number of bytes. More...
 
bool cv::checkHardwareSupport (int feature)
 Returns true if the specified feature is supported by the host hardware. More...
 
bool cv::Cholesky (float *A, size_t astep, int m, float *b, size_t bstep, int n)
 
bool cv::Cholesky (double *A, size_t astep, int m, double *b, size_t bstep, int n)
 
float cv::cubeRoot (float val)
 Computes the cube root of an argument. More...
 
template<typename _Tp >
_Tp cv::cv_abs (_Tp x)
 
int cv::cv_abs (uchar x)
 
int cv::cv_abs (schar x)
 
int cv::cv_abs (ushort x)
 
int cv::cv_abs (short x)
 
void cv::error (const Exception &exc)
 Signals an error and raises the exception. More...
 
void cv::error (int _code, const String &_err, const char *_func, const char *_file, int _line)
 Signals an error and raises the exception. More...
 
void cv::errorNoReturn (int _code, const String &_err, const char *_func, const char *_file, int _line)
 
float cv::fastAtan2 (float y, float x)
 Calculates the angle of a 2D vector in degrees. More...
 
void cv::fastFree (void *ptr)
 Deallocates a memory buffer. More...
 
void * cv::fastMalloc (size_t bufSize)
 Allocates an aligned memory buffer. More...
 
template<typename _Tp , typename Functor >
void cv::Mat::forEach_impl (const Functor &operation)
 
String cv::format (const char *fmt,...)
 Returns a text string formatted using the printf-like expression. More...
 
const String & cv::getBuildInformation ()
 Returns full configuration time cmake output. More...
 
int64 cv::getCPUTickCount ()
 Returns the number of CPU ticks. More...
 
static size_t cv::getElemSize (int type)
 
int cv::getNumberOfCPUs ()
 Returns the number of logical CPUs available for the process. More...
 
int cv::getNumThreads ()
 Returns the number of threads used by OpenCV for parallel regions. More...
 
int cv::getThreadNum ()
 Returns the index of the currently executed thread within the current parallel region. Always returns 0 if called outside of parallel region. More...
 
int64 cv::getTickCount ()
 Returns the number of ticks. More...
 
double cv::getTickFrequency ()
 Returns the number of ticks per second. More...
 
void cv::glob (String pattern, std::vector< String > &result, bool recursive=false)
 
int cv::LU (float *A, size_t astep, int m, float *b, size_t bstep, int n)
 
int cv::LU (double *A, size_t astep, int m, double *b, size_t bstep, int n)
 
template<typename _Tp , typename _AccTp >
static _AccTp cv::normInf (const _Tp *a, int n)
 
template<typename _Tp , typename _AccTp >
static _AccTp cv::normInf (const _Tp *a, const _Tp *b, int n)
 
template<typename _Tp , typename _AccTp >
static _AccTp cv::normL1 (const _Tp *a, int n)
 
template<typename _Tp , typename _AccTp >
static _AccTp cv::normL1 (const _Tp *a, const _Tp *b, int n)
 
float cv::normL1 (const float *a, const float *b, int n)
 
int cv::normL1 (const uchar *a, const uchar *b, int n)
 
template<typename _Tp , typename _AccTp >
static _AccTp cv::normL2Sqr (const _Tp *a, int n)
 
template<typename _Tp , typename _AccTp >
static _AccTp cv::normL2Sqr (const _Tp *a, const _Tp *b, int n)
 
static float cv::normL2Sqr (const float *a, const float *b, int n)
 
void cv::parallel_for_ (const Range &range, const ParallelLoopBody &body, double nstripes=-1.)
 Parallel data processor. More...
 
ErrorCallback cv::redirectError (ErrorCallback errCallback, void *userdata=0, void **prevUserdata=0)
 Sets the new error handler and the optional user data. More...
 
bool cv::setBreakOnError (bool flag)
 Sets/resets the break-on-error mode. More...
 
void cv::setNumThreads (int nthreads)
 OpenCV will try to set the number of threads for the next parallel region. More...
 
void cv::setUseOptimized (bool onoff)
 Enables or disables the optimized code. More...
 
String cv::tempfile (const char *suffix=0)
 
bool cv::useOptimized ()
 Returns the status of optimized code usage. More...
 

Detailed Description

Macro Definition Documentation

#define CV_Assert (   expr)    if(!!(expr)) ; else cv::error( cv::Error::StsAssert, #expr, CV_Func, __FILE__, __LINE__ )

Checks a condition at runtime and throws exception if it fails.

The macros CV_Assert (and CV_DbgAssert(expr)) evaluate the specified expression. If it is 0, the macros raise an error (see cv::error). The macro CV_Assert checks the condition in both Debug and Release configurations while CV_DbgAssert is only retained in the Debug configuration.

Examples:
grabcut.cpp.
#define CV_DbgAssert (   expr)

replaced with CV_Assert(expr) in Debug configuration

#define CV_Error (   code,
  msg 
)    cv::error( code, msg, CV_Func, __FILE__, __LINE__ )

Call the error handler.

Currently, the error handler prints the error code and the error message to the standard error stream stderr. In the Debug configuration, it then provokes memory access violation, so that the execution stack and all the parameters can be analyzed by the debugger. In the Release configuration, the exception is thrown.

Parameters
codeone of Error::Code
msgerror message
Examples:
grabcut.cpp, and pca.cpp.
#define CV_Error_ (   code,
  args 
)    cv::error( code, cv::format args, CV_Func, __FILE__, __LINE__ )

Call the error handler.

This macro can be used to construct an error message on-fly to include some dynamic information, for example:

1 // note the extra parentheses around the formatted text message
2 CV_Error_( CV_StsOutOfRange,
3 ("the value at (%d, %d)=%g is out of range", badPt.x, badPt.y, badValue));
Parameters
codeone of Error::Code
argsprintf-like formatted error message in parentheses
#define CV_ErrorNoReturn (   code,
  msg 
)    cv::errorNoReturn( code, msg, CV_Func, __FILE__, __LINE__ )

same as CV_Error(code,msg), but does not return

#define CV_ErrorNoReturn_ (   code,
  args 
)    cv::errorNoReturn( code, cv::format args, CV_Func, __FILE__, __LINE__ )

same as CV_Error_(code,args), but does not return

#define CV_Func   ""

Typedef Documentation

typedef int(* cv::ErrorCallback) (int status, const char *func_name, const char *err_msg, const char *file_name, int line, void *userdata)
typedef Hamming cv::HammingLUT

Enumeration Type Documentation

anonymous enum
Enumerator
normType 

error codes

Enumerator
StsOk 

everithing is ok

StsBackTrace 

pseudo error for back trace

StsError 

unknown /unspecified error

StsInternal 

internal error (bad state)

StsNoMem 

insufficient memory

StsBadArg 

function arg/param is bad

StsBadFunc 

unsupported function

StsNoConv 

iter. didn't converge

StsAutoTrace 

tracing

HeaderIsNull 

image header is NULL

BadImageSize 

image size is invalid

BadOffset 

offset is invalid

BadDataPtr 
BadStep 
BadModelOrChSeq 
BadNumChannels 
BadNumChannel1U 
BadDepth 
BadAlphaChannel 
BadOrder 
BadOrigin 
BadAlign 
BadCallBack 
BadTileSize 
BadCOI 
BadROISize 
MaskIsTiled 
StsNullPtr 

null pointer

StsVecLengthErr 

incorrect vector length

StsFilterStructContentErr 

incorr. filter structure content

StsKernelStructContentErr 

incorr. transform kernel content

StsFilterOffsetErr 

incorrect filter ofset value

StsBadSize 

the input/output structure size is incorrect

StsDivByZero 

division by zero

StsInplaceNotSupported 

in-place operation is not supported

StsObjectNotFound 

request can't be completed

StsUnmatchedFormats 

formats of input/output arrays differ

StsBadFlag 

flag is wrong or not supported

StsBadPoint 

bad CvPoint

StsBadMask 

bad format of mask (neither 8uC1 nor 8sC1)

StsUnmatchedSizes 

sizes of input/output structures do not match

StsUnsupportedFormat 

the data format/type is not supported by the function

StsOutOfRange 

some of parameters are out of range

StsParseError 

invalid syntax/structure of the parsed file

StsNotImplemented 

the requested function/feature is not implemented

StsBadMemBlock 

an allocated block has been corrupted

StsAssert 

assertion failed

GpuNotSupported 
GpuApiCallError 
OpenGlNotSupported 
OpenGlApiCallError 
OpenCLApiCallError 
OpenCLDoubleNotSupported 
OpenCLInitError 
OpenCLNoAMDBlasFft 
Enumerator
SORT_EVERY_ROW 

each matrix row is sorted independently

SORT_EVERY_COLUMN 

each matrix column is sorted independently; this flag and the previous one are mutually exclusive.

SORT_ASCENDING 

each matrix row is sorted in the ascending order.

SORT_DESCENDING 

each matrix row is sorted in the descending order; this flag and the previous one are also mutually exclusive.

Function Documentation

template<typename _Tp >
static _Tp* cv::alignPtr ( _Tp *  ptr,
int  n = (int)sizeof(_Tp) 
)
inlinestatic

Aligns a pointer to the specified number of bytes.

The function returns the aligned pointer of the same type as the input pointer:

\[\texttt{(_Tp*)(((size_t)ptr + n-1) & -n)}\]

Parameters
ptrAligned pointer.
nAlignment size that must be a power of two.
static size_t cv::alignSize ( size_t  sz,
int  n 
)
inlinestatic

Aligns a buffer size to the specified number of bytes.

The function returns the minimum number that is greater or equal to sz and is divisible by n :

\[\texttt{(sz + n-1) & -n}\]

Parameters
szBuffer size to align.
nAlignment size that must be a power of two.
bool cv::checkHardwareSupport ( int  feature)

Returns true if the specified feature is supported by the host hardware.

The function returns true if the host hardware supports the specified feature. When user calls setUseOptimized(false), the subsequent calls to checkHardwareSupport() will return false until setUseOptimized(true) is called. This way user can dynamically switch on and off the optimized code in OpenCV.

Parameters
featureThe feature of interest, one of cv::CpuFeatures
bool cv::Cholesky ( float *  A,
size_t  astep,
int  m,
float *  b,
size_t  bstep,
int  n 
)

proxy for hal::Cholesky

bool cv::Cholesky ( double *  A,
size_t  astep,
int  m,
double *  b,
size_t  bstep,
int  n 
)

proxy for hal::Cholesky

float cv::cubeRoot ( float  val)

Computes the cube root of an argument.

The function cubeRoot computes \(\sqrt[3]{\texttt{val}}\). Negative arguments are handled correctly. NaN and Inf are not handled. The accuracy approaches the maximum possible accuracy for single-precision data.

Parameters
valA function argument.
template<typename _Tp >
_Tp cv::cv_abs ( _Tp  x)
inline
int cv::cv_abs ( uchar  x)
inline
int cv::cv_abs ( schar  x)
inline
int cv::cv_abs ( ushort  x)
inline
int cv::cv_abs ( short  x)
inline
void cv::error ( const Exception exc)

Signals an error and raises the exception.

By default the function prints information about the error to stderr, then it either stops if cv::setBreakOnError() had been called before or raises the exception. It is possible to alternate error processing by using cv::redirectError().

Parameters
excthe exception raisen.
Deprecated:
drop this version
void cv::error ( int  _code,
const String _err,
const char *  _func,
const char *  _file,
int  _line 
)

Signals an error and raises the exception.

By default the function prints information about the error to stderr, then it either stops if setBreakOnError() had been called before or raises the exception. It is possible to alternate error processing by using redirectError().

Parameters
_code- error code (Error::Code)
_err- error description
_func- function name. Available only when the compiler supports getting it
_file- source file name where the error has occured
_line- line number in the source file where the error has occured
See also
CV_Error, CV_Error_, CV_ErrorNoReturn, CV_ErrorNoReturn_, CV_Assert, CV_DbgAssert
void cv::errorNoReturn ( int  _code,
const String _err,
const char *  _func,
const char *  _file,
int  _line 
)

same as cv::error, but does not return

float cv::fastAtan2 ( float  y,
float  x 
)

Calculates the angle of a 2D vector in degrees.

The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured in degrees and varies from 0 to 360 degrees. The accuracy is about 0.3 degrees.

Parameters
xx-coordinate of the vector.
yy-coordinate of the vector.
void cv::fastFree ( void *  ptr)

Deallocates a memory buffer.

The function deallocates the buffer allocated with fastMalloc . If NULL pointer is passed, the function does nothing. C version of the function clears the pointer pptr to avoid problems with double memory deallocation.

Parameters
ptrPointer to the allocated buffer.
void* cv::fastMalloc ( size_t  bufSize)

Allocates an aligned memory buffer.

The function allocates the buffer of the specified size and returns it. When the buffer size is 16 bytes or more, the returned buffer is aligned to 16 bytes.

Parameters
bufSizeAllocated buffer size.
template<typename _Tp , typename Functor >
void cv::Mat::forEach_impl ( const Functor &  operation)
inlineprotected

idx is modified in this->rowCall

String cv::format ( const char *  fmt,
  ... 
)

Returns a text string formatted using the printf-like expression.

The function acts like sprintf but forms and returns an STL string. It can be used to form an error message in the Exception constructor.

Parameters
fmtprintf-compatible formatting specifiers.
Examples:
cout_mat.cpp.
const String& cv::getBuildInformation ( )

Returns full configuration time cmake output.

Returned value is raw cmake output including version control system revision, compiler version, compiler flags, enabled modules and third party libraries, etc. Output format depends on target architecture.

int64 cv::getCPUTickCount ( )

Returns the number of CPU ticks.

The function returns the current number of CPU ticks on some architectures (such as x86, x64, PowerPC). On other platforms the function is equivalent to getTickCount. It can also be used for very accurate time measurements, as well as for RNG initialization. Note that in case of multi-CPU systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU with its own counter. So, theoretically (and practically) the subsequent calls to the function do not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU frequency depending on the load, the number of CPU clocks spent in some code cannot be directly converted to time units. Therefore, getTickCount is generally a preferable solution for measuring execution time.

static size_t cv::getElemSize ( int  type)
inlinestatic
int cv::getNumberOfCPUs ( )

Returns the number of logical CPUs available for the process.

int cv::getNumThreads ( )

Returns the number of threads used by OpenCV for parallel regions.

Always returns 1 if OpenCV is built without threading support.

The exact meaning of return value depends on the threading framework used by OpenCV library:

  • TBB – The number of threads, that OpenCV will try to use for parallel regions. If there is any tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns default number of threads used by TBB library.
  • OpenMP – An upper bound on the number of threads that could be used to form a new team.
  • Concurrency – The number of threads, that OpenCV will try to use for parallel regions.
  • GCD – Unsupported; returns the GCD thread pool limit (512) for compatibility.
  • C= – The number of threads, that OpenCV will try to use for parallel regions, if before called setNumThreads with threads > 0, otherwise returns the number of logical CPUs, available for the process.
    See also
    setNumThreads, getThreadNum
int cv::getThreadNum ( )

Returns the index of the currently executed thread within the current parallel region. Always returns 0 if called outside of parallel region.

The exact meaning of return value depends on the threading framework used by OpenCV library:

  • TBB – Unsupported with current 4.1 TBB release. May be will be supported in future.
  • OpenMP – The thread number, within the current team, of the calling thread.
  • Concurrency – An ID for the virtual processor that the current context is executing on (0 for master thread and unique number for others, but not necessary 1,2,3,...).
  • GCD – System calling thread's ID. Never returns 0 inside parallel region.
  • C= – The index of the current parallel task.
    See also
    setNumThreads, getNumThreads
int64 cv::getTickCount ( )

Returns the number of ticks.

The function returns the number of ticks after the certain event (for example, when the machine was turned on). It can be used to initialize RNG or to measure a function execution time by reading the tick count before and after the function call. See also the tick frequency.

Examples:
houghlines.cpp, lsd_lines.cpp, and watershed.cpp.
double cv::getTickFrequency ( )

Returns the number of ticks per second.

The function returns the number of ticks per second. That is, the following code computes the execution time in seconds:

double t = (double)getTickCount();
// do something ...
t = ((double)getTickCount() - t)/getTickFrequency();
Examples:
houghlines.cpp, lsd_lines.cpp, and watershed.cpp.
void cv::glob ( String  pattern,
std::vector< String > &  result,
bool  recursive = false 
)
int cv::LU ( float *  A,
size_t  astep,
int  m,
float *  b,
size_t  bstep,
int  n 
)

proxy for hal::LU

int cv::LU ( double *  A,
size_t  astep,
int  m,
double *  b,
size_t  bstep,
int  n 
)

proxy for hal::LU

template<typename _Tp , typename _AccTp >
static _AccTp cv::normInf ( const _Tp *  a,
int  n 
)
inlinestatic
template<typename _Tp , typename _AccTp >
static _AccTp cv::normInf ( const _Tp *  a,
const _Tp *  b,
int  n 
)
inlinestatic
template<typename _Tp , typename _AccTp >
static _AccTp cv::normL1 ( const _Tp *  a,
int  n 
)
inlinestatic
template<typename _Tp , typename _AccTp >
static _AccTp cv::normL1 ( const _Tp *  a,
const _Tp *  b,
int  n 
)
inlinestatic
float cv::normL1 ( const float *  a,
const float *  b,
int  n 
)
inline
int cv::normL1 ( const uchar a,
const uchar b,
int  n 
)
inline
template<typename _Tp , typename _AccTp >
static _AccTp cv::normL2Sqr ( const _Tp *  a,
int  n 
)
inlinestatic
template<typename _Tp , typename _AccTp >
static _AccTp cv::normL2Sqr ( const _Tp *  a,
const _Tp *  b,
int  n 
)
inlinestatic
static float cv::normL2Sqr ( const float *  a,
const float *  b,
int  n 
)
inlinestatic
void cv::parallel_for_ ( const Range range,
const ParallelLoopBody body,
double  nstripes = -1. 
)

Parallel data processor.

ErrorCallback cv::redirectError ( ErrorCallback  errCallback,
void *  userdata = 0,
void **  prevUserdata = 0 
)

Sets the new error handler and the optional user data.

The function sets the new error handler, called from cv::error().

Parameters
errCallbackthe new error handler. If NULL, the default error handler is used.
userdatathe optional user data pointer, passed to the callback.
prevUserdatathe optional output parameter where the previous user data pointer is stored
Returns
the previous error handler
bool cv::setBreakOnError ( bool  flag)

Sets/resets the break-on-error mode.

When the break-on-error mode is set, the default error handler issues a hardware exception, which can make debugging more convenient.

Returns
the previous state
void cv::setNumThreads ( int  nthreads)

OpenCV will try to set the number of threads for the next parallel region.

If threads == 0, OpenCV will disable threading optimizations and run all it's functions sequentially. Passing threads < 0 will reset threads number to system default. This function must be called outside of parallel region.

OpenCV will try to run it's functions with specified threads number, but some behaviour differs from framework:

  • TBB – User-defined parallel constructions will run with the same threads number, if another does not specified. If late on user creates own scheduler, OpenCV will be use it.
  • OpenMP – No special defined behaviour.
  • Concurrency – If threads == 1, OpenCV will disable threading optimizations and run it's functions sequentially.
  • GCD – Supports only values <= 0.
  • C= – No special defined behaviour.
    Parameters
    nthreadsNumber of threads used by OpenCV.
    See also
    getNumThreads, getThreadNum
void cv::setUseOptimized ( bool  onoff)

Enables or disables the optimized code.

The function can be used to dynamically turn on and off optimized code (code that uses SSE2, AVX, and other instructions on the platforms that support it). It sets a global flag that is further checked by OpenCV functions. Since the flag is not checked in the inner OpenCV loops, it is only safe to call the function on the very top level in your application where you can be sure that no other OpenCV function is currently executed.

By default, the optimized code is enabled unless you disable it in CMake. The current status can be retrieved using useOptimized.

Parameters
onoffThe boolean flag specifying whether the optimized code should be used (onoff=true) or not (onoff=false).
String cv::tempfile ( const char *  suffix = 0)
bool cv::useOptimized ( )

Returns the status of optimized code usage.

The function returns true if the optimized code is enabled. Otherwise, it returns false.