gpt4 book ai didi

image - 将图像映射到一组坐标上

转载 作者:行者123 更新时间:2023-12-04 18:21:36 24 4
gpt4 key购买 nike

我有一个典型的源图像,纵横比为 3:4。我还有一组坐标,我需要将图像映射到单独的图像中。坐标不是完美的矩形;如果有的话,它们会定义不规则的网格。

例如,(0,0) 可能映射到 (12,33)、(120,0) => (127,36)、(240,0)=>(226,13) 等。

我的目标是通过将源坐标映射到目标并应用失真来使我的源图像适合新形状。

有什么方法可以做到这一点?我正在使用 .NET,但可以调用例如图像魔术。

编辑:根据要求,这是一张图片。左图是一张简单的照片,均匀分割(忽略我蹩脚的 MSPaint 技能)。右侧显示目标形状。我有右侧每个点的坐标。目标是将平面图像映射(投影?)到形状上,以便点对齐。

enter image description here

最佳答案

我在我的网站 (http://www.rubblewebs.co.uk/imagemagick/operators/distort.php) 上有一些扭曲运算符的示例 - 使用 php,但你会明白的。

您可能需要 shepards 方法。

$cmd = "$input -matte -virtual-pixel transparent".  
" -distort Shepards \"0,0 0,0 0,100 20,100 0,200".
" 0,200 133,200 133,180 266,200 266,200 266,100".
" 246,100 266,0 266,0 133,0 133,20\" ";
exec("convert $cmd shepards.png");

enter image description here

关于image - 将图像映射到一组坐标上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10556956/

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