PHP Класс Ansel_Faces_Base, horde

Copyright 2007-2016 Horde LLC (http://www.horde.org/) See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.horde.org/licenses/gpl.
Автор: Duck ([email protected])
Показать файл Открыть проект

Открытые методы

Метод Описание
allFaces ( integer $from, integer $count ) : array Get all faces
canAutogenerate ( )
countAllFaces ( ) Count all faces
countNamedFaces ( ) Get named faces
countOwnerFaces ( string $owner ) Get faces owned by owner
countSearchFaces ( string $name ) Seach faces for a name
createView ( integer $face_id, Ansel_Image $image, integer $x1, integer $y1, integer $x2, integer $y2 ) Create a face image from the given data.
getFaceById ( integer $face_id, boolean $full = false ) : array Get face data
getFaceImageObject ( integer $face_id ) : Horde_Image Get a Horde_Image object representing the requested face.
getFaceUrl ( integer $image_id, integer $face_id, boolean $full = false ) : string Get a URL for a face image suitable for using as the src attribute in an image tag.
getFaces ( Ansel_Image $image ) : mixed Get all the coordinates for faces in an image.
getFromGallery ( integer $gallery_id, boolen $create = false, boolen $force = false ) : array Get faces for all images in a gallery
getFromPicture ( mixed $image, boolen $create = false ) : array Look for and save faces in a picture, and optionally create the face image.
getGalleryFaces ( integer $gallery_id ) : array Get existing faces data for an entire gallery.
getImageFacesData ( integer $image_id, boolean $full = false ) : array Get existing faces data from storage for the given image.
getSignatureFromFile ( integer $filename ) : binary Get an image signature from an arbitrary file. Currently used when searching for faces that appear in a user-supplied image.
getSignatureMatches ( binary $signature, $face_id, integer $from, integer $count ) : binary Get possible matches from sql index
namedFaces ( integer $from, integer $count ) : array Get named faces
ownerFaces ( string $owner, integer $from, integer $count ) : array Get faces owned by user
saveCustomFace ( integer $face_id, integer $image_id, integer $x1, integer $y1, integer $x2, integer $y2, string $name = '' ) : array Associates a given rectangle with the given image and creates the face image. Used for setting a face range explicitly.
saveSignature ( integer $image_id, integer $face_id ) Get face signature from an existing face image.
searchFaces ( string $name, integer $from, integer $count ) Seach faces for a name
setName ( integer $face, string $name ) Set face name
viewExists ( integer $image_id, integer $face_id, boolean $create = true ) : boolean Checks to see that a given face image exists in the VFS.

Защищенные методы

Метод Описание
_countFaces ( array $info ) : integer Count faces
_fetchFaces ( array $info, integer $from, integer $count ) : mixed Fetchs all faces from all galleries the current user has READ access to
_getFaces ( string $file ) Get faces
_getParamsArray ( $image, $rect )
_getSignatureMatches ( array $a, array $b ) Compare faces by similarity.

Описание методов

_countFaces() защищенный Метод

Count faces
protected _countFaces ( array $info ) : integer
$info array Array of select criteria
Результат integer The count of faces

_fetchFaces() защищенный Метод

Fetchs all faces from all galleries the current user has READ access to
protected _fetchFaces ( array $info, integer $from, integer $count ) : mixed
$info array Array of select criteria
$from integer Offset
$count integer Limit
Результат mixed An array of face hashes containing face_id, gallery_id, image_id, face_name.

_getFaces() защищенный Метод

Get faces
protected _getFaces ( string $file )
$file string Picture filename

_getParamsArray() защищенный Метод

protected _getParamsArray ( $image, $rect )

_getSignatureMatches() защищенный Метод

Compare faces by similarity.
protected _getSignatureMatches ( array $a, array $b )
$a array
$b array

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

Get all faces
public allFaces ( integer $from, integer $count ) : array
$from integer Offset
$count integer Limit
Результат array Array of face hashes.

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

public canAutogenerate ( )

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

Count all faces
public countAllFaces ( )

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

Get named faces
public countNamedFaces ( )

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

Get faces owned by owner
public countOwnerFaces ( string $owner )
$owner string User

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

Seach faces for a name
public countSearchFaces ( string $name )
$name string Search string

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

Create a face image from the given data.
public createView ( integer $face_id, Ansel_Image $image, integer $x1, integer $y1, integer $x2, integer $y2 )
$face_id integer Face id to generate
$image Ansel_Image Image face belongs to
$x1 integer The top left corner of the cropped image.
$y1 integer The top right corner of the cropped image.
$x2 integer The bottom left corner of the cropped image.
$y2 integer The bottom right corner of the cropped image.

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

Get face data
public getFaceById ( integer $face_id, boolean $full = false ) : array
$face_id integer Face id
$full boolean Retreive full face data?
Результат array A face information hash

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

Get a Horde_Image object representing the requested face.
public getFaceImageObject ( integer $face_id ) : Horde_Image
$face_id integer The requested face_id
Результат Horde_Image The requested Horde_Image object

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

Get a URL for a face image suitable for using as the src attribute in an image tag.
public getFaceUrl ( integer $image_id, integer $face_id, boolean $full = false ) : string
$image_id integer Image ID to get url for
$face_id integer Face ID to get url for
$full boolean Should we generate a full URL?
Результат string The URL for the face image suitable for use as the src attribute in an tag.

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

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

Get faces for all images in a gallery
public getFromGallery ( integer $gallery_id, boolen $create = false, boolen $force = false ) : array
$gallery_id integer The share_id/gallery_id of the gallery to check.
$create boolen Create faces and signatures or just store coordniates?
$force boolen Force recreation even if image has faces
Результат array Faces found

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

Look for and save faces in a picture, and optionally create the face image.
public getFromPicture ( mixed $image, boolen $create = false ) : array
$image mixed Image Object/ID to check
$create boolen Create images or store data?
Результат array Faces found

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

Get existing faces data for an entire gallery.
public getGalleryFaces ( integer $gallery_id ) : array
$gallery_id integer gallery_id to get data for.
Результат array An array of faces data.

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

Used if we need to build the face image at some point after it is detected.
public getImageFacesData ( integer $image_id, boolean $full = false ) : array
$image_id integer The image_id of the Ansel_Image these faces are for.
$full boolean Get full face data or just face_id and face_name.
Результат array An array of faces data.

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

Get an image signature from an arbitrary file. Currently used when searching for faces that appear in a user-supplied image.
public getSignatureFromFile ( integer $filename ) : binary
$filename integer Image filename to check
Результат binary vector signature

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

Get possible matches from sql index
public getSignatureMatches ( binary $signature, $face_id, integer $from, integer $count ) : binary
$signature binary Image signature
$from integer Offset
$count integer Limit
Результат binary vector signature

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

Get named faces
public namedFaces ( integer $from, integer $count ) : array
$from integer Offset
$count integer Limit
Результат array An array of face hashes

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

Get faces owned by user
public ownerFaces ( string $owner, integer $from, integer $count ) : array
$owner string User
$from integer Offset
$count integer Limit
Результат array An array of face hashes.

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

Associates a given rectangle with the given image and creates the face image. Used for setting a face range explicitly.
public saveCustomFace ( integer $face_id, integer $image_id, integer $x1, integer $y1, integer $x2, integer $y2, string $name = '' ) : array
$face_id integer Face id to save
$image_id integer Image face belongs to
$x1 integer The top left corner of the cropped image.
$y1 integer The top right corner of the cropped image.
$x2 integer The bottom left corner of the cropped image.
$y2 integer The bottom right corner of the cropped image.
$name string Face name
Результат array Faces found

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

Get face signature from an existing face image.
public saveSignature ( integer $image_id, integer $face_id )
$image_id integer Image ID face belongs to
$face_id integer Face ID to check

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

Seach faces for a name
public searchFaces ( string $name, integer $from, integer $count )
$name string Search string
$from integer Offset
$count integer Limit

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

Set face name
public setName ( integer $face, string $name )
$face integer Face id
$name string Face name

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

If $create is true, the image is created if it does not exist. Otherwise false is returned if the image does not exist. True is returned both if the image already existed OR if it did not exist, but was successfully created.
public viewExists ( integer $image_id, integer $face_id, boolean $create = true ) : boolean
$image_id integer The image_id the face belongs to.
$face_id integer The face_id we are checking for.
$create boolean Automatically create the image if it is not found.
Результат boolean True if image exists at end of function call, false otherwise.