<em id="zd4wi"></em>
  • <label id="zd4wi"><fieldset id="zd4wi"></fieldset></label>
  • <thead id="zd4wi"><th id="zd4wi"><dl id="zd4wi"></dl></th></thead>

    Imagick::forwardFourierTransformImage

    (PECL imagick 3 >= 3.3.0)

    Imagick::forwardFourierTransformImageDescription

    說明

    public Imagick::forwardFourierTransformimage(bool $magnitude): bool

    Implements the discrete Fourier transform (DFT) of the image either as a magnitude / phase or real / imaginary image pair.

    參數(shù)

    magnitude

    If true, return as magnitude / phase pair otherwise a real / imaginary image pair.

    返回值

    成功時返回 true。

    范例

    示例 #1 Imagick::forwardFourierTransformImage()

    <?php
    //Utility function for forwardTransformImage
    function createMask() {
        
    $draw = new \ImagickDraw();

        
    $draw->setStrokeOpacity(0);
        
    $draw->setStrokeColor('rgb(255, 255, 255)');
        
    $draw->setFillColor('rgb(255, 255, 255)');

        
    //Draw a circle on the y-axis, with it's centre
        //at x, y that touches the origin
        
    $draw->circle(250250220250);

        
    $imagick = new \Imagick();
        
    $imagick->newImage(512512"black");
        
    $imagick->drawImage($draw);
        
    $imagick->gaussianBlurImage(2020);
        
    $imagick->autoLevelImage();

        return 
    $imagick;
    }


    function 
    forwardFourierTransformImage($imagePath) {
        
    $imagick = new \Imagick(realpath($imagePath));
        
    $imagick->resizeimage(512512, \Imagick::FILTER_LANCZOS1);

        
    $mask createMask();
        
    $imagick->forwardFourierTransformImage(true);

        @
    $imagick->setimageindex(0);
        
    $magnitude $imagick->getimage();

        @
    $imagick->setimageindex(1);
        
    $imagickPhase $imagick->getimage();

        if (
    true) {
            
    $imagickPhase->compositeImage($mask, \Imagick::COMPOSITE_MULTIPLY00);
        }

        if (
    false) {
            
    $output = clone $imagickPhase;
            
    $output->setimageformat('png');
            
    header("Content-Type: image/png");
            echo 
    $output->getImageBlob();
        }

        
    $magnitude->inverseFourierTransformImage($imagickPhasetrue);

        
    $magnitude->setimageformat('png');
        
    header("Content-Type: image/png");
        echo 
    $magnitude->getImageBlob();
    }

    ?>