Home > python > Face detection with Python

Face detection with Python

Today I found an interesting post: Face Detection in Static Images with Python. You give an image as input and the program draws a rectangle around the face(s) on the image.


sudo apt-get install python-opencv libcv-dev opencv-doc

Under Ubuntu 11.04, the required XML is in the opencv-doc package at a different location, thus you need to modify the source code:

cascade = cvLoadHaarClassifierCascade(

See the full (patched) source code here.

Lesson learned
You can draw a rectangle on an image the following way:

convert original.jpg -stroke red -fill none -draw "rectangle 50,36 115,101" output.jpg

Where 50,36 is the top left, 115,101 is the bottom right coordinates.

/ @reddit /

Categories: python Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: