【问题标题】:Is there any way to draw an image to use 4 points rather than 3 (perspective warp)有什么方法可以绘制图像以使用 4 点而不是 3 点(透视扭曲)
【发布时间】:2008-09-01 19:13:10
【问题描述】:

Graphics.DrawImage 很好地支持绘制平行四边形:

Bitmap destImage = new Bitmap(srcImage.Width, srcImage.Height);
using (Graphics gr = new Graphics.FromImage(destImage))
{
    Point[] destPts = new Point[] { new PointF(x1, y1), 
        new PointF(x2, y2), new PointF(x4, y4)};
    gr.DrawImage(srcImage, destPts);

怎么样,你做到了4点吗(明明不支持下面的,但这是想要的):

Bitmap destImage = new Bitmap(srcImage.Width, srcImage.Height);
using (Graphics gr = new Graphics.FromImage(destImage))
{
    Point[] destPts = new Point[] { new PointF(x1, y1), new PointF(x2, y2),
        new PointF(x3, y3), new PointF(x4, y4)};
    gr.DrawImage(srcImage, destPts);
}

【问题讨论】:

    标签: c# .net gdi+


    【解决方案1】:

    通常您会使用 3x3 矩阵执行此操作,但 Matrix 类仅允许您指定 6 个值而不是 9。您可以在 Direct X 中执行此操作。

    【讨论】:

      【解决方案2】:

      在考虑 3D 工具将如何处理它时...尝试绘制一个一半的三角形,然后另一半绘制另一个三角形。因此,如果您有 A、B、C 和 D 点;您将(使用剪切平面)绘制 A、B、C,然后绘制 B、C、D 或类似的东西。

      【讨论】:

        【解决方案3】:

        我在 CodeProject 中找到了以下文章: Free Image Transformation By YLS

        需要一些作品

        也许你可以用这个:)

        【讨论】:

          【解决方案4】:

          我能找到的最近的是this information,它非常滞后。

          【讨论】:

            猜你喜欢
            • 2015-11-22
            • 2012-10-11
            • 2016-04-25
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2018-08-17
            • 1970-01-01
            • 2020-03-22
            相关资源
            最近更新 更多