Page 1 of 1
Face Cropper - Crop image so that only persons face remains?
Posted: Sun Dec 21, 2008 7:54 pm
by kaisellgren
Hello,
I'm in need of a class that can crop an image so that the persons face remains on it. It would allow me to specify some padding around the face to remain too. I know this is very hard subject, but even a simply that works fairly well would be awesome! I'm not looking for direct PHP code (not saying that doesn't satisfy my needs) but I'm OK if anyway can lead me way to a certain open/free algorithm that could do it. Then I could translate it to PHP

Re: Face Cropper - Crop image so that only persons face remains?
Posted: Sun Dec 21, 2008 8:07 pm
by VladSun
WOW!
It's a lot of science

First, you need to preprocess the image (low pass and median filter, histogram equalization and binarization) and then process it by using some pattern recognition techniques (e.g. neural networks).
Re: Face Cropper - Crop image so that only persons face remains?
Posted: Sun Dec 21, 2008 8:17 pm
by kaisellgren
VladSun wrote:WOW!
It's a lot of science

First, you need to preprocess the image (low pass and median filter, histogram equalization and binarization) and then process it by using some pattern recognition techniques (e.g. neural networks).
Hmm.
I'll share what I have got so far.
http://www.xarg.org/2008/07/face-detection-with-php/
Intel works on the OpenCV library to search for structures on images.
http://www.intel.com/technology/computing/opencv/
For all PHP developers I have a good message: I wrote an OpenCV wrapper to detect faces with PHP. The extension offers the two new functions: face_count() and face_detect(). In princible, they differ only by their return value. The first returns only the number of faces found on the given image and the other an associative array of their coordinates. face_count() serves only to save the loops for counting.
Sounds like fun!

Re: Face Cropper - Crop image so that only persons face remains?
Posted: Sun Dec 21, 2008 10:02 pm
by josh
It's mostly simple addition, at worst some elipse based algorithms.... if you already have the face centroid and width/height.
Learning OpenCV puts you right in the middle of the rapidly expanding field of computer vision. Written by the creators of OpenCV, the widely used free open-source library, this book introduces you to computer vision and demonstrates how you can quickly build applications that enable computers to "see" and make decisions based on the data. Computer vision is everywhere -- in security systems, manufacturing inspection systems, medical image analysis, Unmanned Aerial Vehicles, and more. It helps robot cars drive by themselves, stitches Google maps and Google Earth together, checks the pixels on your laptop's LCD screen, and makes sure the stitches in your shirt are OK. OpenCV provides an easy-to-use computer vision infrastructure along with a comprehensive library containing more than 500 functions that can run vision code in real time. With Learning OpenCV, any developer or hobbyist can get up and running with the framework quickly, whether it's to build simple or sophisticated vision applications. The book includes: A thorough introduction to OpenCV Getting input from cameras Transforming images Shape matching Pattern recognition, including face detection Segmenting images Tracking and motion in 2 and 3 dimensions Machine learning algorithms
Hands-on exercises at the end of each chapter help you absorb the concepts, and an appendix explains how to set up an OpenCV project in Visual Studio. OpenCV is written in performance optimized C/C++ code, runs on Windows, Linux, and Mac OS X, and is free for commercial and research use under a BSD license. Getting machines to see is a challenging but entertaining goal. If you're intrigued by the possibilities, Learning OpenCV gets you started onbuilding computer vision applications of your own.
http://www.amazon.com/Learning-OpenCV-C ... 0596516134
http://opencv.willowgarage.com/wiki/
Sick...
Re: Face Cropper - Crop image so that only persons face remains?
Posted: Mon Dec 22, 2008 1:58 am
by Mark Baker
This extension provides a PHP implementation of the OpenCV library.
Not exactly true. It doesn't include any OpenCV logic at all, so it's not an implementation.
I wrote an OpenCV wrapper to detect faces with PHP.
That's all it is, a wrapper.
The real guts is in OpenCV, which is Intel's library
Re: Face Cropper - Crop image so that only persons face remains?
Posted: Mon Dec 22, 2008 6:54 am
by The_Anomaly
This really does seem pretty insanely cool. I'm very interested to know if you get it working how you like it.