?? cxcore.h
字號:
//////////////////////////////////////////////////////////////////////////////////////////// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.//// By downloading, copying, installing or using the software you agree to this license.// If you do not agree to this license, do not download, install,// copy or use the software.////// License For Embedded Computer Vision Library//// Copyright (c) 2008, EMCV Project,// Copyright (c) 2000-2007, Intel Corporation,// All rights reserved.// Third party copyrights are property of their respective owners.//// Redistribution and use in source and binary forms, with or without modification, // are permitted provided that the following conditions are met://// * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer.// * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution.// * Neither the name of the copyright holders nor the names of their contributors // may be used to endorse or promote products derived from this software // without specific prior written permission.//// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY // OF SUCH DAMAGE.//// Contributors:// * Shiqi Yu (Shenzhen Institute of Advanced Technology, Chinese Academy of Sciences)#ifndef _CXCORE_H_#define _CXCORE_H_#include "cxtypes.h"#include "cxmisc.h"#include "cxerror.h"#define icvIplToCvDepth( depth ) \ icvDepthToType[(((depth) & 255) >> 2) + ((depth) < 0)]const int CV_DEPTH_BYTES[8]={1, 1, 2, 2, 4, 4, 8, 0};#ifdef __cplusplusextern "C" {#endifCVAPI(int) cvSaveImage( const char* filename, const IplImage * image );CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor CV_DEFAULT(0));// save as Embedded file#ifdef DM64X_NETWORKCVAPI(int) efs_cvSaveImage( const char* filename, const IplImage * image );#endif/****************************************************************************************\* Array allocation, deallocation, initialization and access to elements *\****************************************************************************************//* <malloc> wrapper. If there is no enough memory, the function (as well as other OpenCV functions that call cvAlloc) raises an error. */CVAPI(void*) cvAlloc( size_t size );/* <free> wrapper. Here and further all the memory releasing functions (that all call cvFree) take double pointer in order to to clear pointer to the data after releasing it. Passing pointer to NULL pointer is Ok: nothing happens in this case*/CVAPI(void) cvFree_( void* ptr );#define cvFree(ptr) (cvFree_(*(ptr)), *(ptr)=0)/* Allocates and initializes IplImage header */CVAPI(IplImage*) cvCreateImageHeader( CvSize size, int depth, int channels );/* Inializes IplImage header */CVAPI(IplImage*) cvInitImageHeader( IplImage* image, CvSize size, int depth, int channels, int origin CV_DEFAULT(0), int align CV_DEFAULT(4));/* Creates IPL image (header and data) */CVAPI(IplImage*) cvCreateImage( CvSize size, int depth, int channels );/* Releases (i.e. deallocates) IPL image header */CVAPI(void) cvReleaseImageHeader( IplImage** image );/* Releases IPL image header and data */CVAPI(void) cvReleaseImage( IplImage** image );/* Creates a copy of IPL image (widthStep may differ) */CVAPI(IplImage*) cvCloneImage( const IplImage* image );/* Sets a Channel Of Interest (only a few functions support COI) - use cvCopy to extract the selected channel and/or put it back */CVAPI(void) cvSetImageCOI( IplImage* image, int coi );/* Retrieves image Channel Of Interest */CVAPI(int) cvGetImageCOI( const IplImage* image );/* Sets image ROI (region of interest) (COI is not changed) */CVAPI(void) cvSetImageROI( IplImage* image, CvRect rect );/* Resets image ROI and COI */CVAPI(void) cvResetImageROI( IplImage* image );/* Retrieves image ROI */CVAPI(CvRect) cvGetImageROI( const IplImage* image );/* Allocates and initalizes CvMat header */CVAPI(CvMat*) cvCreateMatHeader( int rows, int cols, int type );#define CV_AUTOSTEP 0x7fffffff/* Initializes CvMat header */CVAPI(CvMat*) cvInitMatHeader( CvMat* mat, int rows, int cols, int type, void* data CV_DEFAULT(NULL), int step CV_DEFAULT(CV_AUTOSTEP) );/* Allocates and initializes CvMat header and allocates data */CVAPI(CvMat*) cvCreateMat( int rows, int cols, int type );/* Releases CvMat header and deallocates matrix data (reference counting is used for data) */CVAPI(void) cvReleaseMat( CvMat** mat );/* Decrements CvMat data reference counter and deallocates the data if it reaches 0 */CV_INLINE void cvDecRefData( CvArr* arr ){ if( CV_IS_MAT( arr )) { CvMat* mat = (CvMat*)arr; mat->data.ptr = NULL; if( mat->refcount != NULL && --*mat->refcount == 0 ) cvFree( &mat->refcount ); mat->refcount = NULL; } else if( CV_IS_MATND( arr )) { CvMatND* mat = (CvMatND*)arr; mat->data.ptr = NULL; if( mat->refcount != NULL && --*mat->refcount == 0 ) cvFree( &mat->refcount ); mat->refcount = NULL; }}/* Increments CvMat data reference counter */CV_INLINE int cvIncRefData( CvArr* arr ){ int refcount = 0; if( CV_IS_MAT( arr )) { CvMat* mat = (CvMat*)arr; if( mat->refcount != NULL ) refcount = ++*mat->refcount; } else if( CV_IS_MATND( arr )) { CvMatND* mat = (CvMatND*)arr; if( mat->refcount != NULL ) refcount = ++*mat->refcount; } return refcount;}/* Creates an exact copy of the input matrix (except, may be, step value) */CVAPI(CvMat*) cvCloneMat( const CvMat* mat );/* Makes a new matrix from <rect> subrectangle of input array. No data is copied */CVAPI(CvMat*) cvGetSubRect( const CvArr* arr, CvMat* submat, CvRect rect );#define cvGetSubArr cvGetSubRect/* Selects row span of the input array: arr(start_row:delta_row:end_row,:) (end_row is not included into the span). */CVAPI(CvMat*) cvGetRows( const CvArr* arr, CvMat* submat, int start_row, int end_row, int delta_row CV_DEFAULT(1));CV_INLINE CvMat* cvGetRow( const CvArr* arr, CvMat* submat, int row ){ return cvGetRows( arr, submat, row, row + 1, 1 );}/* Selects column span of the input array: arr(:,start_col:end_col) (end_col is not included into the span) */CVAPI(CvMat*) cvGetCols( const CvArr* arr, CvMat* submat, int start_col, int end_col );CV_INLINE CvMat* cvGetCol( const CvArr* arr, CvMat* submat, int col ){ return cvGetCols( arr, submat, col, col + 1 );}/* Select a diagonal of the input array. (diag = 0 means the main diagonal, >0 means a diagonal above the main one, <0 - below the main one). The diagonal will be represented as a column (nx1 matrix). */CVAPI(CvMat*) cvGetDiag( const CvArr* arr, CvMat* submat, int diag CV_DEFAULT(0));/* low-level scalar <-> raw data conversion functions */CVAPI(void) cvScalarToRawData( const CvScalar* scalar, void* data, int type, int extend_to_12 CV_DEFAULT(0) );CVAPI(void) cvRawDataToScalar( const void* data, int type, CvScalar* scalar );/* Allocates and initializes CvMatND header */CVAPI(CvMatND*) cvCreateMatNDHeader( int dims, const int* sizes, int type );/* Allocates and initializes CvMatND header and allocates data */CVAPI(CvMatND*) cvCreateMatND( int dims, const int* sizes, int type );/* Initializes preallocated CvMatND header */CVAPI(CvMatND*) cvInitMatNDHeader( CvMatND* mat, int dims, const int* sizes, int type, void* data CV_DEFAULT(NULL) );/* Releases CvMatND */CV_INLINE void cvReleaseMatND( CvMatND** mat ){ cvReleaseMat( (CvMat**)mat );}/* Creates a copy of CvMatND (except, may be, steps) */CVAPI(CvMatND*) cvCloneMatND( const CvMatND* mat );/* Allocates and initializes CvSparseMat header and allocates data */CVAPI(CvSparseMat*) cvCreateSparseMat( int dims, const int* sizes, int type );/* Releases CvSparseMat */CVAPI(void) cvReleaseSparseMat( CvSparseMat** mat );/* Creates a copy of CvSparseMat (except, may be, zero items) */CVAPI(CvSparseMat*) cvCloneSparseMat( const CvSparseMat* mat );/* Initializes sparse array iterator (returns the first node or NULL if the array is empty) */CVAPI(CvSparseNode*) cvInitSparseMatIterator( const CvSparseMat* mat, CvSparseMatIterator* mat_iterator );// returns next sparse array node (or NULL if there is no more nodes)CV_INLINE CvSparseNode* cvGetNextSparseNode( CvSparseMatIterator* mat_iterator ){ if( mat_iterator->node->next ) return mat_iterator->node = mat_iterator->node->next; else { int idx; for( idx = ++mat_iterator->curidx; idx < mat_iterator->mat->hashsize; idx++ ) { CvSparseNode* node = (CvSparseNode*)mat_iterator->mat->hashtable[idx]; if( node ) { mat_iterator->curidx = idx; return mat_iterator->node = node; } } return NULL; }}/**************** matrix iterator: used for n-ary operations on dense arrays *********/#define CV_MAX_ARR 10typedef struct CvNArrayIterator{ int count; /* number of arrays */ int dims; /* number of dimensions to iterate */ CvSize size; /* maximal common linear size: { width = size, height = 1 } */ uchar* ptr[CV_MAX_ARR]; /* pointers to the array slices */ int stack[CV_MAX_DIM]; /* for internal use */ CvMatND* hdr[CV_MAX_ARR]; /* pointers to the headers of the matrices that are processed */}CvNArrayIterator;#define CV_NO_DEPTH_CHECK 1#define CV_NO_CN_CHECK 2#define CV_NO_SIZE_CHECK 4/* initializes iterator that traverses through several arrays simulteneously (the function together with cvNextArraySlice is used for N-ari element-wise operations) */CVAPI(int) cvInitNArrayIterator( int count, CvArr** arrs, const CvArr* mask, CvMatND* stubs, CvNArrayIterator* array_iterator, int flags CV_DEFAULT(0) );/* returns zero value if iteration is finished, non-zero (slice length) otherwise */CVAPI(int) cvNextNArraySlice( CvNArrayIterator* array_iterator );
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -