gpt4 book ai didi

c - MagickWand C 的 MagickUnsharpMaskImage 方法是否存在错误?

转载 作者:太空宇宙 更新时间:2023-11-04 02:30:24 25 4
gpt4 key购买 nike

我有一个下面的 CLI,并尝试使用 magickwand c 获得相同的结果。一切似乎都很完美,或者不知道可能是我错过了什么,但 MagickUnsharpMaskImage 对我不起作用。检查我的源代码。我还附上了源代码和两个由 CLI 和 C API 生成的输出图像。

命令行

convert testsharp.jpg -unsharp 0x1 unsharpC.jpg

C代码

int main(int argc, char const *argv[]) {
MagickWand * wand;
wand = NewMagickWand();
MagickReadImage(wand, "testsharp.jpg");
MagickUnsharpMaskImage(wand, 0.0, 1.0, 0.0, 0.0);
MagickWriteImage(wand, "unsharpW.jpg");
return 0;
}

源图

enter image description here

使用 CLI 输出图像

enter image description here

使用C输出图像

enter image description here

ImageMagick 版本

版本:ImageMagick 7.0.5-5 Q16 x86_64 2017-05-23 http://www.imagemagick.org

最佳答案

来自 the man

MagickUnsharpMaskImage() sharpens an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and UnsharpMaskImage() selects a suitable radius for you.

强调我的

你称它为 radius=0 sigma=1.0

此外default value for those parameters are

  1. radius 高斯半径,以像素为单位,不包括中心像素(默认为 0)。
  2. sigma 高斯的标准偏差,以像素为单位 (默认 1.0)
  3. gain 原始图像与模糊图像之间的差异分数被添加回原始(默认 1.0)
  4. threshold 阈值是 QuantumRange 的一部分,需要应用差异量(默认 0.05)

正确 代码为

MagickUnsharpMaskImage(wand, 0.0, 1.0, 1.0, 0.05);

关于c - MagickWand C 的 MagickUnsharpMaskImage 方法是否存在错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44180384/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com