-
Notifications
You must be signed in to change notification settings - Fork 0
Detection algorithms
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.
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 uses OpenCV to detect faces. OpenCV returns the rectangle coordinates for the faces it identifies. Thumbor supports changing the file that OpenCV uses for identifying faces. Below is a comparison of three different algorithms:
original.png facial_detection_1.png facial_detection_2.png facial_detection_3.png
After retrieving these squares from OpenCV, thumbor calculates the center of mass of the image using weighted average.
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:
Faces at 10, 10 - 150, 100 - 300, 300
In order to find the center of mass for all the faces, we must first find the center of each square and