
Face swapping with Python, dlib, and OpenCV - bemmu
http://matthewearl.github.io/2015/07/28/switching-eds-with-python/
======
spot
[https://vimeo.com/29348533](https://vimeo.com/29348533)

~~~
piquadrat
Wow! That is creepy and impressive at the same time.

~~~
tim333
See also
[https://www.youtube.com/watch?v=i2VvvOWWquo](https://www.youtube.com/watch?v=i2VvvOWWquo)
using dlib and opencv.

------
bsenftner
Nice work! But people should be aware that this type of thing is patented left
right and sideways. I wrote a patent for automated actor replacement in filmed
media in '05, filed it globally, and it began being awarded in '08 in the
various regions it was filed. Here's one of the US versions:
[http://www.google.com/patents/WO2007035558A2?cl=en](http://www.google.com/patents/WO2007035558A2?cl=en)
I no longer own it; now it is part of a broad family of patents collectively
forming a "Personalized Media" infrastructure. It is owned by a major media
company I'm not allowed to disclose.

Essentially, it is possible to replace people, objects, environments, & audio
elements automatically through a series of techniques. Those techniques form
the basis of a powerful advertising and message delivery infrastructure. And
the collective IP is already owned by a major media conglomerate.

~~~
shadowmint
This is literally what's wrong with the patent system.

Discouraging people from exploring ideas and building things 'because its
patented' is fundamentally wrong.

I bet there are a million patents out there for 'automated face replacement'.
I just hope very very much, that somewhere there is some prior art that makes
them all _completely worthless_ and bankrupts whomever is making any money
from them.

~~~
JonFish85
>> Discouraging people from exploring ideas and building things 'because its
patented' is fundamentally wrong.

Who's discouraging? Being aware that it's highly patented doesn't mean you
shouldn't play around with it, it just means that you probably shouldn't be
trying to make money off of someone else's work.

~~~
Joeri
The thing with software patents though is that most of the time they've
preventing you from making money off of your own work, just because someone at
one point did that same work first. Patents are needed in industries where r&d
is expensive enough to warrant protecting inventors for a sizeable time so
they can recoup their investment. Software r&d is too cheap for patents on
software to do anything but harm.

As a quick rule of thumb, whenever people are being advised never to look at
patents, as they are in software, that's when those patents do more harm than
good.

------
bmir-alum-007
OpenCV is an awesome Swiss-army steam-shovel (thank you Willow Garage!)

In the 90's, there was Kai's Power Goo (now owned by Corel) and probably
something similar used by Conan O'Brien's art dept. to produce the "If They
Mated" segments. It's such a shame tools owned by big companies are
effectively locked away from ever being marketed again by asserting IP rights.

I really think intellectual property needs a principle similar to adverse
possession [0]; that is, if it's not being actively used in a meaningful,
sustained venture, another shop can reboot it. (Giving capitalism the right to
fork.) Btw, I'm not the first, nor the last, to conceive of this. [1]

0\.
[https://en.wikipedia.org/wiki/Adverse_possession](https://en.wikipedia.org/wiki/Adverse_possession)

1\.
[http://jolt.law.harvard.edu/articles/pdf/v16/16HarvJLTech327...](http://jolt.law.harvard.edu/articles/pdf/v16/16HarvJLTech327.pdf)

------
mahouse
And it had to be fucking Miliband?!

Well that said:
[https://www.reddit.com/r/gentlemangabers](https://www.reddit.com/r/gentlemangabers)

(Before you go dig up the actual source code: it just uses a web service to
get the coordinates of the faces)

~~~
fnordfnordfnord
>And it had to be fucking Miliband?!

Did you see what happened here the last time someone used Lena in their
example?

~~~
mahouse
No, I did not.

By the way, I was shocked the first time I saw what the full picture looked
like... 8-)

~~~
fnordfnordfnord
A lot of the discussion was focused on the use of a crop of the Lena image.
[https://news.ycombinator.com/item?id=8704629](https://news.ycombinator.com/item?id=8704629)

>I was shocked the first time I saw what the full picture looked like.

Me too! Ironically I probably wouldn't have ever seen the uncropped image if
not for the controversy around the common use of the cropped version.

~~~
mahouse
Haha, my God. Kids.

------
jabooth
This is _exactly_ the kind of thing that Menpo makes easy:
[https://gist.github.com/jabooth/a52019f6e7c09f2a3e01](https://gist.github.com/jabooth/a52019f6e7c09f2a3e01)

(Forgive the rushed nature of this, literally just whipped this up in the last
20 mins. Will provide a link to the menpofit model in a later revision)

------
murbard2
Matching the low frequency image information is a good simple approach to do
the blending, but better results can be achieved with Poisson image editing:
[http://www.cs.jhu.edu/~misha/Fall07/Papers/Perez03.pdf](http://www.cs.jhu.edu/~misha/Fall07/Papers/Perez03.pdf)

------
jdiez17
The amount of mathematics that goes into automating faceswaps is awesome. The
fact that anyone can do this at home with the sole purpose of generating a
funny image is great!

------
JosephRedfern
How long does this take to run? Could it be done in real-time?

------
cstudyhelp
This was a great and interesting article to read. I have really enjoyed all of
this very cool information. <a
href="[http://www.thecasesolutions.com/hozho-a-16335">Hozho](http://www.thecasesolutions.com/hozho-a-16335">Hozho)
Case Solution</a>

------
ChuckMcM
Isn't this like totally giving away the Enquirer's[1] secrets? I enjoyed the
discussion too. Next up, deriving a set of makeup (cosmetics) steps that need
to happen to have your face recognized as some other persons face.

[1] a gossip newspaper which often (always?) has dubious photographic evidence
backing up their claims.

------
eigenbom
Neil deGrasse Tyson with Peter Serafinowicz face:
[https://youtu.be/gr4gIK7Bv3E](https://youtu.be/gr4gIK7Bv3E)

Had fun over the weekend playing with this system. :)

------
taejo
The result doesn't look like Ed Milliband, though...

~~~
thomasfoster96
Well, it looks something between Milliband and Voldemort...

------
aswanson
This is awesome. How long did it take to develop?

------
saysfaceoff
FACE/OFF:
[http://www.imdb.com/title/tt0119094/](http://www.imdb.com/title/tt0119094/)

