Downscaling JPG during JPG decompression

元气小坏坏 提交于 2019-12-10 14:23:11

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/8656747/downscaling-jpg-during-jpg-decompression

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!