感知图像下采样

发布于 2024-08-11 16:23:25 字数 306 浏览 1 评论 0 原文

所以这是我的问题:

我有一个图像,该图像很大(高分辨率)并且需要很小(分辨率低得多)。

所以我做了天真的事情(杀死所有其他像素),结果看起来很糟糕。

因此,我尝试做一些更智能的事情(使用傅里叶变换进行低通滤波并在傅里叶空间中重新采样),结果稍微好一点,但仍然相当差。

所以我的问题是,是否有一种基于感知的图像下采样算法(或实现)?

编辑: 虽然我知道许多重采样技术,但我的应用程序更关心保留感知特征,而不是生成平滑的图像。

edit2:可以肯定地假设我对数字信号处理、卷积、小波变换等有一定程度的熟悉

So here is my problem:

I have an image, that image is large (high resolution) and it needs to be small (much lower resolution).

So I do the naive thing (kill every other pixel) and the result looks poor.

So I try to do something more intelligent (low pass filtering using a Fourier transform and re-sampling in Fourier space) and the result is a little better but still fairly poor.

So my question, is there a perceptually motivated image down-sampling algorithm (or implementation)?

edit:
While I am aware of a number of resampling techniques, my application is more concerned with preserving the perceptual features, rather than producing smooth images.

edit2: it is safe to assume I have some level of familiarity with digital signal processing, convolutions, wavelet transforms, etc

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

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

发布评论

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

评论(6

山人契 2024-08-18 16:23:25

阅读此内容:

http://www.dspguide.com/

好的,这是一篇值得阅读的文章。但了解滤波器设计会很方便。

一般来说,将图像从W1 x H1缩放到W2 x H2(其中W1、W2、H1、H2是整数)的过程是找到新的W3、H3,使得W1和W2是W3的整数因子,并且H1和H2是H3 的整数因子,然后用零填充原始图像(用于间隔原始图像的像素),使其大小现在为 W3 x H3。由于图像中的不连续性,这会引入高频,因此您对图像应用低通滤波器,然后将滤波后的图像抽取到新的尺寸 (W2 x H2)。听起来您可能已经尝试这样做了,但是过滤可以在时域中完成,因此实际上不需要傅立叶变换。

在实践中,我刚刚描述的过程已经过优化(您会注意到,当将卷积滤波器应用于放大图像时,大多数项将为 0,因此您可以避免算法中的大多数乘法运算。并且由于您最终会丢弃许多过滤结果,因此不需要计算这些结果,因此最终会对目标图像中的每个像素进行一些乘法和加法,基本上,技巧是找出哪些系数。 。

我相信 ffmpeg 项目中的 libswscale 会做类似的事情 看看:

http://gitorious.org/libswscale

正如其他人指出的那样,(你显然注意到了)抽取图像会引入混叠伪影。我无法确定您的重采样实现,但该技术有一些有趣的陷阱,具体取决于您使用的窗口大小和其他实现细节。

Read this:

http://www.dspguide.com/

OK, that's quite a read. But understanding filter design would be handy.

In general, the process for scaling an image from W1 x H1 to W2 x H2 where W1, W2, H1, H2 are integers, is to find new W3, H3 so that W1 and W2 are integer factors of W3 and H1 and H2 are integer factors of H3, and then pad the original image with zeros (used to space the pixels of the original image) so that it's now W3 x H3 in size. This introduces high frequencies due to discontinuities in the image, so you apply a low-pass filter to the image, and then decimate the filtered image to its new size (W2 x H2). Sounds like you might be trying to do this already, but the filtering can be done in the time domain so that the Fourier transform isn't really necessary.

In practice, the process I just described is optimized (you'll note that when applying a convolution filter to the upscaled image most of the terms will be 0, so you can avoid most of the multiplication operations in your algorithm, for example. And since you end up throwing away many of the filtered results, you don't need to calculate those, so you end up with a handful of multiplications and additions for each pixel in the target image, basically. The trick is to figure out which coefficients to use.)

libswscale in the ffmpeg project does something like this, I believe. Check it out:

http://gitorious.org/libswscale

As others pointed out, (and you apparently noticed) decimating the image introduces aliasing artifacts. I can't be sure about your resampling implementation, but the technique has interesting gotchas depending on the window size you use and other implementation details.

不乱于心 2024-08-18 16:23:25

双三次插值一般认为已经足够好了,但是没有完美的解决方案,这取决于人以及正在重新采样的图片的属性。

相关链接:

我什至不知道清晰度也称为锐度

混叠是单纯下采样时可能出现的问题。

Bicubic interpolation is generally regarded as good enough, but there is no perfect solution, it depends on people and on the properties of the picture being resampled.

Related links:

I didn't even know that sharpness was also called acutance.

Aliasing is a problem that can occur when downsampling naively.

百思不得你姐 2024-08-18 16:23:25

帕斯卡是对的。取决于图像,以及您想要的。一些因素:

  • 保留锐利边缘
  • 保留颜色
  • 算法速度

这是您的方法

其他一些:

注意有时,与使用较低分辨率的相机相比,重新采样可以得到更清晰的结果,因为高分辨率图像中会有一些边缘无法被较低分辨率的设备检测到。

旁注:如果按整数缩小(例如除以 4 或 6),许多算法(尤其是最近邻算法)都可以得到优化。

Pascal is right. Depends on the image, and on what you want. Some factors:

  • preserving sharp edges
  • preserving colours
  • algorithm speed

This is your method.

Some others:

Note that sometimes resampling down can get you a sharper result than, say, using a lower resolution camera, because there will be edges in the high-resolution image that cannot be detected by a lower-res device.

Side note: Many algorithms (especially Nearest Neighbour) can be optimised if you are scaling down by an integer (e.g. dividing by 4 or 6).

凡尘雨 2024-08-18 16:23:25

此处讨论推荐的 ImageMagick“通用”下采样方法:http://www.imagemagick。 org/Usage/filter/nicolas/#downsample

Recommended ImageMagick "general purpose" downsampling methods are discussed here: http://www.imagemagick.org/Usage/filter/nicolas/#downsample

触ぅ动初心 2024-08-18 16:23:25

您可以尝试内容感知调整大小算法。请参阅:http://www.seamcarving.com/

You could try a content aware resizing algorithm. See: http://www.seamcarving.com/

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