0
public static void sample(BufferedImage image) {
int width = image.getWidth();
int height = image.getHeight();
int value[][] = new int[width][height];
int valueR[][] = new int[width][height];
int valueG[][] = new int[width][height];
int valueB[][] = new int[width][height];
for (int j = 0; j < height; j++) {
for (int i = 0; i < width; i++) {
int pixel = image.getRGB(i, j);
value[i][j] = pixel;
Color c = new Color(pixel);
valueR[i][j]= c.getRed();
valueG[i][j] = c.getGreen();
valueB[i][j] = c.getBlue();
System.out.println("Red value = "+valueR[i][j]);
System.out.println("Green value ="+valueG[i][j]);
System.out.println("Blue value"+valueB[i][j]);
}
}
}
上面的代码是将图像的RGB值和像素颜色值分别存储在数组中。查找像素位置
public static BigInteger modPow(BigInteger a1, BigInteger e, BigInteger n) {
BigInteger r = 1;
for (int i = e.bitLength() - 1; i >= 0; i--) {
r = (r.multiply(r)).mod(n);
if (e.testBit(i)) {
r = (r.multiply(a1)).mod(n);
}
}
System.out.println("C value = " + r);
int lng = 3;
BigInteger bi = BigInteger.valueOf(lng);
BigInteger a = r.divide(bi);
BigInteger b = r.mod(bi);
System.out.println("pixel position a = " + a);
System.out.println("modulus value b = " + b);
return r;
}
在上面的代码正在寻找像素位置,其中i需要嵌入秘密bit.so我需要去那个特定像素嵌入message.But在前面的代码正在存储像素颜色在数组值[] []。我需要搜索数组值[] []来获取我在上一代码中得到的像素位置。
注: A1是信息文件的当前位的嵌入 位置{E,N}是公钥
我的问题是如何找到的像素位置?
我假设你的意思是'a是当前位信息...'而不是'a1',但即使如此你的问题还不清楚。 “像素位置”是什么意思?你是否设想了一个编号系统,其中左上角的像素编号为1,而右下方的像素编号为“width * height”或类似的东西? – ach 2013-03-21 17:09:17