略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Imagick::segmentImage

2024-04-28

Imagick::segmentImage

(PECL imagick 2 >= 2.3.0, PECL imagick 3)

Imagick::segmentImageSegments an image

说明

public Imagick::segmentImage(
    int $COLORSPACE,
    float $cluster_threshold,
    float $smooth_threshold,
    bool $verbose = false
): bool

Analyses the image and identifies units that are similar. 此方法在Imagick基于ImageMagick 6.4.5以上版本编译时可用。

参数

COLORSPACE

One of the COLORSPACE constants.

cluster_threshold

A percentage describing minimum number of pixels contained in hexedra before it is considered valid.

smooth_threshold

Eliminates noise from the histogram.

verbose

Whether to output detailed information about recognised classes.

返回值

范例

示例 #1 Imagick::segmentImage()

<?php
function segmentImage($imagePath$colorSpace$clusterThreshold$smoothThreshold) {
    
$imagick = new \Imagick(realpath($imagePath));
    
$imagick->segmentImage($colorSpace$clusterThreshold$smoothThreshold);
    
header("Content-Type: image/jpg");
    echo 
$imagick->getImageBlob();
}

segmentImage($imagePath, \Imagick::COLORSPACE_RGB55);

?>
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/imagick.segmentimage.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3