如何在频域中旋转图像?
我听说应该可以对 jpeg 图像进行无损旋转。这意味着您可以在频域中进行旋转,而无需 IDCT。我尝试用谷歌搜索但没有找到任何东西。有人可以对此带来一些启发吗?
我所说的无损是指我不会在旋转中丢失任何附加信息。当然,这可能只有在旋转 90 度的倍数时才有可能。
I've heard that it should be possible to do a lossless rotation on a jpeg image. That means you do the rotation in the frequency domain without an IDCT. I've tried to google it but haven't found anything. Could someone bring some light to this?
What I mean by lossless is that I don't lose any additional information in the rotation. And of course that's probably only possible when rotating multiples of 90 degrees.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要需要对图像进行 IDCT 来无损旋转它(请注意,光栅图像的无损旋转仅适用于 90 度倍数的角度)。
以下步骤在 DCT 域中实现图像的转置:
我假设您已经可以执行以下操作:
我无法向你展示完整的代码,因为它非常复杂,但这里是我对图像进行IDCT的部分(注意IDCT仅用于显示目的< /strong>):
这是显示的图像:
这里没有发生任何奇特的事情 - 这只是原始的图像。
现在,这是实现我上面提到的两个转置步骤的代码:
这是生成的图像:
您可以看到图像现在已转置。为了实现正确的旋转,您需要将反射与转置结合起来。
编辑
抱歉,我忘记了反射也不是微不足道的。它也包含两个步骤:
下面的代码在转置后执行垂直反射。
这是您获得的图像:
您会注意到,这构成了逆时针旋转 90 度。
You do not need to IDCT an image to rotate it losslessly (note that lossless rotation for raster images is only possible for angles that are multiples of 90 degrees).
The following steps achieve a transposition of the image, in the DCT domain:
I'm going to assume you can already do the following:
I can't show you the full code, because it's quite involved, but here's the bit where I IDCT the image (note the IDCT is for display purposes only):
This is the image that is shown:
Nothing fancy is happening here -- this is just the original image.
Now, here's the code that implements both the transposition steps I mentioned above:
This is the resulting image:
You can see that the image is now transposed. To achieve proper rotation, you need to combine reflection with transposition.
EDIT
Sorry, I forgot that reflection is also not trivial. It also consists of two steps:
Here's code that performs a vertical reflection after the transposition.
Here's the image you get:
You will note that this constitutes a rotation by 90 degrees counter-clockwise.