通过使用栅格将不可见的消息放在图像的四个部分中 [英] Put invisible message in four part of image by using Raster

查看:91
本文介绍了通过使用栅格将不可见的消息放在图像的四个部分中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从此网站 Steganography 中找到了一个教程(其中还包括代码),并且我想将这四个消息放入图像的四个不同部分,就像我在链接图像的四方,但是我不确定如何准确地将信息传递到四个部分.这是我使用

I found a tutorial from this website Steganography (it also include the code), and i want to put the four message into four difference part of image as i drew below link Four parties of image, but i am not sure how to exactly to put message to four of section. This is one part of the code i modified by using raster below

private byte[] get_byte_data(BufferedImage image) {
    WritableRaster raster = image.getRaster();

    int imageHeight=image.getHeight()/2;
    System.out.println("ImageHeight: "+imageHeight);
    int imageWidth=image.getWidth()/2;
    System.out.println("ImageWidth: "+imageWidth);
            DataBufferByte buffer = (DataBufferByte) raster.getDataBuffer();
    return buffer.getData();
}

如何将消息准确地放入我想要的部分?

How can i put the message into the exactly section i wanted?

推荐答案

我将提供

I will offer my answer from a previous related question of yours.

我在那里向您展示了如何在图像的每个R,G,B和A组件中隐藏不同的消息,方便地是4.要使用它,请将第一条消息嵌入R中并保存输出.然后加载该输出并将下一条消息存储在G中,然后重新保存输出.依此类推...由于每条消息都使用每种颜色成分,因此每条消息的最大大小为(p-32)/8.

There I showed you how you can hide a different message in each R, G, B and A component of an image, which conveniently is 4. To use it, embed the first message in R and save the output. Then load that output and store the next message in G and resave the output. And so on... Since each message makes uses of each colour component, each message can have a maximum size of (p - 32)/8.

优点:它可以有效地实现您想要的功能,代码已经在为您提供,并可能达到最大容量.

Pros: it effectively achieves what you want, the code is already there for you, maximum capacity possible.

缺点:由于加载->嵌入->保存x4方面,使用起来非常麻烦.

Cons: it's very slightly cumbersome to use due to the loading -> embedding -> saving x4 aspect.

现在,如果您真的很坚定,并且想将图像实际分为4个部分,则必须在代码中应用以下更改(从上一个问题开始,但从网站提供的原始内容开始):

Now, if you are really adamant and you want to actually split the image in 4 parts, you have to apply the following changes in the code (from the previous question, but start with the original as offered in the website):

  • 更改GUI,使其具有4个文本框.
  • 加载完整的图像后,在embedMessage方法中仅传递其四分之一.四个象限应具有坐标(0:maxX/2、0:maxY/2),(0:maxX/2,maxY/2:maxY),(maxX/2:maxX,0:maxY/2)和(maxX /2:maxX,maxY/2:maxY),其中maxX = yourimage.getWidth()maxY = yourimage.getHeight().您可以使用getSubimage方法对图像数据执行此操作.
  • Change the GUI so it has 4 text boxes.
  • After loading the complete image, pass on only a quarter of it in the embedMessage method. The four quadrants should have coordinates (0:maxX/2, 0:maxY/2), (0:maxX/2, maxY/2:maxY), (maxX/2:maxX, 0:maxY/2) and (maxX/2:maxX, maxY/2:maxY), where maxX = yourimage.getWidth() and maxY = yourimage.getHeight(). You can do this with the getSubimage method on your image data.

问题在于,对于每个象限,您仍要嵌入一个颜色分量,因此,每条消息的有效长度不能超过(p/4-32)/8,这几乎是我建议的容量的4倍方法.

The problem is that for each quadrant, you're still embedding in one colour component, so effectively each message cannot be longer than (p/4 - 32)/8, which is almost 4 times less the capacity than my suggested method.

通过在每个象限中嵌入所有R,G,B和A分量,可以实现上述最大容量.这也是我在链接的答案中向您展示的操作方法.

You can achieve maximum capacity as above by embedding in all R, G, B and A components for each quadrant. This is also something that I showed you how to do in my linked answer.

所有这些都需要进行一些代码修改,但是我已经为您提供了要进行更改的所有概念和逻辑结构.

All of this will require some code modification, but I have provided you all the concepts and logic structure for the changes you want to make.

专业人士:使用4个文本消息框很方便.

Pros: it's convenient to use with 4 text message boxes.

缺点:与上面的其他建议相比,将花费相同的最大容量进行修改编码.

Cons: it will take effort to code the modifications for the same maximum capacity compared to the other suggestion above.

这篇关于通过使用栅格将不可见的消息放在图像的四个部分中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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