将图像凸面包裹在产品图像上

问题描述

我想要的:当我在枕头纹理上应用图像时,图像的图稿应凸形包裹在枕头上。

Here is the link for the desired image

上面的输出是我想要的正确输出

注意:在上图中,您可以看到该图像包裹在拐角处并且从中心凸出。

问题:但是,当我将图像应用于枕头纹理时,图像图稿不会凸出。

Here is the the output I currently have

此外,供参考,

here is the product image that I am using

And here is the artwork,that I am overlaying it with

此外,如您所见,在上面链接的产品图片中,左上角存在一些变形,如果我将其与任何设计重叠,那么如何也可以实现该变形。

我是imagemagick的新手,所以有什么好的资源可以学习和练习吗?

解决方法

这是在ImageMagick中执行此操作的方法。

输入:

enter image description here

首先为枕头制作一个面具。 ImageMagick无法获得良好的蒙版,因此我使用http://remove.bg使背景透明,然后提取了Alpha通道并得到了这个信息:

enter image description here

然后我测量了蒙版白色部分的大小和偏移量:

convert pillow.jpg \
\( -size 800x800 xc:white \
\( pillow_overlay.jpg -resize 646x646 -distort barrel "0.0 0.0 -0.2 1.3" \) \
-geometry +78+77 -compose over -composite +geometry \) \
mask.png -define compose:args=60,40 -compose blend -composite \
pillow_new.jpg

然后我处理了图像。我调整了文本图像的大小,然后应用了枕形失真(与桶形失真相反),并将其插入到枕头上方从上方偏移的白色图像中。然后,使用面膜,对枕头和扭曲的图像进行混合合成以得到结果。参见https://imagemagick.org/Usage/distorts/#barrel

from sklearn import datasets

enter image description here