.NET 中的非仿射图像转换

发布于 2024-07-13 15:13:49 字数 715 浏览 3 评论 0原文

.NET 库中是否有任何类、方法或任何一般算法来执行非仿射< /a> 转换? (即不仅仅涉及旋转、缩放、平移和剪切的变换)

例如:

替代文字

替代文本
(来源:last100.com)


非仿射变换s?

Are there any classes, methods in the .NET library, or any algorithms in general, to perform non-affine transformations? (i.e. transformations that involve more than just rotation, scale, translation and shear)

e.g.:

alt text

alt text
(source: last100.com)


Is there another term for non-affine transformations?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

紫轩蝶泪 2024-07-20 15:13:49

我不知道 .Net 中集成了任何东西可以让您进行非仿射变换。

我猜你正在尝试某种 3D 纹理映射? 如果是这种情况,您需要齐次仿射变换,这在 .Net 中不可用。 我也不知道在 .Net 中进行像素位移变换的任何集成方法。

然而,当前投票的解决方案可能适合您想要做的事情,只是要注意它不会立即进行透视校正。

例如:

alt text

左侧的图片是使用单四元扭曲库生成的由 Neil N 提供。右侧的图片是使用 DirectX 中的单个四边形(实际上是两个三角形)生成的。

这可能不会对您想要做的事情产生任何影响,但如果您想做 3D 东西,请记住这一点,如果没有透视正确的映射,它看起来会很奇怪。

I am not aware of anything integrated in .Net letting you do non affine transforms.

I guess you are trying to have some sort of 3D texture mapping? If that's the case you need an homogenous affine transform, which is not available in .Net. I'm also not aware of any integrated way to make pixel displacement transforms in .Net.

However, the currently voted solution might be good for what you are trying to do, just be aware that it won't do perspective correction out of the box.

For instance:

alt text

The picture on the left was generated using the single quad distort library provided by Neil N. The picture on the right was generated using a single quad (two triangles actually) in DirectX.

This may not have any impact on what you are trying to do, but this is something to keep in mind if you want to do 3D stuff, it will look very weird without perspective correct mapping.

所有深爱都是秘密 2024-07-20 15:13:49

您发布的所有示例图像都可以通过四边形扭曲来完成。 尽管我不能肯定地说四元扭曲将覆盖所有非仿射变换。

这是一个在 C# 中不太好的实现的链接...它可以工作,但速度很慢。 浏览维基百科,了解可用于此类计算的许多不同优化

http://www.vcskicks.com /image- Distortion.html -

尼尔

All of the example images you posted can be done with a Quadrilateral Distortion. Though I cant say for certain that a quad distort will cover ALL non affine transforms.

Heres a link to a not so good implementation of it in C#... it works, but is slow. Poke around Wikipedia for the many different optimizations available for these kinds of calculations

http://www.vcskicks.com/image-distortion.html

-Neil

云仙小弟 2024-07-20 15:13:49

您可以使用 Viewport3d 控件和非仿射变换矩阵在 wpf 中执行此操作。 再次将其渲染为位图可能会很有趣......我通过包含不可见的 来“修复”它。 使用与我的纹理平面上相同的图像进行控制...(此外,我必须通过分割平面和裁剪图像来解决最大纹理尺寸问题...)

http://www.charlespetzold.com/blog/2007/08/060605.html

就我而言,我想要与此相反(变换使扭曲上的任意点成为我的矩形窗口的角),这是矩阵的逆矩阵,可以做相反的事情。

You can do this in wpf using a the Viewport3d control and a non-affine transform matrix. Rendering this to a bitmap again may be interesting.... Which I "fixed" by including an invisible <image> control with the same image as on my textured plane... (Also, I've had to work around the max texture size issues by splitting up the plane and cropping images...)

http://www.charlespetzold.com/blog/2007/08/060605.html

In my case I wanted the reverse of this (transform so arbitrary points on the warped become the corners of my rectangular window), which is the Inverse of the matrix to do the opposite.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文