西安博雅艺术学校图片:VC++ 6.0 编译 opencv1.0 中 cvaux.dll的3个错误原因

来源:百度文库 编辑:九乡新闻网 时间:2024/03/29 23:36:21

VC++ 6.0 编译 opencv1.0 中 cvaux.dll的3个错误原因

默认分类 2010-02-25 06:03:15 阅读36 评论0   字号: 订阅

在debug模式下编译cvaux时会提示三个错误:error C2039: 'foreground_regions' : is not a member of 'CvFGDStatModel'

error C2039: 'foreground_regions' : is not a member of 'CvFGDStatModel'

error C2039: 'foreground_regions' : is not a member of 'CvGaussBGModel'在网上搜到的解决方法都是这样写的:在cvaux.h文件中,搜索关键字foreground_regions,

CvMemStorage* storage; /*storage for 揻oreground_regions?/ \
CvSeq* foreground_regions /*foreground object contours*/

改为如下形式:

CvMemStorage* storage; /*storage for foreground_regions*/ \
CvSeq* foreground_regions /*foreground object contours*/具体原因解释如下:首先foreground_regions 定义在这个宏里面:#define CV_BG_STAT_MODEL_FIELDS()                                                   \
    int             type; /*type of BG model*/                                      \
    CvReleaseBGStatModel release;                                                   \
    CvUpdateBGStatModel update;                                                     \
    IplImage*       background;   /*8UC3 reference background image*/               \
    IplImage*       foreground;   /*8UC1 foreground image*/                         \
    IplImage**      layers;       /*8UC3 reference background image, can be null */ \
    int             layer_count; /* can be zero */                                 \
    CvMemStorage*   storage;      /*storage for 揻oreground_regions?*/              \
    CvSeq*          foreground_regions /*foreground object contours*/“\”在这里代表续行的意思。并且注意前面定义的变量后面都有“;”号,而foreground_regions没有,因为它是这个定义的最后一项,因为宏定义末尾是不加‘;’号的。另外要注意的是,千万不要在修改最后两行时写成这个样子:   CvMemStorage*   storage;      /*storage for 揻oreground_regions?*/              \
    CvSeq*          foreground_regions /*foreground object contours*/即不能放入空行,因为这样一来foreground_regions就不属于宏定义中的一份了。而'CvFGDStatModel''CvGaussBGModel'中均包含了改宏,所以错误会照旧的。