探测算法

If the smart mode of thumbor has been specified in the uri (by the /smart portion of it), thumbor will use it's smart detectors to find focal points.

如果在uri中指定了thumbor的智能模式(通过/smart部分),thumbor将使用它的智能检测器来寻找焦点。

thumbor comes pre-packaged with two focal-point detection algorithms: facial and feature. First it tries to identify faces and if it can't find any, it tries to identify features (more on that below).

thumbor预装了两种焦点检测算法:面部和特征。首先,它试图识别人脸,如果找不到,它就试图识别特征(下面会有更多介绍)。

Facial Detection

面部检测

For instructions on how to get facial detection coordinates see :ref:`usage-metadata-endpoint` .

关于如何获得面部检测坐标的说明,见:ref:`usage-metadata-endpoint`

Note

注意事项

thumbor uses OpenCV (http://opencv.org) to detect faces. OpenCV returns the rectangle coordinates for the faces it identifies. You can specify the HAAR file Thumbor should use for identification.

thumbor使用OpenCV(http://opencv.org)来检测人脸。OpenCV返回它所识别的面孔的矩形坐标。你可以指定Thumbor应该使用的HAAR文件进行识别。

Original image

原始图像

Original image

Image after detection

检测后的图像

Notice how red rectangles show the areas identified as faces:

注意红色的矩形显示了被确定为面的区域。

Red rectangles are the areas identified as faces

After retrieving these squares from OpenCV, thumbor calculates the center of mass of the image using weighted average.

从OpenCV检索到这些方块后,thumbor使用加权平均法计算图像的质心

Consider that OpenCV returned 3 squares at (10, 10, 100, 100), (150, 100, 100, 100), (300, 300, 80, 50), being (x, y, width, height), as such:

考虑到OpenCV在(10,10,100,100)(150,100,100)(300,300,80,50)处返回3个正方形,是(x,y,宽度,高度),如是。

Faces at 10x10, 150x100, 300x300

In order to find the center of mass for all the faces, we must first find the center and weight of each rectangle. We define weight in this scenario as the area of the rectangle.

为了找到所有面的质量中心,我们必须首先找到每个矩形的中心和重量。我们在这个方案中把重量定义为矩形的面积。

So, for the faces in our example (*x*,*y* being the coordinates of the rectangle's center and *z* the rectangle weight):

因此,对于我们例子中的面(*x*,*y*是矩形中心的坐标,*z*是矩形的重量)。

Face 1:

脸部1

  • x = (10 + 100) \div 2 = 55
  • x = (10 + 100)div 2 = 55
  • y = (10 + 100) \div 2 = 55
  • y = (10 + 100)div 2 = 55
  • z = 100 * 100 = 10000
  • z = 100 * 100 = 10000

Face 2:

脸 2:

  • x = (150 + 100) \div 2 = 125
  • x = (150 + 1...
开通本站会员,查看完整译文。

- 위키
Copyright © 2011-2024 iteam. Current version is 2.137.1. UTC+08:00, 2024-11-08 22:52
浙ICP备14020137号-1 $방문자$