
Chinese: 
Joe: 嗨，Joss，我想问你一个问题：你知道 Snapchat 里的表情挂件是怎么操作的吗？
就是背后有什么原理吗
Joss：嗯，我不知道
Joe：那你觉得你去查查吗？
Joss：好啊！
这些就是 Snapchat 里的他们叫做透镜的东西，但是大家都叫它表情挂件
它们看上去蠢呼呼的，但是背后的技术很高深
Joss：哦天呐
这一技术来源于乌克兰的一家叫 Looksery 的初创公司
Snapchat 在 2015 年花费 15 亿美元收购了这家公司
这也是乌克兰有史以来所记录下的最大金额的科技收购的交易
他们的增强现实挂件
和新兴的计算机视觉领域很对口
就是用摄像头获取的像素信息识别物体，并勾勒出 3D 特征的应用程序

English: 
JOE: Hey Joss, I have a question for you. Do you know how these Snapchat filters work?
like behind the scenes?
JOSS: Hmm, I have no idea.
JOE: Well do you think you can find out?
JOSS: You got it!
These are what Snapchat calls their
lenses, but everyone else calls filters.
They are very silly but the engineering
behind them is serious.
JOSS: Oh my god.
The technology came from a Ukrainian startup called Looksery
which Snapchat acquired in
September 2015 for a $150 million dollars.
That's reportedly the
largest tech acquisition in Ukrainian history.
Their augmented reality filters tap into the large and rapidly
growing field of "computer vision" --
those are applications that use pixel
data from a camera in order to identify

Chinese: 
计算机视觉就是你的手机用来识别并储存支票信息的技术
 
它让 Facebook 识别你的照片中的头像，她帮助无人驾驶汽车避免撞人，
也可以让你给自己的照片一个狗鼻子
那 Snapchat 的挂件是怎样操作的？
我们不能直接询问 Looksery 的工程师，但他们的专利是在网上公开的
第一步是检索识别
计算机是怎样知道图片中的哪一部分是一张脸呢？
这就是人类的大脑出色的地方
甚至可以说是卓越的地方
对于电脑来说，一张照片是这样的
如果你只有一些像素点的颜色值，你怎样判断哪一部分是脸部呢？
关键就在于把划定的区域进行对比，分析图像中的明暗区域
最早的脸部识别工具叫做
Viola-Jones 算法
它的原理是通过对图片信息反复的检索和计算
来识别出图片中黑色区和白色区的不同的灰度差异

English: 
objects and interpret 3D space. Computer
vision is how you can deposit checks,
with your phone,
it's how Facebook knows who's in your
photos, how self-driving cars can avoid
running over people and how you can give
yourself a doggy nose.
So how to snapchat filters work? They
wouldn't let us talk to any of the Looksery
engineers but their patents are
online.
The first step is detection. How does the
computer know which part of an image is
a face?
This is something that human brains are
fantastic at. Too good even.
But this is what a photo looks like to a
computer. If all you have is the data for
the color value of each individual pixel,
how do you find a face?
Well the key is looking for areas of
contrast, between light and dark parts of
the image. The pioneering facial
detection tool is called the
Viola-Jones algorithm.
It works by repeatedly scanning through
the image data calculating the
difference between the grayscale pixel
values underneath the white boxes and

English: 
the black boxes. For instance, the bridge
of the nose is usually lighter than the
surrounding area on both sides,
the eye sockets are darker than the
forehead, and the middle of the forehead
is lighter than the size of it.
These are crude test for facial features,
but if they find enough matches in one
area of the image,
it concludes that there is a face there.
This kind of algorithm won't find your
face if you're really tilted or facing
sideways, but they're really accurate for
frontal faces, and it's how digital cameras have been putting boxes around
faces for years. But in order to apply
this virtual lipstick, the app needs to
do more than just detect my face.
It has to locate my facial features.
According to the patents. It does this
with an “active shape model” -- a statistical
model of a face shape that's been
trained by people manually marking the
borders of facial features on hundreds,
sometimes thousands of sample images.
The algorithm takes an average face from
that trained data and aligns it with the
image from your phone's camera, scaling
it and rotating it according to where it
already knows your face is located.

Chinese: 
比如，鼻梁一般比鼻子两侧的皮肤显得更亮一些
眼窝比额头颜色更深
额头的中部比其余部分颜色更亮
这些都是针对脸部特征粗略的判断
如果有足够的匹配信息
我们就可以判断出这里是一张脸
当你的脸部倾斜严重或者侧对镜头时，
这种算法可能不会准确地识别出你的脸
但它对正脸的识别非常精确
数码相机就是用这个技术找脸和画框
但是要把这种虚拟的口红涂好，
应用程序不但要找到我的脸
它还需要把我的五官定位
依据专利，它用了一种叫 “实时模型建立”的数学模型
先找人用手把成百上千张面部的特征的边界点标出来
先找人用手把成百上千张面部的特征的边界点标出来
这个算法分析和整理标注的数据，取其平均值，得到一张“平均面部特征图”
再将这张图和你手机拍摄的画面对比，通过缩放、旋转
与已经识别出的面部位置契合

English: 
But it's not a perfect fit so the model
analyzes the pixel data around each of
the points,
looking for edges defined by brightness
and darkness. From the training images,
the model has a template for what the
bottom of your lips should look like,
for example, so it looks for that pattern in
your image and adjust the point to match it.
Because some of these individual
guesses might be wrong,
the model can correct and smooth them by taking into account the locations of all
the other points. Once it locates your
facial features, those points are used as
coordinates to create a mesh.
That's a 3D mask that can move, rotate,
and scale along with your face as the
video data comes in for every frame and
once they've got that, they can do a lot with it.
They can deform the mask to change your face shape, change your eye color,
add accessories, and set animations to
trigger when you open your mouth
or move your eyebrows.
And like the IOS app Face Swap Live,
Snapchat can switch your face with a
friend's, although that involves a bunch
more data.

Chinese: 
但这一契合并不完美，所以模型会分析边界点周围的
像素信息
并寻找亮区和暗区之间的边界线
经过了大量的学习，模型已经明白你嘴唇的下沿大概会是什么样子
所以它会寻找图像中符合特征的区域，并调节特征点
因为单独的点位猜测可能会出错
所以模型会通过分析大量的点位来提高准确性
一旦你的脸部特征被确定
这些特征点就会被整合成一张面部网格
这是一个可以跟随你的面部移动、旋转、缩放的 3D 面具
一旦他们掌握了这些数据，他们就可以做很多东西
他们可以扭曲面具来改变你的脸形、眼睛颜色以及增添配件
还可以增加一些你张嘴或挑动眉毛
就能触发的动画
就像 IOS 的应用程序 Face Swap Live，
Snapchat 可以将你和你朋友的面部进行互换
不过这就需要更大量的面部数据了

English: 
The main components of this technology
are not new. What's new is the ability to
run them in real time, from a mobile
device. That level of processing speed is
a pretty recent development.
So why go through all this trouble just
to give people a virtual flower crown?
Well Snapchats sees a revenue
opportunity here. In a world that's
flooded with advertisements,
maybe the best hope that brands have to
get us to look at their ads... is to
put them on our faces.
Facial detection has a creepy side too,
particularly when it's used to identify
you by name.
Both the FBI and private companies like
Facebook and Google are massing huge
databases of faces and there's currently
no federal law regulating it.
So some privacy advocates have come up
with ways to camouflage your face from
facial detection algorithms.
It's actually illegal in a lot of places
to wear a face mask in public,
so this project by artist Adam Harvey
suggest some things that you can do with

Chinese: 
这个技术的主要成分没什么新意
而它创新的地方在于它能在手机上实时运行，能够达到这么快的数据处理速度
是一个突破
那为什么要花费这么大的精力给人们戴上一个虚拟的花环呢？
事实上，Snapchat 从中发现了一个赚钱的机会
在这个充斥着广告的世界里
品牌们引起我们注意的最佳方式
有可能就是把它们放在我们的脸上
面部识别技术同样也有让人毛骨悚然的一面
尤其是它被用来将你的姓名与脸部做配对
联邦调查局和一些私人公司，比如 Facebook 和 Google
都收集了大量的面部数据库，然而目前没有法律来限制这一行为
所以一些隐私保护的拥护者想出了一些办法来用伪装
来逃避面部识别算法的分析
但在很多公众场合，佩戴面具是不合法的
所以 Adam Harvey 推行的项目建议大家

English: 
your hair and your makeup that can, for
now, make your face Invisible to computers.

Chinese: 
通过修饰头发和化妆，使电脑暂时识别不到人的面部
