使用平铺进行透视图像转换
在寻找一个可以用于我计划创建的新应用程序的良好图像处理库。我将使用 C#.NET (VS 2008)
我的应用程序需要执行以下操作:
- 在启动时加载图像并将其显示在图片框中
- 然后我应该能够在任何地方选择四个点(TopLeft、TopRight、BottomLeft、BottomRight)在图片框中。
- 然后,我需要使用 4 个源点和目标点将源图像转换为正确的视角。
不仅如此,我需要最终的输出图像具有指定的尺寸。我希望应用程序能够使用相同的视角并返回我指定的指定矩形尺寸(不是 4 点的尺寸)的图像。我希望你明白我的意思。需要对源图像进行平铺和转换,以生成完全适合指定区域的输出。
我尝试了一些库,如 Aforge.NET、ImageMagick、EMGU 等。有些库速度很慢。有些只能产生小尺寸的透视图像。有些会出现内存错误。找不到合适的解决方案。
On the hunt of a good image processing library which can be used for a new application I plan to create. I will be using C#.NET (VS 2008)
My application needs to do the following:
- Load an image at startup and display it in a picture box
- I should then be able to select four points (TopLeft, TopRight, BottomLeft, BottomRight) anywhere in the picture box.
- I then need to transform the source image to the correct perspective using the 4 source and destination points.
Not just that, I need the final output image to be of a specified size. I want the application to be able to use the same perspective and return an image of the specified rectangular size (not the size of 4 points) I specify. I hope you understand what I mean. The source image needs to be tiled and transformed to produce an output that fits the specified area completely.
I tried some libraries like Aforge.NET, ImageMagick, EMGU etc. Some are slow. Some can only produce a perspective image of small size. Some give memory errors. Can't find a proper solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设我的问题的答案在这里< /a> 也可以帮助您解决问题。
I assume the answer to my question over here can help in your case, too.
您可能想看看这个,因为它可以解决您的部分问题,或者引导您走向正确的方向:
http://www.codeproject.com/KB/graphics/YLScsFreeTransform.aspx
它将拍摄图像并使用您提供的 4 个 X/Y 坐标对其进行扭曲。
快速、免费、简单的代码。经过测试,效果非常好。只需从链接下载代码,然后像这样使用 FreeTransform.cs:
仅供参考,我相信 .NET 有 2GB 对象内存限制,因此如果您正在处理非常大的图像,则可能会遇到内存错误。
You may want to take a look at this, as it may solve a portion of your problem, or lead you in the right direction:
http://www.codeproject.com/KB/graphics/YLScsFreeTransform.aspx
It will take an image and distort it using 4 X/Y coordinates you provide.
Fast, free, simple code. Tested and it works beautifully. Simply download the code from the link, then use FreeTransform.cs like this:
FYI, I believe that .NET has a 2gb object memory limit, so if you're working with really large images, you may run into a memory error.