Java:获取JPEG DCT系数直方图

发布于 2024-10-02 03:38:48 字数 75 浏览 1 评论 0原文

我需要一个 Java 库、代码片段...来获取频率分布 JPEG 文件的 64 个 DCT 系数。

有什么想法吗?谢谢!

I need a Java library, code snippet,... to get the Frequency distribution of the
64 DCT coefficients of a JPEG file.

Any ideas? Thx!

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

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

发布评论

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

评论(2

小红帽 2024-10-09 03:38:48

如果您对特定文件的分发感兴趣,那么您可以尝试将其转换为 bmp 并使用我的问题中提供的代码:

解压在中间停止并且输出文件用零填充(黑色像素)?

您可能需要弱化它才能与 java 一起使用。这个想法是将每个 8*8 块的所有 64 个系数存储在一个数组中。然后计算每个系数的每个值的频率,例如 0,0(DC) 或 0,1 或 8,8(最高频率),并在 y 轴上绘制频率,在 x 轴上绘制值。您将得到 64 个图,每个图对应一个系数。

If you are interested in the distribution of a particular file then you can try to convert it into bmp and use my code provided in my question:

Decompression stops inbetween and output file filled with zeros(BLACK PIXELS)?

You may need to weak it to work with java. The idea is store all 64 coeff in an array for each 8*8 block. Then count the frequency of each value for each coeff no such as 0,0(DC) or 0,1 or 8,8(highest freq) and plot the frequency in y-axis and value in x-axis. you will get 64 plots, one for each coefficient.

野心澎湃 2024-10-09 03:38:48

直接从 JPEG 文件中获取 DCT 系数似乎没有简单的答案。解压缩图像并重新应用 DCT 变换是一个合理的近似,但它确实容易引入舍入误差。

我发现直接从文件获取 JPEG 系数的唯一解决方案是使用 JNA 连接到本机 JPEG 库。您要求提供库或代码片段。我已经编写了一个 Java 库,应该可以满足您的需求。我的代码非常粗糙,但可以很容易地扩展。此处:https://github.com/markzampoglou/dct-extraction

It seems that there is no simple answer to directly getting the DCT coefficients from a JPEG file. Decompressing the image and re-applying the DCT transform is a reasonable approximation, but it does tend to introduce rounding errors.

The only solution I found to getting the JPEG coefficients directly from the file was to use JNA to connect to the native JPEG library. You asked for a library or code snippet. I have written a Java library that should meet your needs. My code is very crude but can be easily extended. Here: https://github.com/markzampoglou/dct-extraction

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