python图像隐写_使用Python解码隐写术图像(Wikipedia上的示例图像)

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值