Do conversion to grayscale after face detection.

pull/2953/head
Ivar Clemens 4 years ago
parent f5aeecf2da
commit f91b4d80cd
  1. 7
      modules/face/src/facemarkLBF.cpp

@ -535,13 +535,14 @@ Rect FacemarkLBFImpl::getBBox(Mat &img, const Mat_<double> shape) {
void FacemarkLBFImpl::prepareTrainingData(Mat img, std::vector<Point2f> facePoints,
std::vector<Mat> & cropped, std::vector<Mat> & shapes, std::vector<BBox> &boxes)
{
Mat shape;
Mat _shape = Mat(facePoints).reshape(1);
Rect box = getBBox(img, _shape);
if(img.channels()>1){
cvtColor(img,img,COLOR_BGR2GRAY);
}
Mat shape;
Mat _shape = Mat(facePoints).reshape(1);
Rect box = getBBox(img, _shape);
if(box.x != -1){
_shape.convertTo(shape, CV_64FC1);
Mat sx = shape.col(0);

Loading…
Cancel
Save