问题标签 [dct]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
687 浏览

java - JPEG 中的隐写术

我正在开发一个 Java 隐写术项目,以在 JPEG 图像中隐藏 .txt 消息。概括地说,有4个步骤:

  1. 将每个像素块转换为 8x8 DCT 系数。
  2. 用一些复杂的计算量化每个块。
  3. 将消息的每一位嵌入/替换到每个块的系数的 LSB 中。
  4. 嵌入后,执行逆 DCT 以使用嵌入的消息重新创建 JPEG 图像。

我被困在第 3 步,因为我不确定如何记录我已随消息更改的系数,以便将其提取出来?

谁能推荐我可以嵌入每个系数并记录每个嵌入以将其提取出来的方法?

这将不胜感激。

(我也知道1s和0s,DC值应该不用管)。

0 投票
1 回答
328 浏览

java - 与在图像上实施逆 DCT 相关的问题

我试图在图像上实现 DCT,作为理解整个 JPEG 压缩管道(在 Java 中)的一部分。我可以成功实现正向 DCT。但是,我在逆 DCT 中遇到问题。任何帮助将不胜感激。

我可以确认我的正向 DCT 是正确的(使用论文中的 8x8 示例并获得匹配值)。但是,IDCT 给我带来了问题。我认为我已经正确地实现了公式,但似乎无法指出我出错的地方。你能帮忙吗?

0 投票
2 回答
1604 浏览

java - Steganography using the DCT

Broadly speaking there are 4 steps involved in embedding a message using DCT:

  1. Divide the image into 8x8 blocks
  2. Transform each block using DCT mathematical operations
  3. Quantitize each DCT block (lossy compression)
  4. Embed the message bits from the quantitized coefficients (avoid 0, 1, -1, and the AC)

Thats ok, but I am not sure how to extract the data back out. Are you suppose to go through steps 1-3 to quantitize each block in order to extract the LSB of each coefficient?

If that's the case, would you not be losing (possible the embedded data) data because it is a lossy technique?

Also when I tried to quantitize each block, I am left with the same coefficients from the previous image (as in the LSB change had no effect) ??

Could someone enlighten me on this problem?

Thanks

0 投票
2 回答
989 浏览

java - Working with JPEG images in Java

I am using the BufferedImage class to read in an image as pixels which I then use bit shifting to get their appropriate components into separate int arrays. This works OK.

I have used this reference site to manually perform DCT functions with the pixel arrays.

Methods used: forwardDCT(), quantitizeMatrix(), dequantitzeMatrax(), inverseDCT()

which then are fed back into a resultant image array to reconstruct the JPEG file, which I then use BufferedImage's write() method to write the pixel data back out as the image.

This works perfectly, and I can view the image. (Even better the value I use to compress visually works).

My question is, is there a way to write the quantitize coefficients as the compressed values as a JPEG?

Because the BufferedImage write() method is used to input pixel data, rather than coefficient data?

Hope this is clear.

Thanks

0 投票
1 回答
1317 浏览

matlab - how to do histogram for dct coeffcient to show Double Quantiztion effect?

what i want to do is a histogram for quantized DCT coefficient for an image, to detect Double Quantization effect. when i use hist(x) it will categorize it in to 10s and if i changed it to hist(x,20) or 30 it does not really show the DQ effect. so is there any better way for this?? here is the code: on matlab

0 投票
1 回答
6592 浏览

performance - 我正在寻找一种用于矩阵 [NxM] 的快速 DCT 和 IDCT 的简单算法

我正在寻找一种简单的算法来执行任何大小 [NxM] 的矩阵的快速DCT(类型 2),以及一种用于逆变换IDCT的算法(也称为 DCT 类型 3)。

我需要一个 DCT-2D 算法,但即使是 DCT-1D 算法也足够好,因为我可以使用 DCT-1D 来实现 DCT-2D (和 IDCT-1D 来实现 IDCT-2D )。

PHP 代码更可取,但任何足够清晰的算法都可以。

当矩阵大小超过 [200x200] 时,我当前用于实现 DCT/IDCT 的 PHP 脚本非常慢。

我一直在寻找一种方法,可以在不到 20 秒的时间内完成高达 [4000x4000] 的 DCT。有谁知道该怎么做?

0 投票
1 回答
225 浏览

matlab - 使用 LSB 和 DCT 的数据安全 - 来自 matlab 的错误

% 我得到错误 DC11=dct2(C11);DCC12=dct2(C12);......从单元格转换为双精度是不可能的。%在图像中使用 LSB 和 DCT 隐写术的数据安全性

0 投票
1 回答
3149 浏览

java - DCT 实施

我正在尝试为彩色 JPEG 实现基于 DCT 的图像压缩算法。我是图像处理的新手,所以我需要一些帮助。我需要的是澄清算法。

我从这里使用 DCT 实现

所以,这是我理解的算法:

  1. 使用 ImageIO 将图像加载到 BufferedImage 中。
  2. 创建 3 个矩阵(每个通道 1 个:红色、绿色、蓝色):

    /li>
  3. 将矩阵增加到大小,以便它们可以分成 8x8 的块(其中 8 是 DCT 矩阵的大小,N)

  4. 对于每个矩阵,将其拆分为 8x8 大小的块(结果:splittedImage)
  5. 对来自 splittedImage 的矩阵执行 forwardDCT(结果:dctImage)。
  6. 对来自 dctImage 的矩阵执行量化(结果:quantizedImage)

在这里我不知道该怎么办。我可以:

  • 将 quantizedImage 矩阵合并为一个矩阵 margedImage,将其转换为 Vector 并执行 compressImage 方法。
  • 或者将小矩阵从quantizedImage转换成Vector,对它们执行compressImage方法,然后将它们margin成一个矩阵

所以,在这里我得到了红色、绿色和蓝色的 3 个矩阵。然后我将这些矩阵转换为一个 RGB 矩阵并创建新的 BufferedImage 并使用方法 setRGB 来设置像素值。然后执行将图像保存到文件。

额外问题:

  1. 将RGB转换为YCbCr并在Y,Cb和Cr上执行DCT更好吗?
  2. compressImage 方法的 Javadoc 说它不是 Huffman 编码,而是 Run-Length 编码。那么压缩后的图像会被图像查看器打开吗?或者我应该根据JPEG规范使用霍夫曼编码,Java中有没有开源的霍夫曼编码实现?
0 投票
0 回答
1523 浏览

matlab - 基于 DCT 系数的隐写术

我正在尝试使用 LSB 进行隐写术,但我得到了带有很多黑色像素的图像,我正在替换 DCT 值小于零的封面图像像素中的 LSB 我不知道为什么我在图像中得到黑色像素

0 投票
1 回答
741 浏览

java - Java JPG DCT系数在我修改后会自行改变

我有一个程序可以改变 JPG 图像的 DCT 系数。这是给我 DCT 系数的代码

这是修改前的 DCT 矩阵

这是修改后的

使用图像缓冲区保存图像后,我使用创建的图像从中取回修改后的 DCT,但我得到的只是:

我看到一个问题,用户在 IOS 中使用库做了同样的事情并且遇到了同样的问题。显然库重新压缩了图像并且隐藏的消息被破坏了。

我不知道这是否适合我。我使用 Image Buffer 来创建图像。