19,469
社区成员
发帖
与我相关
我的任务
分享
void detectAndDisplay(Mat image )
{
std::vector<Rect> faces;
Mat frame_gray;
cvtColor( image, frame_gray, COLOR_BGR2GRAY );
equalizeHist( frame_gray, frame_gray );
face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0, Size(80, 80) );
for( int i = 0; i < faces.size(); i++ )
{
Point center( faces[i].x + faces[i].width/2, faces[i].y + faces[i].height/2 );
ellipse( image, center, Size( faces[i].width/2, faces[i].height/2 ), 0, 0, 360, Scalar( 255, 0, 0 ), 2, 8, 0 );
Mat faceROI = frame_gray( faces[i] );
}
imshow("colorImage", image); //显示图像
}