根据细节缩放图像

发布于 2024-09-28 09:22:30 字数 347 浏览 2 评论 0原文

我很好奇是否有一些方法或算法可以用来根据图像中的细节或熵的数量来缩小图像,以便将新的尺寸确定为原始图像的大部分细节的分辨率将被保留。

例如,如果用相机拍摄失焦或抖动的图像,则与相机在焦点对准或从相对于所描绘的场景的固定位置拍摄的图像相比,细节或高频内容会更少。如果将较低熵图像缩放回原始大小,则可以显着减小该图像的大小,并且仍然保留大部分细节。然而,对于更详细的图像,我们无法在不丢失重要细节的情况下尽可能减小图像尺寸。

我当然明白,包括 JPEG 在内的许多有损图像格式都会做类似的事情,即存储给定分辨率的图像所需的数据量与图像数据的熵成正比,但我很好奇,主要是为了我自己如果可能存在一种计算有效的方法来将分辨率缩放到图像内容,那么我们很感兴趣。

I'm curious about whether there are approaches or algorithms one might use to downscale an image based on the amount of detail or entropy in the image such that the new size is determined to be a resolution at which most of the detail of the original image would be preserved.

For example, if one takes an out-of-focus or shaky image with a camera, there would be less detail or high frequency content than if the camera had taken the image in focus or from a fixed position relative to the scene being depicted. The size of the lower entropy image could be reduced significantly and still maintain most of the detail if one were to scale this image back up to the original size. However, in the case of the more detailed image, one wouldn't be able to reduce the image size as much without losing significant detail.

I certainly understand that many lossy image formats including JPEG do something similar in the sense that the amount of data needed to store an image of a given resolution is proportional to the entropy of the image data, but I'm curious, mostly for my own interest, if there might be a computationally efficient approach for scaling resolution to image content.

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

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

发布评论

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

评论(1

初熏 2024-10-05 09:22:30

这是可能的,有人可能会说大多数有损图像压缩方案从 JPEG 风格的 DCT 内容 到 < a href="http://en.wikipedia.org/wiki/Fractal_compression" rel="nofollow">分形压缩本质上是以自己特定的方式做到这一点的。

请注意,此类方法几乎总是对小图像块而不是大图像进行操作,以便最大限度地提高较低细节区域的压缩,而不是受限于在各处应用相同的设置。后者可能会导致大多数“真实”图像的压缩较差和/或损失较高,这些图像通常包含细节级别的混合,但也有例外,例如您的失焦示例。

您需要定义什么构成“原始图像的大部分细节”,因为只有相当人为的图像才有可能实现完美的恢复。而且您还需要指定每种方式要使用的确切的重新调整形式,因为这会对恢复的质量产生相当大的影响。例如,简单的像素重复可以更好地保留硬边缘,但会破坏平滑的梯度,而线性插值应该可以更好地再现梯度,但可能会对边缘造成严重破坏。

一种简单化的即兴方法可能是计算 2D 功率谱并选择保留包含“大部分”内容的频率的缩放比例(可能垂直和水平不同)。基本上,这相当于选择保留“大部分”细节的低通滤波器。这种方法是否算作“计算效率”可能是一个有争议的问题......

It's possible, and one could argue that most lossy image compression schemes from JPEG-style DCT stuff to fractal compression are essentially doing this in their own particular ways.

Note that such methods almost always operate on small image chunks rather than the big picture, so as to maximise compression in lower detail regions rather than being constrained to apply the same settings everywhere. The latter would likely make for poor compression and/or high loss on most "real" images, which commonly contain a mixture of detail levels, though there are exceptions like your out-of-focus example.

You would need to define what constitutes "most of the detail of the original image", since perfect recovery would only be possible for fairly contrived images. And you would also need to specify the exact form of rescaling to be used each way, since that would have a rather dramatic impact on the quality of the recovery. Eg, simple pixel repetition would better preserve hard edges but ruin smooth gradients, while linear interpolation should reproduce gradients better but could wreak havoc with edges.

A simplistic, off-the-cuff approach might be to calculate a 2D power spectrum and choose a scaling (perhaps different vertically and horizontally) that preserves the frequencies that contain "most" of the content. Basically this would be equivalent to choosing a low-pass filter that keeps "most" of the detail. Whether such an approach counts as "computationally efficient" may be a moot point...

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