I need to extract an object from a jpeg using php, and I think the only way to do it is to group all pixel with the same colors. But those extra pixels (which I think are noise), I can't extract the picture correctly. I'm not sure of what function to use.. Please help! Thanks in advance.
Imagemagick is the shit when it comes to handling images with php, http://imagemagick.org/script/examples.php You have two flavours, imagick : http://pecl.php.net/package/imagick and magick wand for php : http://www.magickwand.org/ There are plenty of tuts and examples here: http://www.imagemagick.org
If you have time, check out Intels openCV library & consider writing a PHP extension for it. There's http://www.xarg.org/project/php-facedetect/ which is a wrapper for facial recognition, but it's slow and klunky. It's a starting point though.