在JPG解压缩期间缩小JPG [英] Downscaling JPG during JPG decompression

查看:153
本文介绍了在JPG解压缩期间缩小JPG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须缩小和解压缩一组大小为4608 x 3456的JPG图片。目前,我已经能够将图片正确解压缩为RGB格式,并将其转换为位图。



现在我需要实现低档,从我到目前为止已经读取的图像正确地缩小图像,应该使用双线性插值。然后,我应该替换用于内插的像素(2x2)的内插得到的像素。我需要约当前大小的1/4。



我不是那么担心缩小图片的质量,因为我是关于它的速度。整个过程应该尽可能快。



我的问题是,在时,我应该在JPG的解压缩阶段进行双线性插值。我应该在IDCT(反离散余弦变换)后进行还是应该在IDCT之前执行插值?



使用DCT系数和对它们进行插值是聪明的,然后在IDCT中使用那些结果值吗?














然而,如果你特别想要每个维度一半大小的图像,你可以通过丢弃高频系数并做一个4x4的IDCT来获得一个粗略的下采样图像。


I have to downscale and decompress a set of JPG images of size 4608 x 3456. Currently, I have already been able to decompress the images correctly to RGB format and convert them to a Bitmap.

Now I need to implement the downscale, and from what I've read so far to downscale an image correctly one should use Bilinear Interpolation. Then I should replace the pixels (2x2) that were used for the interpolation by the resulted pixel from the interpolation. I need the about at about 1/4 of its current size.

I'm not so worried about the quality of the downscaled images, as I am about the speed at which it is done. The whole process should be as fast as it can be.

My question is, when I should do the bilinear interpolation during the decompression stage of the JPG. Should I do it after the IDCT (Inverse Discrete Cosine Transform) or should I perform the interpolation before the IDCT?

Is it smart to use the DCT coefficents and do the interpolation on them and then use those resulted values to in the IDCT?

解决方案

In general, I don't believe there's any sensible way that you can do this in terms of the DCT coefficients.

However, if you specifically want an image of half the size in each dimension, you could get a crudely downsampled image by throwing away the high-frequency coefficients and doing a 4x4 IDCT.

这篇关于在JPG解压缩期间缩小JPG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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