here is a function of the cascade Haar. But writer_finished.write writes the file only one image.I do something wrong?
void detect(Mat frame)
{
vector<Rect> faces;
Mat frame_gray;
Mat centers(8, 1, CV_32FC1);
//const char *filename_finished = "capture_обработанное.avi";
double fps = 15;
CvSize size = cvSize(640, 480);
VideoWriter writer_finished("capture_обработанное.avi", CV_FOURCC('X', 'V', 'I', 'D'), fps, size, 1);
cvtColor(frame, frame_gray, CV_BGR2GRAY);
equalizeHist(frame_gray, frame_gray);
//нахождение лица
face_cascade.detectMultiScale(frame_gray, faces, 1.15, 2, 0 | CV_HAAR_SCALE_IMAGE, Size(75, 75));
for (size_t i = 0; i < faces.size(); i++)
{
Point center(faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5);
ellipse(frame, center, Size(faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar(0, 0, 255), 4, 8, 0);
Mat faceROI = frame_gray(faces[i]);
cout << "x " << faces[i].x << " y " << faces[i].y<< endl;
}
if (!frame.empty()) writer_finished.write(frame);
//показываем
imshow(window_name, frame);
}
}