0

Do you know why dlib face detection doesn't work with grayscale images (python works pretty well with grayscale images)?

My code:

mFaceDetector = dlib::get_frontal_face_detector();
// image is opencv grayscale mat
dlib::array2d<unsigned char> img;
dlib::assign_image(img, dlib::cv_image<unsigned char>(image));

std::vector<dlib::rectangle> mRets = mFaceDetector(img);

How to make it work?

  • can you show how you capture/load the image? How do you transform to grayscale? Is there any error message? – Micka Sep 17 '18 at 03:51

1 Answers1

0

Your code is nothing wrong in my perspective. Mine is the same. You should check

  1. The image is loaded correctly by using imshow() function
  2. If it works with non-gray image and other image
  3. If you are setting any scan_fhog_pyramid value to the detector
  4. the mRets.size()
Peter Lee
  • 381
  • 3
  • 9