透视图像畸变 [英] Perspective Image Distortion

查看:309
本文介绍了透视图像畸变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作中的应用目前要求为视角图像畸变的功能。基本上我想要做的就是让用户将图像加载到应用程序并调整其​​基于4角点,他们可以指定透视图的属性。

The application I am working on currently requires functionality for Perspective Image Distortion. Basically what I want to do is to allow users to load an image into the application and adjust its perspective view properties based on 4 corner points that they can specify.

我看了一下ImageMagic。它有一定的扭曲与角度探讨调节功能,但非常缓慢,一定的投入是给不正确的输出。

I had a look at ImageMagic. It has some distort functions with perpective adjustment but is very slow and some certain inputs are giving incorrect outputs.

任何你们使用的任何其他库或算法。我编码在C#。

Any of you guys used any other library or algorithm. I am coding in C#.

任何指针将是非常美联社preciated。

Any pointers would be much appreciated.

感谢

推荐答案

这似乎正是你(我)正在寻找: <一href="http://www.$c$cproject.com/KB/graphics/YLScsFreeTransform.aspx">http://www.$c$cproject.com/KB/graphics/YLScsFreeTransform.aspx

This seems to be exactly what you (and I) were looking for: http://www.codeproject.com/KB/graphics/YLScsFreeTransform.aspx

这将拍摄图像,并使用您提供4 X / Y坐标扭曲了。

It will take an image and distort it using 4 X/Y coordinates you provide.

快速,免费,简单code。经过测试,它精美的作品。只需从该链接下载code,然后用FreeTransform.cs是这样的:

Fast, free, simple code. Tested and it works beautifully. Simply download the code from the link, then use FreeTransform.cs like this:

using (System.Drawing.Bitmap sourceImg = new System.Drawing.Bitmap(@"c:\image.jpg")) 
{ 
    YLScsDrawing.Imaging.Filters.FreeTransform filter = new YLScsDrawing.Imaging.Filters.FreeTransform(); 
    filter.Bitmap = sourceImg;
    // assign FourCorners (the four X/Y coords) of the new perspective shape
    filter.FourCorners = new System.Drawing.PointF[] { new System.Drawing.PointF(0, 0), new System.Drawing.PointF(300, 50), new System.Drawing.PointF(300, 411), new System.Drawing.PointF(0, 461)}; 
    filter.IsBilinearInterpolation = true; // optional for higher quality
    using (System.Drawing.Bitmap perspectiveImg = filter.Bitmap) 
    {
        // perspectiveImg contains your completed image. save the image or do whatever.
    } 
} 

这篇关于透视图像畸变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆