估计图像的DCT系数的直方图分布,由其8x8块提取

发布于 2025-02-04 03:31:12 字数 467 浏览 7 评论 0原文

拥有图像im 使用形状:

imsize = img.shape

在估算每个8x8块的DCT系数之后,

dct = np.zeros(imsize)
for i in [:imsize[0]:8]:
    for j in [:imsize[1]:8]:
        dct[i:(i+8),j:(j+8)] = dct2( im[i:(i+8),j:(j+8)] )

我想绘制相应的8x8块的DCT系数的直方图分布,还要绘制dct图像的dct系数。

我尝试了后者,

seaborn.kdeplot(dct.flatten(), color="r")

但结果不是预期的。我想将其与压缩版本进行比较,以便拥有一些有意义的信息进行比较。如何正确绘制分布?

Having an image im
With shape:

imsize = img.shape

After estimating the DCT coefficients for each 8x8 block

dct = np.zeros(imsize)
for i in [:imsize[0]:8]:
    for j in [:imsize[1]:8]:
        dct[i:(i+8),j:(j+8)] = dct2( im[i:(i+8),j:(j+8)] )

I would like to plot the histogram distribution of DCT coefficients both for the corresponding 8x8 blocks but also for the dct image.

I tried for the latter with the

seaborn.kdeplot(dct.flatten(), color="r")

but I the result is not the expected. I want to compare this with a compressed version in order to have some meaningful information to compare. How can I plot the distribution correctly?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文