如何将矩形纹理投影到弯曲形状的区域?
How can I project a rectangular texture into a region of curved shape?
我想将矩形的纹理图像映射到曲面区域。弯曲区域具有由贝塞尔曲线定义的轴和固定宽度。
我可以将轴上的点按百分位数映射到纹理,并得到一条像素条纹来填充该区域。但是这样,区域的左侧是 "stretched",我得到了未填充的空白。
如何将纹理映射到弯曲区域"smoothly"?有这样的任务的算法吗?
回答我自己的问题:
我自己天真的解决方案是通过在法向量上的相邻点之间进行插值,用像素值填充间隙(图像中的三角形区域)。
后来我在一篇论文中找到了更数学化的解法:
http://www.stat.ucla.edu/~sczhu/papers/Conf_2011/portrait-painting-preprint.pdf
它使用称为薄板样条 (TPS) 变换的方法将矩形纹理的网格映射到样条形区域:
we compute a thin-plate spline (TPS) transformation [Barrodale
et al. 1993] between the pairs of source and target dot positions
(e.g., between the corresponding backbone control points in Figs.4a
and 4b), and apply the transformation to the vertices of a quadrilateral
mesh covering the source brush stroke to get the deformed
mesh. Finally, we compute a texture mapping using the mesh, with
a bilinear interpolation inside each quadrilateral.
我在想也许可以用贝塞尔曲线完成相同的转换。
希望这对您有所帮助。
我想将矩形的纹理图像映射到曲面区域。弯曲区域具有由贝塞尔曲线定义的轴和固定宽度。
我可以将轴上的点按百分位数映射到纹理,并得到一条像素条纹来填充该区域。但是这样,区域的左侧是 "stretched",我得到了未填充的空白。
如何将纹理映射到弯曲区域"smoothly"?有这样的任务的算法吗?
回答我自己的问题:
我自己天真的解决方案是通过在法向量上的相邻点之间进行插值,用像素值填充间隙(图像中的三角形区域)。
后来我在一篇论文中找到了更数学化的解法:
http://www.stat.ucla.edu/~sczhu/papers/Conf_2011/portrait-painting-preprint.pdf
它使用称为薄板样条 (TPS) 变换的方法将矩形纹理的网格映射到样条形区域:
we compute a thin-plate spline (TPS) transformation [Barrodale et al. 1993] between the pairs of source and target dot positions (e.g., between the corresponding backbone control points in Figs.4a and 4b), and apply the transformation to the vertices of a quadrilateral mesh covering the source brush stroke to get the deformed mesh. Finally, we compute a texture mapping using the mesh, with a bilinear interpolation inside each quadrilateral.
我在想也许可以用贝塞尔曲线完成相同的转换。
希望这对您有所帮助。