gpt4 book ai didi

c++ - 错误 C3861 : 'cropImage' *: identifier not found

转载 作者:太空宇宙 更新时间:2023-11-03 23:03:16 27 4
gpt4 key购买 nike

在开发人脸认证的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 之间的转换导致了这个问题。

最佳答案

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

IplImage *image2 = cropImage(image1, region);

关于c++ - 错误 C3861 : 'cropImage' *: identifier not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10456037/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com