首页 > 代码库 > 学习OpenCV第1天

学习OpenCV第1天

#if (defined WIN32 || defined WIN64) && defined CVAPI_EXPORTS
    #define CV_EXPORTS __declspec(dllexport)
#else
    #define CV_EXPORTS
#endif
#ifndef CVAPI
    #define CVAPI(rettype) CV_EXTERN_C CV_EXPORTS rettype CV_CDECL
#endif
/* CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */
#ifdef CV_NO_FUNC_NAMES
    #define CV_FUNCNAME( Name )
    #define cvFuncName ""
#else    
    #define CV_FUNCNAME( Name )      static char cvFuncName[] = Name
#endif
/*
 CV_CALL macro calls CV (or IPL) function, checks error status and
 signals a error if the function failed. Useful in "parent node"
 error procesing mode
*/
#define CV_CALL( Func )                                             {                                                                       Func;                                                               CV_CHECK();                                                     }
/* Simplified form of CV_ERROR */
#define CV_ERROR_FROM_CODE( code )       CV_ERROR( code, "" )

/*
 CV_CHECK macro checks error status after CV (or IPL)
 function call. If error detected, control will be transferred to the exit
 label.
*/
#define CV_CHECK()                                                  {                                                                       if( cvGetErrStatus() < 0 )                                              CV_ERROR( CV_StsBackTrace, "Inner function failed." );      }

#define __BEGIN__       {
#define __END__         goto exit; exit: ; }
#define __CLEANUP__
#define EXIT            goto exit
/*
. CV_BLUR_NO_SCALE (简单不带尺度变换的模糊) - 对每个象素的 param1×param2 领域求和。如果邻域大小是变化的,可以事先利用函数 cvIntegral 计算积分图像。
. CV_BLUR (simple blur) - 对每个象素param1×param2邻域 求和并做尺度变换 1/(param1.param2).
. CV_GAUSSIAN (gaussian blur) - 对图像进行核大小为 param1×param2 的高斯卷积
. CV_MEDIAN (median blur) - 对图像进行核大小为param1×param1 的中值滤波(i.e. 邻域是方的).
. CV_BILATERAL (双向滤波) - 应用双向 3x3 滤波,彩色sigma=param1,空间 sigma=param2. 平滑操作的第一个参数.
*/

CV_IMPL void
cvSmooth( const void* srcarr, void* dstarr, int smooth_type,
          int param1, int param2, double param3, double param4 )
{
    CvBoxFilter box_filter;
	//定义一个CvBoxFilter的对象
    CvSepFilter gaussian_filter;
	//定义一个CvSepFilter的对象
    CvMat* temp = 0;
	//temp指针为空
    CV_FUNCNAME( "cvSmooth" );
	/* CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */
    __BEGIN__;//这个没啥用,相当于告诉你我要开始干活了

    int coi1 = 0, coi2 = 0;//COI感兴趣通道,类似于ROI
    CvMat srcstub, *src = http://www.mamicode.com/(CvMat*)srcarr;//void指针进行类型转换>

学习OpenCV第1天