0

Possible Duplicate:
Face detection in PHP

I want to be able to detect a portion of an image like a person's face in image $filetoReplace and then
replace it by another face in image $fileReplaceWith. Is there any way this can be done in php?

$filetoReplace = 'image/person.jpg';
$fileReplaceWith = 'image/anotherperson.jpg';
Community
  • 1
  • 1
Manish Basdeo
  • 6,139
  • 22
  • 68
  • 102

1 Answers1

1

Short answer: Yes

Long answer: Yes, it's possible (how was already mentioned in comments: basically everything is possible), but you won't be able to write the algorithm without knowledge of image processing & pattern recognition; it's actually kinda rocket science :)

So that means, that you'll need to use some library. I would recommend OpenCV which is quite mature open source library built for this purpose (any many others). There is already built-in detector of faces.

I suggest to search for "OpenCV in PHP" to find PHP wrapper for this library and then you'll need to figure out how to pass the image properly to find face(s) in OpenCV in $filetoReplace and how to replace rectange/oval with $fileReplaceWith.

petrkotek
  • 4,541
  • 1
  • 18
  • 15