CropFace

Extends \stojg\crop\CropEntropy

CropFace

This class will try to find the most interesting point in the image by trying to find a face and center the crop on that

todo

implement

see

Methods

__construct

__construct(string $imagePath) 

Arguments

$imagePath

string

getFaceList get faces positions and sizes

getFaceList() : array
access

protected

Response

array

getFaceListFromClassifier

getFaceListFromClassifier(string $classifier) : array
access

protected

Arguments

$classifier

string

Response

array

getSafeZoneList

getSafeZoneList() : array
access

private

Response

array

get special offset for class

getSpecialOffset(\Imagick $original, int $targetWidth, int $targetHeight) : array
inherited

Arguments

$original

\Imagick

$targetWidth

int

$targetHeight

int

Response

array

Get the topleftX and topleftY that will can be passed to a cropping method.

getEntropyOffsets(\Imagick $original, int $targetWidth, int $targetHeight) : array
inherited

Arguments

$original

\Imagick

$targetWidth

int

$targetHeight

int

Response

array

Get the offset of where the crop should start

getOffsetFromEntropy(\Imagick $originalImage, $targetWidth, int $targetHeight) : array
inherited

Arguments

$originalImage

\Imagick

$targetWidth

$targetHeight

int

Response

array

slice

slice(mixed $image, mixed $originalSize, mixed $targetSize, mixed $axis) : void
inherited
access

protected

Arguments

$image

mixed

$originalSize

mixed

$targetSize

mixed

$axis

mixed

h=horizontal, v = vertical

getLimit get image limit. Used to set "uncropable" limit

getLimit(string $position, int $offset) : int|null
inherited
access

protected

Arguments

$position

string

(top|bottom|left|right)

$offset

int

Response

int|null

Calculate the entropy for this image.

grayscaleEntropy(\Imagick $image) : float
inherited

A higher value of entropy means more noise / liveliness / color / business

see

Arguments

$image

\Imagick

Response

float

Find out the entropy for a color image

colorEntropy(\Imagick $image) : float
inherited

If the source image is in color we need to transform RGB into a grayscale image so we can calculate the entropy more performant.

Arguments

$image

\Imagick

Response

float

Constants

CLASSIFIER_FACE

CLASSIFIER_FACE

CLASSIFIER_PROFILE

CLASSIFIER_PROFILE

Properties

imagePath original image path

imagePath
var
access

protected

safeZoneList

safeZoneList
var
access

protected