由于openCV2.2.0源文件很庞大,这里我只分析openCV2.2.0文件组织结构的各个模块的include文件(重点分析各个模块下引用的算法和实现的功能),而不是src文件。这里分析各个模块有助于更好的从整体把握和理解openCV2.2.0。这里只是自己做草稿部分,便于以后修改查找。有理解不对的,希望大家指出。--疯子_007
首先分析的是highgui目录下的highgui_c.h和highgui.cpp文件:
highgui_c.h分三部分:基本的GUI函数库,视频接口,和过时的函数库。基本的GUI函数库包括:创建窗体,设置窗体属性,获取窗体属性,在窗体内显示图片,改变窗体大小,移动窗体,销毁窗体(包括销毁所有窗体);获取给定句柄的窗体名,创建和显示滚动条,恢复和设置滚动条位置;鼠标回调事件,设置鼠标事件回调,枚举鼠标类型;载入图片,保存图片,改变图片结构;按键等待。视频接口包括:定义摄像头结构,通过视频文件获取帧,从摄像头获取视频文件,帧处理的特殊函数(cvRetrieveFrame),抓取帧,释放视频文件;恢复或者设置摄像头属性,返回摄像头类型;定义写视频指针结构体,四色编码,打开编码属性对话框,初始化写视频指针,将帧流写入写视频指针,释放写视频指针。过时的函数库。将一些功能相同的函数,重新命名,保持旧代码的连接性。
highgui.cpp在CV命名空间枚举相应的一些函数和定义了VideoCapture,VideoWriter类,采用面向对象的思想进行编程,更容易理解和整体把握。
详细分析如下: . /highgui/include/opencv2/highgui/highgui_c.h
基本GUI函数:
支持QT模块一些函数(省略)
创建窗体:CVAPI(int) cvNamedWindow( const char* name, int flagsCV_DEFAULT(CV_WINDOW_AUTOSIZE) );
设置窗体属性:CVAPI(void) cvSetWindowProperty(const char* name, intprop_id, double prop_value);
获取窗体属性:cvGetWindowProperty(const char* name, int prop_id);
在窗体内显示图片:CVAPI(void) cvShowImage( const char* name, const CvArr*image );
改变窗体大小:CVAPI(void) cvResizeWindow( const char* name, int width,int height );
移动窗体大小:CVAPI(void) cvMoveWindow( const char* name, int x, int y);
销毁窗体(包括连接窗体的滚动条):CVAPI(void) cvDestroyWindow( const char* name);
销毁所有窗体:CVAPI(void) cvDestroyAllWindows(void);
获取该窗体句柄(命令行形式获取HWWD,图形窗口形式获取widget):CVAPI(void*)cvGetWindowHandle( const char* name );
获取给定句柄的窗体名:CVAPI(const char*) cvGetWindowName( void*window_handle );
位置回调定义1: typedef void (CV_CDECL *CvTrackbarCallback)(intpos);
在给定的窗体创建和显示滚动条1: CVAPI(int) cvCreateTrackbar( const char*trackbar_name, const char* window_name, int* value, int count,CvTrackbarCallback on_change CV_DEFAULT(NULL));
位置回调定义2: typedef void (CV_CDECL *CvTrackbarCallback2)(int pos,void* userdata);
在给定的窗体创建和显示滚动条2: CVAPI(int) cvCreateTrackbar2( const char*trackbar_name, const char* window_name,int* value, int count,CvTrackbarCallback2 on_change, void* userdata CV_DEFAULT(0));
恢复或者设置滚动条位置:CVAPI(int) cvGetTrackbarPos( const char*trackbar_name, const char* window_name ); CVAPI(void)cvSetTrackbarPos( const char* trackbar_name, const char*window_name, int pos );
枚举鼠标事件
enum
{
};
enum
{
CV_EVENT_FLAG_LBUTTON =1,
CV_EVENT_FLAG_RBUTTON =2,
CV_EVENT_FLAG_MBUTTON =4,
CV_EVENT_FLAG_CTRLKEY =8,
CV_EVENT_FLAG_SHIFTKEY =16,
CV_EVENT_FLAG_ALTKEY =32
};
鼠标回调事件定义 typedef void (CV_CDECL *CvMouseCallback )(int event,int x, int y, int flags, void* param);
设置鼠标事件回调:CVAPI(void) cvSetMouseCallback( const char*window_name, CvMouseCallback on_mouse, void* paramCV_DEFAULT(NULL));
{
CV_LOAD_IMAGE_UNCHANGED =-1,
CV_LOAD_IMAGE_GRAYSCALE =0,
CV_LOAD_IMAGE_COLOR =1,
CV_LOAD_IMAGE_ANYDEPTH =2,
CV_LOAD_IMAGE_ANYCOLOR =4
};
从文件中调入图片(iscolor 默认参数是CV_LOAD_IMAGE_UNCHANGED):
CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolorCV_DEFAULT(CV_LOAD_IMAGE_COLOR)); CVAPI(CvMat*) cvLoadImageM( constchar* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR)); enum{ CV_IMWRITE_JPEG_QUALITY =1, CV_IMWRITE_PNG_COMPRESSION =16,CV_IMWRITE_PXM_BINARY =32 };
保存图片: CVAPI(int) cvSaveImage( const char* filename, const CvArr*image,const int* params CV_DEFAULT(0) );
对存储在缓冲中的图进行解码:
CVAPI(IplImage*) cvDecodeImage( const CvMat* buf, int iscolorCV_DEFAULT(CV_LOAD_IMAGE_COLOR)); CVAPI(CvMat*) cvDecodeImageM(const CvMat* buf, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
对图像进行编码,并将结果保存到单通道的8UC1矩阵中:CVAPI(CvMat*) cvEncodeImage( constchar* ext, const CvArr* image, const int* params CV_DEFAULT(0) );enum { CV_CVTIMG_FLIP =1, CV_CVTIMG_SWAP_RB =2 };
改变图像结构:CVAPI(void) cvConvertImage( const CvArr* src, CvArr* dst,int flags CV_DEFAULT(0));
按键等待:CVAPI(int) cvWaitKey(int delay CV_DEFAULT(0));
视频文件和摄像头接口
定义摄像头结构体:typedef struct CvCapture CvCapture;
通过视频文件获取帧:
CVAPI(CvCapture*) cvCreateFileCapture( const char* filename);
enum
CV_CAP_ANY =0, // autodetect
CV_CAP_MIL =100, // MIL proprietarydrivers
CV_CAP_VFW =200, // platformnative
CV_CAP_V4L =200,
CV_CAP_V4L2 =200,
CV_CAP_FIREWARE =300, // IEEE 1394drivers
CV_CAP_FIREWIRE =300,
CV_CAP_IEEE1394 =300,
CV_CAP_DC1394 =300,
CV_CAP_CMU1394 =300,
CV_CAP_STEREO =400, // TYZXproprietary drivers
CV_CAP_TYZX =400,
CV_TYZX_LEFT =400,
CV_TYZX_RIGHT =401,
CV_TYZX_COLOR =402,
CV_TYZX_Z =403,
CV_CAP_QT =500, // QuickTime
CV_CAP_UNICAP =600, // Unicapdrivers
CV_CAP_DSHOW =700, // DirectShow (viavideoInput)
CV_CAP_PVAPI =800 // PvAPI, ProsilicaGigE SDK
从摄像头获取视频文件:(index为camera_index + domain_offset(CV_CAP_*))CVAPI(CvCapture*) cvCreateCameraCapture( int index );
抓取帧,成功返回1,否则为0:CVAPI(int) cvGrabFrame( CvCapture* capture );
得到cvGrabFrame获取的帧,此函数应用在一些帧处理,比如帧减压,旋转:(千万不要释放或者修改返回帧)CVAPI(IplImage*)cvRetrieveFrame( CvCapture* capture, int streamIdx CV_DEFAULT(0));
连接cvGrabFrame和cvRetrieveFrame函数:(千万不要释放或者修改返回帧) CVAPI(IplImage*)cvQueryFrame( CvCapture* capture );
释放获取或者读取的视频文件,释放资源:CVAPI(void) cvReleaseCapture( CvCapture**capture );
enum
{
CV_CAP_PROP_POS_MSEC =0,
CV_CAP_PROP_POS_FRAMES =1,
CV_CAP_PROP_POS_AVI_RATIO =2,
CV_CAP_PROP_FRAME_WIDTH =3,
CV_CAP_PROP_FRAME_HEIGHT =4,
CV_CAP_PROP_FPS =5,
CV_CAP_PROP_FOURCC =6,
CV_CAP_PROP_FRAME_COUNT =7,
CV_CAP_PROP_FORMAT =8,
CV_CAP_PROP_MODE =9,
CV_CAP_PROP_BRIGHTNESS =10,
CV_CAP_PROP_CONTRAST =11,
CV_CAP_PROP_SATURATION =12,
CV_CAP_PROP_HUE =13,
CV_CAP_PROP_GAIN =14,
CV_CAP_PROP_EXPOSURE =15,
CV_CAP_PROP_CONVERT_RGB =16,
CV_CAP_PROP_WHITE_BALANCE =17,
CV_CAP_PROP_RECTIFICATION =18,
恢复或者设置摄像头属性:CVAPI(double) cvGetCaptureProperty( CvCapture*capture, int property_id ); CVAPI(int) cvSetCaptureProperty(CvCapture* capture, int property_id, double value );
返回摄像头类型:CVAPI(int) cvGetCaptureDomain( CvCapture* capture);
定义写视频指针结构体:typedef struct CvVideoWriter CvVideoWriter;
对四色进行编码:CV_INLINE int CV_FOURCC(char c1, char c2, char c3, charc4) { return (c1 & 255) + ((c2 &255) << 8) + ((c3&255) << 16) + ((c4& 255) << 24); }
打开编码选项对话框(windows下) #define CV_FOURCC_PROMPT -1
默认编码方式(linux下) #define CV_FOURCC_DEFAULT CV_FOURCC('I', 'Y','U', 'V')
初始化写视频指针:CVAPI(CvVideoWriter*) cvCreateVideoWriter( const char*filename, int fourcc,double fps, CvSize frame_size, int is_colorCV_DEFAULT(1));
将帧写到视频指针中:CVAPI(int) cvWriteFrame( CvVideoWriter* writer, constIplImage* image );
释放写视频指针:CVAPI(void) cvReleaseVideoWriter( CvVideoWriter** writer);
过时的函数或同意不同名的函数
#define cvCaptureFromCAM cvCreateCameraCapture//从摄像头读取视频
#define cvCaptureFromAVI cvCaptureFromFile//
#define cvCreateAVIWriter cvCreateVideoWriter//创建写视频指针
#define cvWriteToAVI cvWriteFrame//写入写视频指针
#define cvAddSearchPath(path)//增加路径
#define cvvInitSystem cvInitSystem//
#define cvvNamedWindow cvNamedWindow//创建窗体
#define cvvShowImage cvShowImage//在窗体内显示图片
#define cvvResizeWindow cvResizeWindow//设置窗体大小
#define cvvDestroyWindow cvDestroyWindow//销毁窗体
#define cvvCreateTrackbar cvCreateTrackbar//创建滚动条
#define cvvLoadImage(name) cvLoadImage((name),1)//载入图片
#define cvvSaveImage cvSaveImage//保存图片
#define cvvAddSearchPath cvAddSearchPath//增加路径
#define cvvWaitKey(name) cvWaitKey(0)//按键等待
#define cvvWaitKeyEx(name,delay) cvWaitKey(delay)//按键等待
#define cvvConvertImage cvConvertImage//图片结构改变
#define HG_AUTOSIZE CV_WINDOW_AUTOSIZE//
#define set_preprocess_func cvSetPreprocessFuncWin32
#define set_postprocess_func cvSetPostprocessFuncWin3
/highgui/include/opencv2/highgui/highgui.hpp 此C++头文件,引入: structCvCapture; struct CvVideoWriter;在CV命名空间枚举相应的一些函数和定义了VideoCapture,VideoWriter类,采用面向对象的思想进行编程,更容易理解和整体把握。
详细的代码如下:
namespace cv
{
enum { WINDOW_AUTOSIZE=1 };
CV_EXPORTS_W void namedWindow( const string&winname, int flags CV_DEFAULT(WINDOW_AUTOSIZE) ); CV_EXPORTS_W voiddestroyWindow( const string& winname );CV_EXPORTS_W int startWindowThread(); CV_EXPORTS_W voidsetWindowProperty(const string& winname, intprop_id, double prop_value);//YV CV_EXPORTS_W doublegetWindowProperty(const string& winname, intprop_id);//YV //Only for Qt
//------------------------ CV_EXPORTS
CvFont fontQt(const string& nameFont, intpointSize CV_DEFAULT(-1), Scalar color CV_DEFAULT(Scalar::all(0)),int weight CV_DEFAULT(CV_FONT_NORMAL), int styleCV_DEFAULT(CV_STYLE_NORMAL), int spacing CV_DEFAULT(0));
CV_EXPORTS void addText( const Mat& img, conststring& text, Point org, CvFont font);
CV_EXPORTS void displayOverlay(const string&winname, const string& text, int delayms);
CV_EXPORTS void displayStatusBar(const string&winname, const string& text, int delayms);
typedef void (CV_CDECL *OpenGLCallback)(void* userdata);
CV_EXPORTS void createOpenGLCallback(conststring& winname, CvOpenGLCallback callbackOpenGL,void* userdata CV_DEFAULT(0));
CV_EXPORTS void saveWindowParameters(conststring& windowName);
CV_EXPORTS void loadWindowParameters(conststring& windowName);
CV_EXPORTS int startLoop(int (*pt2Func)(int argc, char *argv[]),int argc, char* argv[]);
CV_EXPORTS void stopLoop();
typedef void (CV_CDECL *ButtonCallback)(int state, void*userdata);
CV_EXPORTS int createButton( const string&bar_name, ButtonCallback on_change , void* userdataCV_DEFAULT(NULL), int type CV_DEFAULT(CV_PUSH_BUTTON), boolinitial_button_state CV_DEFAULT(0));//-------------------------
CV_EXPORTS_W void imshow( const string& winname,const Mat& mat );
typedef void (CV_CDECL *TrackbarCallback)(int pos, void*userdata);
CV_EXPORTS int createTrackbar( const string&trackbarname, const string& winname, int* value,int count, TrackbarCallback onChange CV_DEFAULT(0), void* userdataCV_DEFAULT(0));
CV_EXPORTS_W int getTrackbarPos( const string&trackbarname, const string& winname );
CV_EXPORTS_W void setTrackbarPos( const string&trackbarname, const string& winname, int pos );
typedef void (*MouseCallback )(int event, int x, int y, intflags, void* param); //! assigns callback for mouse eventsCV_EXPORTS void setMouseCallback( const string&windowName, MouseCallback onMouse, void* param=0); CV_EXPORTS_W Matimread( const string& filename, int flags=1 );CV_EXPORTS_W bool imwrite( const string& filename,const Mat& img, const vector¶ms=vector());
CV_EXPORTS_W Mat imdecode( const Mat& buf, intflags );
CV_EXPORTS_W int waitKey(int delay=0);
#ifndef CV_NO_VIDEO_CAPTURE_CPP_API
template<> void CV_EXPORTSPtr::delete_obj();
template<> void CV_EXPORTSPtr::delete_obj();
class CV_EXPORTS_W VideoCapture
{
public:
CV_WRAP VideoCapture();
CV_WRAP VideoCapture(conststring& filename);
CV_WRAP VideoCapture(int device);
virtual ~VideoCapture();
CV_WRAP virtual bool open(conststring& filename);
CV_WRAP virtual bool isOpened()const;
CV_WRAP virtual void release();
CV_WRAP virtual bool grab();
CV_WRAP virtual bool retrieve(CV_OUTMat& image, int channel=0);
CV_WRAP virtual bool read(CV_OUTMat& image);
CV_WRAP virtual bool set(int propId,double value);
CV_WRAP virtual double get(intpropId);
protected:
Ptr cap;
};
class CV_EXPORTS_W VideoWriter
{
public:
CV_WRAP VideoWriter();
CV_WRAP VideoWriter(conststring& filename, int fourcc, double fps, SizeframeSize, bool isColor=true);
virtual ~VideoWriter(); C
V_WRAP virtual bool open(conststring& filename, int fourcc, double fps, SizeframeSize, bool isColor=true);
CV_WRAP virtual bool isOpened()
const; virtualVideoWriter& operator<< (const Mat&image);
CV_WRAP virtual void write(constMat& image);
protected:
Ptr writer;
};
modulescoreincludeopencv
前面的是一些宏定义,是为了兼容C,C++。对于一些函数的调用方式,建议补充一点补充知识:http://blog.csdn.net/yongdun_007/archive/2010/12/21/6090281.aspx,这个头文件是很重要的一个文件,建议大家都看看,这里定义了opencv用到的所有的数据类型和结构。详细如下:
types_c.h包括:常用的宏指令和内联函数,随机数的生成,图像数据类型,矩阵数据类型,多维稠密矩阵,多维稀疏矩阵,稀疏矩阵迭代,直方图,其他数据类型定义(包括矩形,终止准则,点和变量,size变量和Box变量,片和部分,尺度或者角度),动态数据结构(包括内存存储,序列,节点或者集,图结构,链和轮廓),序列类型,序列的读/写操作,对序列的操作(包括图的微操作),保持数据结构的稳定性,系统数据类型。
常用的宏指令和内联函数:
#define CV_PI
#define CV_LOG20.693147180559945309417232
#define CV_SWAP(a,b,t) ((t) = (a), (a) = (b), (b) =(t))//交换a,b
#ifndef MIN
#define MIN(a,b)
#endif
#ifndef MAX
#define MAX(a,b)
#endif
#define
#define
#ifndef __cplusplus
#define
#else
#define
#endif
#define
#define
// 返回和参数最接近的整数值
CV_INLINE
//返回不大于参数的最大整数值
CV_INLINE
//返回不小于参数的最小整数值
CV_INLINE
//对参数开平方并进行求倒
#define cvInvSqrt(value) ((float)(1./sqrt(value)))
//对参数开平方
#define cvSqrt(value)
//判定是否为合法数
CV_INLINE int cvIsNaN( double value )
//判定是否为无穷
CV_INLINE int cvIsInf( double value )
随机数的生成
typedef uint64 CvRNG;
//初始化随机数生成器状态
CV_INLINE CvRNG cvRNG( int64 seed CV_DEFAULT(-1))
//返回32位无符号整型并更新RNG
CV_INLINE unsigned cvRandInt( CvRNG* rng )
//返回浮点型随机数并更新RNG
CV_INLINE double cvRandReal( CvRNG* rng )
图像数据类型
#ifndef HAVE_IPL
//定义深度位数
#define IPL_DEPTH_SIGN 0x80000000
#defineIPL_DEPTH_1U
#defineIPL_DEPTH_8U
#defineIPL_DEPTH_16U
#defineIPL_DEPTH_32F
//定义有符号深度位数
#define IPL_DEPTH_8S
#define IPL_DEPTH_16S (IPL_DEPTH_SIGN|16)
#define IPL_DEPTH_32S (IPL_DEPTH_SIGN|32)
//定义数据顺序
#define IPL_DATA_ORDER_PIXEL
#define IPL_DATA_ORDER_PLANE
//定义图像原点位置
#define IPL_ORIGIN_TL 0 //左上
#define IPL_ORIGIN_BL 1 //左下
//定义扫描线位数
#define IPL_ALIGN_4BYTES
#defineIPL_ALIGN_8BYTES
#define IPL_ALIGN_16BYTES 16
#define IPL_ALIGN_32BYTES 32
//定义扫描线对齐
#defineIPL_ALIGN_DWORD
#defineIPL_ALIGN_QWORD
//定义扫描线宽度状态
#defineIPL_BORDER_CONSTANT
#define IPL_BORDER_REPLICATE
#defineIPL_BORDER_REFLECT
#defineIPL_BORDER_WRAP
//定义图像结构体
typedef struct _IplImage
{
}
IplImage;
//定义图像分块信息结构体
typedef struct _IplTileInfo IplTileInfo;
//定义图像感兴趣区域
typedef struct _IplROI
{
}
IplROI;
//定义卷积核结构体
typedef struct _IplConvKernel
{
}
IplConvKernel;
//定义快速卷积核结构体
typedef struct _IplConvKernelFP
{
}
IplConvKernelFP;
#define IPL_IMAGE_HEADER 1
#defineIPL_IMAGE_DATA
#defineIPL_IMAGE_ROI
#endif
//定义边界模式
#defineIPL_BORDER_REFLECT_101
#defineIPL_BORDER_TRANSPARENT
#define IPL_IMAGE_MAGIC_VAL
#define CV_TYPE_NAME_IMAGE "opencv-image"
#define CV_IS_IMAGE_HDR(img)
#define CV_IS_IMAGE(img)
//定义存储在图像的双精度数据
#define IPL_DEPTH_64F
//定义从给定图像,给定数据类型,给定坐标(col,row)获取图像像素值
#define CV_IMAGE_ELEM( image, elemtype, row, col)
(((elemtype*)((image)->imageData +(image)->widthStep*(row)))[(col)])
矩阵数据类型
//
#defineCV_CN_MAX
#defineCV_CN_SHIFT
#define CV_DEPTH_MAX
//定义矩阵数据类型
#define CV_8U
#define CV_8S
#define CV_16U
#define CV_16S
#define CV_32S
#define CV_32F
#define CV_64F
#define CV_USRTYPE1 7
//
#defineCV_MAT_DEPTH_MASK
#defineCV_MAT_DEPTH(flags)
//
#define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1)<< CV_CN_SHIFT))
#define CV_MAKE_TYPE CV_MAKETYPE
//
#define CV_8UC1 CV_MAKETYPE(CV_8U,1)
#define CV_8UC2 CV_MAKETYPE(CV_8U,2)
#define CV_8UC3 CV_MAKETYPE(CV_8U,3)
#define CV_8UC4 CV_MAKETYPE(CV_8U,4)
#define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
//
#define CV_8SC1 CV_MAKETYPE(CV_8S,1)
#define CV_8SC2 CV_MAKETYPE(CV_8S,2)
#define CV_8SC3 CV_MAKETYPE(CV_8S,3)
#define CV_8SC4 CV_MAKETYPE(CV_8S,4)
#define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
//
#define CV_16UC1 CV_MAKETYPE(CV_16U,1)
#define CV_16UC2 CV_MAKETYPE(CV_16U,2)
#define CV_16UC3 CV_MAKETYPE(CV_16U,3)
#define CV_16UC4 CV_MAKETYPE(CV_16U,4)
#define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
//
#define CV_16SC1 CV_MAKETYPE(CV_16S,1)
#define CV_16SC2 CV_MAKETYPE(CV_16S,2)
#define CV_16SC3 CV_MAKETYPE(CV_16S,3)
#define CV_16SC4 CV_MAKETYPE(CV_16S,4)
#define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
//
#define CV_32SC1 CV_MAKETYPE(CV_32S,1)
#define CV_32SC2 CV_MAKETYPE(CV_32S,2)
#define CV_32SC3 CV_MAKETYPE(CV_32S,3)
#define CV_32SC4 CV_MAKETYPE(CV_32S,4)
#define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
//
#define CV_32FC1 CV_MAKETYPE(CV_32F,1)
#define CV_32FC2 CV_MAKETYPE(CV_32F,2)
#define CV_32FC3 CV_MAKETYPE(CV_32F,3)
#define CV_32FC4 CV_MAKETYPE(CV_32F,4)
#define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
//
#define CV_64FC1 CV_MAKETYPE(CV_64F,1)
#define CV_64FC2 CV_MAKETYPE(CV_64F,2)
#define CV_64FC3 CV_MAKETYPE(CV_64F,3)
#define CV_64FC4 CV_MAKETYPE(CV_64F,4)
#define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
//
#define CV_AUTO_STEP
#define CV_WHOLE_ARR
//
#defineCV_MAT_CN_MASK
#defineCV_MAT_CN(flags)
#defineCV_MAT_TYPE_MASK
#defineCV_MAT_TYPE(flags)
#define CV_MAT_CONT_FLAG_SHIFT
#defineCV_MAT_CONT_FLAG
#defineCV_IS_MAT_CONT(flags)
#defineCV_IS_CONT_MAT
#defineCV_SUBMAT_FLAG_SHIFT
#defineCV_SUBMAT_FLAG
#defineCV_IS_SUBMAT(flags)
//
#defineCV_MAGIC_MASK
#defineCV_MAT_MAGIC_VAL
#defineCV_TYPE_NAME_MAT
//定义矩阵结构体
typedef struct CvMat
{
#ifdef __cplusplus
#else
#endif
}
CvMat;
//判断矩阵头指针
#define CV_IS_MAT_HDR(mat)
//
#define CV_IS_MAT_HDR_Z(mat)
//
#define CV_IS_MAT(mat)
//
#define CV_IS_MASK_ARR(mat)
#define CV_ARE_TYPES_EQ(mat1, mat2)
//
#define CV_ARE_CNS_EQ(mat1, mat2)
//
#define CV_ARE_DEPTHS_EQ(mat1, mat2)
//
#define CV_ARE_SIZES_EQ(mat1, mat2)
#define CV_IS_MAT_CONST(mat)
//
#define CV_ELEM_SIZE1(type)
//
#define CV_ELEM_SIZE(type)
//
#define IPL2CV_DEPTH(depth)
//初始化矩阵
CV_INLINE CvMat cvMat( int rows, int cols, int type, void* dataCV_DEFAULT(NULL))
//快速将数据添加到矩阵
#define CV_MAT_ELEM_PTR_FAST( mat, row, col, pix_size)
//快速将数据添加到矩阵(1)
#define CV_MAT_ELEM_PTR( mat, row, col)
//快速将数据添加到矩阵(2)
#define CV_MAT_ELEM( mat, elemtype, row, col)
//从矩阵中获取数据
CV_INLINE
//将数据添加到矩阵
CV_INLINE
//设置矩阵数据类型
CV_INLINE int cvIplDepth( int type )
多维稠密矩阵
//
#defineCV_MATND_MAGIC_VAL
#defineCV_TYPE_NAME_MATND
//
#defineCV_MAX_DIM
#defineCV_MAX_DIM_HEAP
//定义稠密矩阵结构体
typedef struct CvMatND
{
}
CvMatND;
//
#define CV_IS_MATND_HDR(mat)
//
#define CV_IS_MATND(mat)
多维稀疏矩阵
//
#defineCV_SPARSE_MAT_MAGIC_VAL
#defineCV_TYPE_NAME_SPARSE_MAT
//
struct CvSet;
//定义稀疏矩阵结构体
typedef struct CvSparseMat
{
}
CvSparseMat;
//
#define CV_IS_SPARSE_MAT_HDR(mat)
//
#define CV_IS_SPARSE_MAT(mat)
稀疏矩阵迭代
//定义稀疏矩阵迭代体结构体
typedef struct CvSparseNode
{
}
CvSparseNode;
//定义稀疏矩阵迭代器
typedef struct CvSparseMatIterator
{
}
CvSparseMatIterator;
#defineCV_NODE_VAL(mat,node)
#defineCV_NODE_IDX(mat,node)
直方图
typedef int CvHistType;
//
#defineCV_HIST_MAGIC_VAL
#define CV_HIST_UNIFORM_FLAG
//维区域是否设置的标签
#defineCV_HIST_RANGES_FLAG
//定义矩阵状态
#defineCV_HIST_ARRAY
#defineCV_HIST_SPARSE
#defineCV_HIST_TREE
#defineCV_HIST_UNIFORM
//定义直方图结构体
typedef struct CvHistogram
{
}
CvHistogram;
//
#define CV_IS_HIST( hist )
//
#define CV_IS_UNIFORM_HIST( hist )
//
#define CV_IS_SPARSE_HIST( hist )
//
#define CV_HIST_HAS_RANGES( hist )
//
其他数据类型应用定义------矩形
//定义矩形结构体
typedef struct CvRect
{
}
CvRect;
//矩形初始化
CV_INLINE
{
}
//在感兴趣通道上设置图的感兴趣区域
CV_INLINE
//获取感兴趣区域的矩形大小
CV_INLINE
其他数据类型应用定义------终止准则
//
#defineCV_TERMCRIT_ITER
#define CV_TERMCRIT_NUMBER
#defineCV_TERMCRIT_EPS
//定义迭代算法的终止准则结构体
typedef struct CvTermCriteria
{
}
CvTermCriteria;
//初始化终止准则
CV_INLINE
其他数据类型应用定义------点和变量
//定义整型二维点
typedef struct CvPoint
{
}
CvPoint;
//初始化二维点
CV_INLINE
{
}
//定义浮点型二维点
typedef struct CvPoint2D32f
{
}
CvPoint2D32f;
//初始化浮点型二维点
CV_INLINE
{
}
//
CV_INLINE
{
}
CV_INLINE
{
}
//定义浮点型三维点
typedef struct CvPoint3D32f
{
}
CvPoint3D32f;
//初始化浮点型三维点
CV_INLINE
{
}
//定义双精度型二维点
typedef struct CvPoint2D64f
{
}
CvPoint2D64f;
//初始化双精度型二维点
CV_INLINE
{
}
//定义双精度型三维点
typedef struct CvPoint3D64f
{
}
CvPoint3D64f;
//初始化双精度型三维点
CV_INLINE
{
}
其他数据类型应用定义------size变量和Box箱变量
//定义size
typedef struct
{
}
CvSize;
//初始化size
CV_INLINE
{
}
//定义二维浮点型size
typedef struct CvSize2D32f
{
}
CvSize2D32f;
//初始化二维浮点型size
CV_INLINE
{
}
//定义二维箱
typedef struct CvBox2D
{
}
CvBox2D;
//定义线性迭代状态
typedef struct CvLineIterator
{
}
CvLineIterator;
其他数据类型应用定义------片,部分
//定义片
typedef struct CvSlice
{
}
CvSlice;
//初始化片
CV_INLINE
{
}
#define CV_WHOLE_SEQ_END_INDEX 0x3fffffff
#define CV_WHOLE_SEQ
其他数据类型应用定义------尺度,角度
//定义角度结构体
typedef struct CvScalar
{
}
CvScalar;
//初始化角度
CV_INLINE
{
}
CV_INLINE
{
}
CV_INLINE
{
}
动态数据结构-内存存储
//定义内存块结构
typedef struct CvMemBlock
{
}
CvMemBlock;
#defineCV_STORAGE_MAGIC_VAL
typedef struct CvMemStorage
{
}
CvMemStorage;
#define CV_IS_STORAGE(storage)
typedef struct CvMemStoragePos
{
}
CvMemStoragePos;
动态数据结构-序列(线性)
//定义序列块结构体
typedef struct CvSeqBlock
{
}
CvSeqBlock;
//定义序列节点
#defineCV_TREE_NODE_FIELDS(node_type)
//读和写序列(动态的添加和删除元素)
//定义序列结构体
typedef struct CvSeq
{
}
CvSeq;
#defineCV_TYPE_NAME_SEQ
#defineCV_TYPE_NAME_SEQ_TREE
动态数据结构-节点(集)
(节点顺序是不被保护的,他们可看成介于元素间的空隙,但被插入后就保留在该地方,判断有元素,看MSB‘mose-significantor sign bit’的标志位)
//定义序列节点属性
#defineCV_SET_ELEM_FIELDS(elem_type)
//设置序列元素
typedef struct CvSetElem
{
}
CvSetElem;
//
#defineCV_SET_FIELDS()
//
typedef struct CvSet
{
}
CvSet;
#define CV_SET_ELEM_IDX_MASK
#define CV_SET_ELEM_FREE_FLAG
//定义元素指针被设置与否
#define CV_IS_SET_ELEM( ptr )
动态数据结构-图结构
//定义图边属性
#defineCV_GRAPH_EDGE_FIELDS()
//定义图节点属性
#defineCV_GRAPH_VERTEX_FIELDS()
//定义图边结构体
typedef struct CvGraphEdge
{
}
CvGraphEdge;
//定义图节点结构体
typedef struct CvGraphVtx
{
}
CvGraphVtx;
//定义二维图
typedef struct CvGraphVtx2D
{
}
CvGraphVtx2D;
//定义图属性
#define
//定义图结构
typedef struct CvGraph
{
}
CvGraph;
#define CV_TYPE_NAME_GRAPH "opencv-graph"
动态数据结构-链和轮廓
//定义链结构
typedef struct CvChain
{
}
CvChain;
//定义轮廓属性
#define CV_CONTOUR_FIELDS()
//定义轮廓结构体
typedef struct CvContour
{
}
CvContour;
typedef CvContour CvPoint2DSeq;
序列类型
//表示稠密序列
#defineCV_SEQ_MAGIC_VAL
#define CV_IS_SEQ(seq)
//表示稀疏序列
#defineCV_SET_MAGIC_VAL
#define CV_IS_SET(set)
//表示稠密序列元素位数
#defineCV_SEQ_ELTYPE_BITS
#defineCV_SEQ_ELTYPE_MASK
//
#defineCV_SEQ_ELTYPE_POINT
#defineCV_SEQ_ELTYPE_CODE
//
#defineCV_SEQ_ELTYPE_GENERIC
#defineCV_SEQ_ELTYPE_PTR
#defineCV_SEQ_ELTYPE_PPOINT
#defineCV_SEQ_ELTYPE_INDEX
#defineCV_SEQ_ELTYPE_GRAPH_EDGE
#defineCV_SEQ_ELTYPE_GRAPH_VERTEX
#defineCV_SEQ_ELTYPE_TRIAN_ATR
#define CV_SEQ_ELTYPE_CONNECTED_COMP0
#defineCV_SEQ_ELTYPE_POINT3D
//表示稠密序列类型位数
#defineCV_SEQ_KIND_BITS
#defineCV_SEQ_KIND_MASK
//稠密序列的三种类型
#defineCV_SEQ_KIND_GENERIC
#defineCV_SEQ_KIND_CURVE
#defineCV_SEQ_KIND_BIN_TREE
//稀疏序列的三种类型
#defineCV_SEQ_KIND_GRAPH
#defineCV_SEQ_KIND_SUBDIV2D
#defineCV_SEQ_FLAG_SHIFT
//曲线序列的类型标志
#defineCV_SEQ_FLAG_CLOSED
#defineCV_SEQ_FLAG_SIMPLE
#defineCV_SEQ_FLAG_CONVEX
#defineCV_SEQ_FLAG_HOLE
//图序列的类型标志
#define CV_GRAPH_FLAG_ORIENTED (1<< CV_SEQ_FLAG_SHIFT)
#defineCV_GRAPH
#defineCV_ORIENTED_GRAPH
//定义点集
#defineCV_SEQ_POINT_SET
#defineCV_SEQ_POINT3D_SET
#defineCV_SEQ_POLYLINE
#defineCV_SEQ_POLYGON
#defineCV_SEQ_CONTOUR
#define CV_SEQ_SIMPLE_POLYGON
//定义曲线链表
#defineCV_SEQ_CHAIN
#defineCV_SEQ_CHAIN_CONTOUR
//用二叉树表示轮廓集
#defineCV_SEQ_POLYGON_TREE
//连接部分的序列表示
#define CV_SEQ_CONNECTED_COMP
//整数表示的序列
#defineCV_SEQ_INDEX
#define CV_SEQ_ELTYPE( seq)
#define CV_SEQ_KIND( seq)
//标记检测
#define CV_IS_SEQ_INDEX( seq)
#define CV_IS_SEQ_CURVE( seq)
#define CV_IS_SEQ_CLOSED( seq)
#define CV_IS_SEQ_CONVEX( seq)
#define CV_IS_SEQ_HOLE( seq)
#define CV_IS_SEQ_SIMPLE( seq)
//类型检测
#define CV_IS_SEQ_POINT_SET( seq )
#define CV_IS_SEQ_POINT_SUBSET( seq )
#define CV_IS_SEQ_POLYLINE( seq)
#define CV_IS_SEQ_POLYGON( seq)
#define CV_IS_SEQ_CHAIN( seq)
#define CV_IS_SEQ_CONTOUR( seq )
#define CV_IS_SEQ_CHAIN_CONTOUR( seq )
#define CV_IS_SEQ_POLYGON_TREE( seq )
#define CV_IS_GRAPH( seq)
#define CV_IS_GRAPH_ORIENTED( seq)
#define CV_IS_SUBDIV2D( seq )
序列的读/写操作
//定义序列写的属性
#defineCV_SEQ_WRITER_FIELDS()
//定义序列写结构体
typedef struct CvSeqWriter
{
}
CvSeqWriter;
//定义序列读的属性
#defineCV_SEQ_READER_FIELDS()
//定义序列读的结构体
typedef struct CvSeqReader
{
}
CvSeqReader;
对序列的操作
#define
(
#define CV_GET_SEQ_ELEM( elem_type, seq, index ) CV_SEQ_ELEM((seq), elem_type, (index) )
//在序列中增加元素
#define CV_WRITE_SEQ_ELEM_VAR( elem_ptr, writer)
{
}
#define CV_WRITE_SEQ_ELEM( elem, writer)
{
}
//向前移动读序列位置
#define CV_NEXT_SEQ_ELEM( elem_size, reader)
{
}
//向前移动读序列位置
#define CV_PREV_SEQ_ELEM( elem_size, reader)
{
}
//读序列中元素并向前移动读位置
#define CV_READ_SEQ_ELEM( elem, reader)
{
}
//读序列中元素并向前移动读位置
#define CV_REV_READ_SEQ_ELEM( elem, reader)
{
}
#define CV_READ_CHAIN_POINT( _pt, reader)
{
}
#define CV_CURRENT_POINT( reader )
#define CV_PREV_POINT( reader)
//读边序列
#define CV_READ_EDGE( pt1, pt2, reader)
{
}
对序列的操作-图的微操作
//返回给定顶点的图边缘
#define
保持数据结构的连续性的说明
//文件存储的“黑箱”定义
typedef struct CvFileStorage CvFileStorage;
//存储标记
#defineCV_STORAGE_READ
#defineCV_STORAGE_WRITE
#defineCV_STORAGE_WRITE_TEXT
#define CV_STORAGE_WRITE_BINARY
#defineCV_STORAGE_APPEND
//属性列表
typedef struct CvAttrList
{
}
CvAttrList;
CV_INLINE CvAttrList cvAttrList( const char** attrCV_DEFAULT(NULL),
{
}
struct CvTypeInfo;
#defineCV_NODE_NONE
#defineCV_NODE_INT
#defineCV_NODE_INTEGER
#defineCV_NODE_REAL
#defineCV_NODE_FLOAT
#defineCV_NODE_STR
#defineCV_NODE_STRING
#defineCV_NODE_REF
#defineCV_NODE_SEQ
#defineCV_NODE_MAP
#defineCV_NODE_TYPE_MASK
#define CV_NODE_TYPE(flags)
#defineCV_NODE_FLOW
#defineCV_NODE_USER
#defineCV_NODE_EMPTY
#defineCV_NODE_NAMED
#defineCV_NODE_IS_INT(flags)
#defineCV_NODE_IS_REAL(flags)
#defineCV_NODE_IS_STRING(flags)
#defineCV_NODE_IS_SEQ(flags)
#defineCV_NODE_IS_MAP(flags)
#define CV_NODE_IS_COLLECTION(flags) (CV_NODE_TYPE(flags)>= CV_NODE_SEQ)
#defineCV_NODE_IS_FLOW(flags)
#defineCV_NODE_IS_EMPTY(flags)
#defineCV_NODE_IS_USER(flags)
#defineCV_NODE_HAS_NAME(flags)
#define CV_NODE_SEQ_SIMPLE 256
#define CV_NODE_SEQ_IS_SIMPLE(seq) (((seq)->flags& CV_NODE_SEQ_SIMPLE) != 0)
typedef struct CvString
{
}
CvString;
//所有的元素名字以哈希表中,增加搜索速度
typedef struct CvStringHashNode{
}
CvStringHashNode;
typedef struct CvGenericHash CvFileNodeHash;
typedef struct CvFileNode
{
}
CvFileNode;
#ifdef __cplusplus
extern "C" {
#endif
typedef int (CV_CDECL *CvIsInstanceFunc)( const void* struct_ptr);
typedef void (CV_CDECL *CvReleaseFunc)( void** struct_dblptr);
typedef void* (CV_CDECL *CvReadFunc)( CvFileStorage* storage,CvFileNode* node );
typedef void (CV_CDECL *CvWriteFunc)( CvFileStorage* storage,const char* name,
typedef void* (CV_CDECL *CvCloneFunc)( const void* struct_ptr);
#ifdef __cplusplus
}
#endif
typedef struct CvTypeInfo
{
}
CvTypeInfo;
系统数据类型
typedef struct CvPluginFuncInfo
{
}
CvPluginFuncInfo;
typedef struct CvModuleInfo
{
}
CvModuleInfo;