Ansel_Faces_Base::getFaces PHP Метод

getFaces() публичный Метод

Get all the coordinates for faces in an image.
public getFaces ( Ansel_Image $image ) : mixed
$image Ansel_Image The Ansel_Image or a path to the image to check.
Результат mixed Array of face data
    public function getFaces(Ansel_Image $image)
    {
        if ($image instanceof Ansel_Image) {
            // First check if screen view exists
            $image->load('screen');
            // Make sure we have an on-disk copy of the file.
            $file = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Vfs')->create('images')->readFile($image->getVFSPath('screen'), $image->getVFSName('screen'));
        } else {
            $file = $image;
        }
        if (empty($file)) {
            return array();
        }
        // Get faces from driver
        $faces = $this->_getFaces($file);
        if (empty($faces)) {
            return array();
        }
        // Remove faces containg faces
        // for example when 2 are together we can have 3 faces
        foreach ($faces as $face) {
            $id = $this->_isInFace($face, $faces);
            if ($id !== false) {
                unset($faces[$id]);
            }
        }
        return $faces;
    }