PHP sharpness convolution martix

血红的双手。 提交于 2019-12-06 08:06:26

问题


I'm using a convolution matrix for sharpness in PHP GD and I want to change the sharpness "level".

Where would I make changes to this if I want to make it more or less sharp?

$image = imagecreatefromjpeg('pic.jpg');

$matrix = array(
  array(0, -1, 0), 
  array(-1, 5, -1), 
  array(0, -1, 0)
);

imageconvolution($image, $matrix, 1, 0.001);
header("Content-type: image/jpeg");
imagejpeg($image);

回答1:


try looking on http://www.gamedev.net/reference/programming/features/imageproc/page2.asp

There are lots of examples on the web, but as a rule of thumb you may try these params first in GIMP or PS or any other editor that has this function (image convolution is pretty common)




回答2:


What you really needed to do was use this formula

Where k = sharpness level.



来源:https://stackoverflow.com/questions/3588607/php-sharpness-convolution-martix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!