顔認証用の 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 の間の変換がこの問題を引き起こしていると思います。