【问题标题】:Is there a way to do Shepard's distortion with Wand (latest Python binding to Image Magick)?有没有办法用 Wand(最新的 Python 绑定到 Image Magick)来进行 Shepard 的失真?
【发布时间】:2013-09-22 03:30:34
【问题描述】:

我想用 Python 做一些图像处理。我注意到 PIL 缺乏的一些高级算法,例如,Shepard's distortion,是由 Image Magick 提供的。

Image Magick 的最新 Python 绑定,推荐 here,是 Wand。 API 和文档确实是经过深思熟虑的。

但是,在浏览文档后,我发现可用的功能似乎非常有限(旋转、翻转、调整大小、裁剪等)。

有没有可能用 Wand 做类似 Shepard 的扭曲?我错过了什么吗?


编辑

总是可以fall backsubprocess 和 Image Magick 的命令行界面(用于单步操作)。

【问题讨论】:

  • 如果您愿意考虑其他库,scikit-image 包含通用变形功能:scikit-image.org/docs/dev/auto_examples/plot_swirl.html(您只需指定一个执行坐标转换的函数。)
  • 谢谢,@StefanvanderWalt。我正在寻找一个 Python 替代 Matlab 中的图像处理工具箱。 scikit-image 看起来很棒!不过,我发现 Image Magick 的基于控制点的方法非常简单。
  • 我们有所有的机器来做翘曲,我们只需要弄清楚确切的功能。如果您有兴趣,我很乐意帮助您实现此功能并将其包含在包中。
  • skimage.transform.warp() 确实非常方便!我已经学会了按照@StefanvanderWalt 链接的教程实现球化失真的功能。但是在图像边界处的 warp() 中似乎存在一个错误(在 github 中提交的问题)。

标签: python image-processing imagemagick wand


【解决方案1】:

好吧,这似乎很晚了, 无论如何,当前版本 0.6.6 允许使用 shepards 失真

 with Image.from_array(t) as face:
        face.artifacts['shepards:power'] = '1'
        face.distort('shepards', coordinates)
        self.image_output = cv2.cvtColor(np.array(face), cv2.COLOR_RGB2BGR)
        face.close()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-04
    • 2012-07-07
    • 1970-01-01
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多