错误C3861:'cropImage'*:找不到标识符

时间:2012-05-04 20:56:34

标签: c++ opencv

在开发用于面部认证的C ++应用程序时,我遇到了 错误:

C3861: 'cropImage'*: identifier not found

这是cropImage的签名:

IplImage* cropImage(IplImage *img,CvRect region);

我尝试在以下函数中调用它:

IplImage *cropFace(IplImage * image, CvPoint eye_left, CvPoint eye_right, double offset_pct[2], CvSize dest_sz)
{//calculate offsets in original image
    ...
    //matrice de rotation
    cv::Mat affine_matrix;
    affine_matrix = cv::getRotationMatrix2D(eye_left, rotation, scale);
    //mtx est la conversion de image IplImage* en matrice mtx
    cv::Mat mtx = cv::Mat(image, true);
    cv::Mat mtx2;
    cv::warpAffine(mtx, mtx2, affine_matrix, mtx.size(), cv::INTER_LINEAR,       cv::BORDER_CONSTANT, cv::Scalar::all(255));
    //mtx est la conversion de matrice mtx2 en image IplImage*
    IplImage image1 = mtx2;
    //crop the rotated image
    double crop_x = eye_left.x - scale * offset_h;
    double crop_y = eye_left.y - scale * offset_v;
    double crop_size0 = dest_sz.width * scale;
    double crop_size1 = dest_sz.height * scale;
    CvRect region;
    region.x = cvFloor(crop_y);
    region.y = cvFloor(crop_y);
    region.width = cvFloor(crop_size0);
    region.height = cvFloor(crop_size1);
    //the problem in this ligne,it seems it has not known cropImage !! :(
    IplImage *image2 = cropImage(&image1, region);
    IplImage *image3 = resizeImage(image2, dest_sz.width, dest_sz.width);
    return image3;
}      

我认为IplImage *和Mat之间的转换导致了这个问题。

1 个答案:

答案 0 :(得分:1)

问题似乎是你指出来的。即使&已经是指针类型,您也会使用image符号取消引用它,从而产生双指针。你应该简单地尝试:

IplImage *image2 = cropImage(image1, region);