Class Ansel_Faces

Description

Face recognition class

$Horde: ansel/lib/Faces.php,v 1.18.2.7 2009/09/29 14:58:11 mrubinsk Exp $

Located in /lib/Faces.php (line 10)


	
			
Direct descendents
Class Description
 class Ansel_Faces_facedetect Face_detect implementation
 class Ansel_Faces_opencv OpenCV implementation
Method Summary
 static void delete ( &$image, [integer $face = null], Ansel_Image $image)
 static void getExtension ()
 static void getFaceTile ( $face)
 static string getLink (array $face)
 static void getVFSPath (integer $image)
 void allFaces ([integer $from = 0], [integer $count = 0])
 void autogenerate ([string $driver = null])
 void countAllFaces ()
 void countNamedFaces ()
 void countOwnerFaces (string $owner)
 void countSearchFaces (string $name)
 mixed createView (integer $face_id,  &$image, integer $x1, integer $y1, integer $x2, integer $y2, integer $image)
 void factory ([ $driver = null], [ $params = array()])
 void getFaceById (integer $face_id, [boolean $full = false])
 mixed getFaceImageObject (integer $face_id)
 mixed getFaces ( &$image, mixed $image)
 string getFaceUrl (integer $image_id, integer $face_id, [boolean $full = false])
 array getFromGallery (integer $gallery_id, [boolen $create = false], [boolen $force = false])
 array getFromPicture ( &$image, [boolen $create = false], mixed $image)
 mixed getGalleryFaces (integer $gallery)
 mixed getImageFacesData (integer $image_id, [boolean $full = false])
 binary getSignatureFromFile (integer $filename)
 binary getSignatureMatches (binary $signature, [ $face_id = 0], [integer $from = 0], [integer $count = 0])
 void namedFaces ([integer $from = 0], [integer $count = 0])
 void ownerFaces (string $owner, [integer $from = 0], [integer $count = 0])
 array saveCustomFace (integer $face_id, integer $image, integer $x1, integer $y1, integer $x2, integer $y2, [string $name = ''])
 mixed saveSignature (integer $image_id, integer $face_id)
 void searchFaces (string $name, [integer $from = 0], [integer $count = 0])
 void setName (integer $face, string $name)
 void &singleton ()
 boolean viewExists (integer $image_id, integer $face_id, [boolean $create = true])
 void _countFaces (array $info)
 mixed _fetchFaces (array $info, [integer $from = 0], [integer $count = 0])
 void _getFaces (string $file)
 void _getSignatureMatches (array $a, array $b)
Methods
static delete (line 879)

Delete faces from VFS and DB storage.

static void delete ( &$image, [integer $face = null], Ansel_Image $image)
  • Ansel_Image $image: Image object to delete faces for
  • integer $face: Face id
  • &$image
static getExtension (line 509)

Get filename extension

static void getExtension ()
static getFaceTile (line 1090)

Output HTML for this face's tile

static void getFaceTile ( $face)
  • $face
static getLink (line 941)

Get face link. Points to the image that this face is from.

  • return: The url for the image this face belongs to.
static string getLink (array $face)
  • array $face: Face data
static getVFSPath (line 499)

Get image path

static void getVFSPath (integer $image)
  • integer $image: Image ID to get
allFaces (line 285)

Get all faces

Note: I removed the 'random' parameter since it won't work across different RDBMS and it's incredibly resource intensive as it causes the RDBMS to generate a rand() number for each row and THEN sort the table by those numbers.

void allFaces ([integer $from = 0], [integer $count = 0])
  • integer $from: Offset
  • integer $count: Limit
autogenerate (line 62)

Tell if the driver can auto generate faces

void autogenerate ([string $driver = null])
  • string $driver: Driver name
countAllFaces (line 354)

Count all faces

void countAllFaces ()
countNamedFaces (line 362)

Get named faces

void countNamedFaces ()
countOwnerFaces (line 341)

Get faces owned by owner

void countOwnerFaces (string $owner)
  • string $owner: User
countSearchFaces (line 373)

Seach faces for a name

void countSearchFaces (string $name)
  • string $name: Search string
createView (line 724)

Create a face image from the given data.

  • return: the face id or PEAR_Error on failure.
mixed createView (integer $face_id,  &$image, integer $x1, integer $y1, integer $x2, integer $y2, integer $image)
  • integer $face_id: Face id to generate
  • integer $image: Image face belongs to
  • integer $x1: The top left corner of the cropped image.
  • integer $y1: The top right corner of the cropped image.
  • integer $x2: The bottom left corner of the cropped image.
  • integer $y2: The bottom right corner of the cropped image.
  • &$image
factory (line 29)

Create instance

void factory ([ $driver = null], [ $params = array()])
  • $driver
  • $params
getFaceById (line 955)

Get face data

void getFaceById (integer $face_id, [boolean $full = false])
  • integer $face_id: Face id
  • boolean $full: Retreive full face data?
getFaceImageObject (line 436)

Get a Horde_Image object representing the requested face.

  • return: The requeste Horde_Image object || PEAR_Error
mixed getFaceImageObject (integer $face_id)
  • integer $face_id: The requested face_id
getFaces (line 91)

Get all the coordinates for faces in an image.

  • return: Array of face data || PEAR_Error
mixed getFaces ( &$image, mixed $image)
  • mixed $image: The Ansel_Image or a path to the image to check.
  • &$image
getFaceUrl (line 473)

Get a URL for a face image suitable for using as the src attribute in an image tag.

  • return: The URL for the face image suitable for use as the src attribute in an <img> tag.
string getFaceUrl (integer $image_id, integer $face_id, [boolean $full = false])
  • integer $image_id: Image ID to get url for
  • integer $face_id: Face ID to get url for
  • boolean $full: Should we generate a full URL?
getFromGallery (line 841)

Get faces for all images in a gallery

  • return: Faces found
array getFromGallery (integer $gallery_id, [boolen $create = false], [boolen $force = false])
  • integer $gallery_id: The share_id/gallery_id of the gallery to check.
  • boolen $create: Create faces and signatures or just store coordniates?
  • boolen $force: Force recreation even if image has faces
getFromPicture (line 625)

Look for and save faces in a picture, and optionally create the face image.

  • return: Faces found
array getFromPicture ( &$image, [boolen $create = false], mixed $image)
  • mixed $image: Image Object/ID to check
  • boolen $create: Create images or store data?
  • &$image
getGalleryFaces (line 186)

Get existing faces data for an entire gallery.

  • return: array of faces data || PEAR_Error
mixed getGalleryFaces (integer $gallery)
  • integer $gallery: gallery_id to get data for.\
getImageFacesData (line 140)

Get existing faces data from storage for the given image.

Used if we need to build the face image at some point after it is detected.

  • return: Array of faces data || PEAR_Error
mixed getImageFacesData (integer $image_id, [boolean $full = false])
  • integer $image_id: The image_id of the Ansel_Image these faces are for.
  • boolean $full: Get full face data or just face_id and face_name.
getSignatureFromFile (line 820)

Get an image signature from an arbitrary file. Currently used when searching for faces that appear in a user-supplied image.

  • return: vector signature
binary getSignatureFromFile (integer $filename)
  • integer $filename: Image filename to check
getSignatureMatches (line 1020)

Get possible matches from sql index

  • return: vector signature
binary getSignatureMatches (binary $signature, [ $face_id = 0], [integer $from = 0], [integer $count = 0])
  • binary $signature: Image signature
  • integer $from: Offset
  • integer $count: Limit
  • $face_id
namedFaces (line 297)

Get named faces

void namedFaces ([integer $from = 0], [integer $count = 0])
  • integer $from: Offset
  • integer $count: Limit
ownerFaces (line 310)

Get faces owned by user

void ownerFaces (string $owner, [integer $from = 0], [integer $count = 0])
  • string $owner: User
  • integer $from: Offset
  • integer $count: Limit
saveCustomFace (line 532)

Associates a given rectangle with the given image and creates the face image. Used for setting a face range explicitly.

  • return: Faces found
array saveCustomFace (integer $face_id, integer $image, integer $x1, integer $y1, integer $x2, integer $y2, [string $name = ''])
  • integer $face_id: Face id to save
  • integer $image: Image face belongs to
  • integer $x1: The top left corner of the cropped image.
  • integer $y1: The top right corner of the cropped image.
  • integer $x2: The bottom left corner of the cropped image.
  • integer $y2: The bottom right corner of the cropped image.
  • string $name: Face name
saveSignature (line 756)

Get get face signature from an existing face image.

  • return: True || PEAR_Error
mixed saveSignature (integer $image_id, integer $face_id)
  • integer $image_id: Image ID face belongs to
  • integer $face_id: Face ID to check
searchFaces (line 330)

Seach faces for a name

void searchFaces (string $name, [integer $from = 0], [integer $count = 0])
  • string $name: Search string
  • integer $from: Offset
  • integer $count: Limit
setName (line 919)

Set face name

void setName (integer $face, string $name)
  • integer $face: Face id
  • string $name: Face name
singleton (line 15)

Attempts to return a reference to a concrete Ansel_Faces instance.

void &singleton ()
viewExists (line 396)

Checks to see that a given face image exists in the VFS.

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.

  • return: True if image exists at end of function call, false otherwise.
boolean viewExists (integer $image_id, integer $face_id, [boolean $create = true])
  • integer $image_id: The image_id the face belongs to.
  • integer $face_id: The face_id we are checking for.
  • boolean $create: Automatically create the image if it is not found.
_countFaces (line 260)

Count faces

void _countFaces (array $info)
  • array $info: Array of select criteria
_fetchFaces (line 219)

Fetchs all faces from all galleries the current user has READ access to?

  • return: An array of faces data || PEAR_Error
mixed _fetchFaces (array $info, [integer $from = 0], [integer $count = 0])
  • array $info: Array of select criteria
  • integer $from: Offset
  • integer $count: Limit
_getFaces (line 79)

Get faces

  • abstract:
void _getFaces (string $file)
  • string $file: Picture filename

Redefined in descendants as:
_getSignatureMatches (line 1081)

Compare faces by similarity.

void _getSignatureMatches (array $a, array $b)
  • array $a
  • array $b

Documentation generated on Sun, 30 Jan 2011 05:08:46 +0000 by phpDocumentor 1.4.3