在Y轴周围的3D空间中旋转图像 [英] Image rotation in 3D space around Y axis

查看:175
本文介绍了在Y轴周围的3D空间中旋转图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个BufferedImage,我想旋转图像(图片)绕Y轴以Java角度旋转而不是仿射变换。旋转将如下图所示(矩形将成为图像)。



我可以通过旋转图像的每个像素并绘制图像来实现这一点。因为我必须旋转很多图像,所以我认为这不是最好的想法。



我将如何进行这种转换?



感谢您的帮助。

解决方案

一般来说,您需要从输出像素空间中找到逆变换输入像素的空间。然后迭代输出像素,将它们转换为输入空间并对输入图像进行采样。透视投影中的维基百科条目显示了如何为Y轴制作旋转矩阵。如果你正在做的只是围绕Y轴旋转,那么你可以简单地反转角度来获得反转(假设你的图像居中在原点)。

I have a BufferedImage and I want to rotate the image (Picture) around the Y axis in Java with theta angle not affine transform. The rotation will be like the image below (the rectangle will be an image).

I can do this by rotating each pixel of the image and drawing the image. Because I have to rotate a lot of images, I don't think this is the best idea.

How I will do this transformation?

Thanks for your help.

解决方案

Generally, you'll want to find the inverse transform from your output pixel space into the input pixel's space. You then iterate over the output pixels, transforming them into the input space and sampling the input image. The Wikipedia entry on Perspective Projection shows how to make a rotation matrix for the Y axis. If all you're doing is rotating around the Y axis, you can simply reverse the angle to get the inverse transformation (assuming your image is centered at the origin).

这篇关于在Y轴周围的3D空间中旋转图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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