Imagick::adaptiveThresholdImage


wizard apg

SELECTS a threshold for each pixel based on a range of intensity in one image.



<?php

bool 
public Imagick::adaptiveThresholdImage(
                                                             
int $width, 
                                                             
int $height, 
                                                             
int $offset
                                                                         
);
                                                                         
?>

$width


The width of neighborhood.



$height


The height of neighborhood.



$offset


The mean offset.





This function returns a TRUE on success.



  1 EXERCISE   

<?php

// Run several times

$img1 = new Imagick();

$jpgfn = PATH2IMGW . '/png/E 01 01.png';
$str1img = 'img/results/E 01 01531.png';

$img1->readImage($jpgfn);

$width = mt_rand(0,10);
$height = mt_rand(0,100);

$offset = mt_rand(0, 125) / 100;

echo 
"adaptiveThresholdImage( $width, $height, $offset )<br>";

$img1->adaptiveThresholdImage($width,$height,$offset);

$strg = $img1->getImageBlob();

$img = imagecreatefromstring($strg);

imagepng($img, $str1img);

echo 
'<br>' . basename($str1img); ?>
<br><br>
<img src="<?php echo $str1img; ?>"
 alt="<?php echo $str1img; ?>" 
 title="<?php echo $str1img; ?>">

 RESULT   

adaptiveThresholdImage( 9, 32, 0.63 )

E 01 01531.png

img/results/E 01 01531.png apr