public function score($output, $crop)
    {
        $result = [
            'detail' => 0,
            'saturation' => 0,
            'skin' => 0,
            'boost' => 0,
            'total' => 0
        ];

        $downSample = $this->options ['scoreDownSample'];
        $invDownSample = 1 / $downSample;
        $outputHeightDownSample = floor($this->h / $downSample) * $downSample;
        $outputWidthDownSample = floor($this->w / $downSample) * $downSample;
        $outputWidth = floor($this->w / $downSample);

        for ($y = 0; $y < $outputHeightDownSample; $y += $downSample)
        {
            for ($x = 0; $x < $outputWidthDownSample; $x += $downSample)
            {
                $i = $this->importance($crop, $x, $y);
                $p = floor($y / $downSample) * $outputWidth * 4 + floor($x / $downSample) * 4;
                $detail = $output [$p + 1] / 255;

                $result ['skin'] += $output [$p] / 255 * ($detail + $this->options ['skinBias']) * $i;
                $result ['saturation'] += $output [$p + 2] / 255 * ($detail + $this->options ['saturationBias']) * $i;
                $result ['detail'] = $p;
            }
        }

        $result ['total'] = ($result ['detail'] * $this->options ['detailWeight'] + $result ['skin'] * $this->options ['skinWeight'] + $result ['saturation'] * $this->options ['saturationWeight'] + $result ['boost'] * $this->options ['boostWeight']) / ($crop ['width'] * $crop ['height']);

        return $result;
    }
public function score($output, $crop)
    {
        $result = [
            'detail' => 0,
            'saturation' => 0,
            'skin' => 0,
            'boost' => 0,
            'total' => 0
        ];

        $downSample = $this->options ['scoreDownSample'];
        $invDownSample = 1 / $downSample;
        $outputHeightDownSample = floor($this->h / $downSample) * $downSample;
        $outputWidthDownSample = floor($this->w / $downSample) * $downSample;
        $outputWidth = floor($this->w / $downSample);

        for ($y = 0; $y < $outputHeightDownSample; $y += $downSample)
        {
            for ($x = 0; $x < $outputWidthDownSample; $x += $downSample)
            {
                $i = $this->importance($crop, $x, $y);
                $p = floor($y / $downSample) * $outputWidth * 4 + floor($x / $downSample) * 4;
                $detail = $output [$p + 1] / 255;

                $result ['skin'] += $output [$p] / 255 * ($detail + $this->options ['skinBias']) * $i;
                $result ['saturation'] += $output [$p + 2] / 255 * ($detail + $this->options ['saturationBias']) * $i;
                $result ['detail'] = $p;
            }
        }

        $result ['total'] = ($result ['detail'] * $this->options ['detailWeight'] + $result ['skin'] * $this->options ['skinWeight'] + $result ['saturation'] * $this->options ['saturationWeight'] + $result ['boost'] * $this->options ['boostWeight']) / ($crop ['width'] * $crop ['height']);

        return $result;
    }
public function score ( $ output , $ crop ) { $ result = [ 'detail' => 0 , 'saturation' => 0 , 'skin' => 0 , 'boost' => 0 , 'total' => 0 ] ; $ downSample = $ this -> options [ 'scoreDownSample' ] ; $ invDownSample = 1 / $ downSample ; $ outputHeightDownSample = floor ( $ this -> h / $ downSample ) * $ downSample ; $ outputWidthDownSample = floor ( $ this -> w / $ downSample ) * $ downSample ; $ outputWidth = floor ( $ this -> w / $ downSample ) ; for ( $ y = 0 ; $ y < $ outputHeightDownSample ; $ y += $ downSample ) { for ( $ x = 0 ; $ x < $ outputWidthDownSample ; $ x += $ downSample ) { $ i = $ this -> importance ( $ crop , $ x , $ y ) ; $ p = floor ( $ y / $ downSample ) * $ outputWidth * 4 + floor ( $ x / $ downSample ) * 4 ; $ detail = $ output [ $ p + 1 ] / 255 ; $ result [ 'skin' ] += $ output [ $ p ] / 255 * ( $ detail + $ this -> options [ 'skinBias' ] ) * $ i ; $ result [ 'saturation' ] += $ output [ $ p + 2 ] / 255 * ( $ detail + $ this -> options [ 'saturationBias' ] ) * $ i ; $ result [ 'detail' ] = $ p ; } } $ result [ 'total' ] = ( $ result [ 'detail' ] * $ this -> options [ 'detailWeight' ] + $ result [ 'skin' ] * $ this -> options [ 'skinWeight' ] + $ result [ 'saturation' ] * $ this -> options [ 'saturationWeight' ] + $ result [ 'boost' ] * $ this -> options [ 'boostWeight' ] ) / ( $ crop [ 'width' ] * $ crop [ 'height' ] ) ; return $ result ; }
Score a crop scheme

@param array $output
@param array $crop
@return array
Score a crop scheme