Pergunta

I have been given an image with rgb channels. I only want to see the persons face. How would I do that? Are neural nets used for this? If so, are there existing data files from neural nets that have already done the processing?

Foi útil?

Solução

Since your questions is tagged with OpenCV, I will assume that you are looking for a solution within this library.

The first step is to find the faces. For this, use one of the cascade object detectors that are available: either the Viola-Jones one or the LBP one. OpenCV comes with cascades trained for face detection for each of these detectors.

Then, it depends if getting a bounding box is enough or not.

If you need something more accurate, then you can:

  • [coarse face] use a skin color detector inside the face bounding box to get a finer face estimate, binarize the image and finally close the face shape using morphological filtering;
  • [fine face contour] use something like a grabcut procedure to get a pixel-accurate contour. You can initialize the grabcut with borders of the bounding box as background and center part of the bounding box as foreground.

Outras dicas

Not really sure what you want to do, but you can use Haar Classifier for face detection.

From then on, it should be easy to only display the face. While there are available classifiers online, you can try training your own classifier should you have the time. I have done classifiers on hand, face, eyes before and it have an impressive result.

Should you need more help on training classifier, etc, just comment here, I will try my best to assist you.

Face detection functionality is also available in the Computer Vision System Toolbox for MATLAB in the form of the vision.CascadeObjectDetector object.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top