使用Python解码隐写术图像(Wikipedia上的示例图像) [英] Using Python to Decode Steganography Images (example images at Wikipedia)

查看:100
本文介绍了使用Python解码隐写术图像(Wikipedia上的示例图像)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

维基百科的隐写术文章中,有一个示例图像,其中包含隐藏的图像数据. /p>

维基百科注释:

一棵树的图像,其中包含隐秘的隐藏图像.通过除去每个颜色分量的除两个最低有效位以外的所有剩余位并随后进行归一化,可以显示隐藏的图像.隐藏的图像显示在(在此处).

问题::我对后续规范化"感到困惑;假设基于PIL模块的Python 2.x代码正常工作,归一化如何影响检索?

解决方案

后续规范化为线性插值.

说,像素1,1的红色分量是234.

234的二进制表示形式是

In [1]: bin(234)
Out[1]: '0b11101010'

我们可以通过按位操作删除除最低两位以外的所有内容:

In [2]: bin(234 & 0b11)
Out[2]: '0b10'

8位图像的范围是8位或256个可能的阴影.但是我们的颜色值范围只有2位或4种可能的阴影.

归一化部分正在进行线性插值以拉伸2位值以填充8位空间:

In [3]: (234 & 0b11) * (256/4)
Out[2]: 128

在每个颜色组件上执行此操作,猫就会出现.

At Wikipedia's Steganography Article there is an example image given with hidden image data.

Wikipedia notes:

Image of a tree with a steganographically hidden image. The hidden image is revealed by removing all but the two least significant bits of each color component and a subsequent normalization. The hidden image is shown (here).

QUESTION: I'm confused about "subsequent normalisation"; assuming working Python 2.x code based on PIL module, how does normalisation factor into the retrieval?

解决方案

The subsequent normalization is linear interpolation of each color component.

Say, the the red color component of pixel 1,1 is 234.

The binary representation of 234 is

In [1]: bin(234)
Out[1]: '0b11101010'

We can remove everything but the two least significant bits with some bitwise operation:

In [2]: bin(234 & 0b11)
Out[2]: '0b10'

The range of a 8-bit image is 8-bits or 256 possible shades. But the range of our color value is just 2-bits or 4 possible shades.

The normalization part is doing linear interpolation to stretch the 2-bit value to fill 8-bit space:

In [3]: (234 & 0b11) * (256/4)
Out[2]: 128

Do this is done on each color component and the cat would appear.

这篇关于使用Python解码隐写术图像(Wikipedia上的示例图像)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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