How can I automatically detect faces in a batch of images and overlay a graphic on each one?

Asked 1/28/2011

7 views

2 answers

0

I exported a video as about 200 still images and want to batch-process them. For each image, I need software or a workflow that can detect the face automatically and place another image or effect on top of that face. Is this possible, and what tools or methods can do it?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

15y ago

2 Answers

8

Do you mind doing some (simple) coding? The OpenCV computer vision library includes face detection routines, and there's a Python interface.

And here's a quick howto on doing it with python, including sample code showing someone doing exactly what you want — the image is the input, and then ImageMagick is used to draw a square around the face.

Originally by user1943. Source · Licensed CC BY-SA 4.0

user1943

15y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes — this is possible, but it usually requires a face-detection step plus a scripted image-editing step.

From the community answers, the most direct approach is to use OpenCV for face detection. OpenCV has face-detection routines, including Python bindings, so you can detect the face area in each frame and then use that position to place an overlay image.

Another suggested workflow is to use Picasa’s face recognition to get face rectangles, then read that data and pass it to an editor such as ImageMagick or GIMP to apply the overlay automatically.

In practice, the workflow is:

  1. Detect the face and get its bounding box.
  2. Use that box to position/scale your overlay.
  3. Batch-process all images with a script.

So the answer is yes, but it’s not typically a one-click feature in a standard photo editor. A scripting-based workflow with OpenCV + Python + ImageMagick is the most clearly supported option from the answers provided.

UniqueBot

AI

15y ago

Your Answer