简体   繁体   English

一个像素可以嵌入多少位(最大位数)?

[英]How many bits(maximum number of bits) can be embedded in a pixel?

I have an gray scale image of sixe 512x512. 我有一个Sixe 512x512的灰度图像。 Thus, each pixel contains 8 bits. 因此,每个像素包含8位。 Can I embed a total of 8 bits into the pixels I wish to embed data in? 我可以在希望嵌入数据的像素中总共嵌入8位吗? Is this possible? 这可能吗? (I require the image only for embedding data). (我只需要图像用于嵌入数据)。 In case I want to embed data in 10,000 pixels out of the total 512*512 pixels, can I then in total embed 80,000 bits of data or 10kB of data? 如果我要在总共512 * 512像素中以10,000像素嵌入数据,那么我可以总共嵌入80,000位数据或10kB数据吗?

A standard grayscale image with 256 levels for each pixel requires 8 bits per pixel. 具有每个像素256级的标准灰度图像需要每个像素8位。 This is because 8 bits are required to encode 256 different levels. 这是因为需要8位来编码256个不同的级别。 If you have an image with dimensions 512 x 512 then the total number of pixels in the entire image is 262,144 pixels. 如果您的图像尺寸为512 x 512,则整个图像中的像素总数为262,144像素。 So, the entire image contains 8 bits * 262,144 = 2,097,152 bits worth of information. 因此,整个图像包含8位* 262,144 = 2,097,152位的信息。

If you were to take a subset of these pixels and encode 8 bits of "different" information, note that the resulting image would likely change in appearance. 如果要获取这些像素的子集并对8位“不同”信息进行编码,请注意,生成的图像外观可能会发生变化。 The 8 bits of information at each pixel coordinate previously encoded the pixel intensity (from 0 to 255). 每个像素坐标处的8位信息预先编码了像素强度(从0到255)。 If you are replacing this value with some other value then the intensity will be different and the overall image will appear different. 如果将此值替换为其他值,则强度将有所不同,并且整个图像将显示为不同。

If you want to embed 10KiB of data in a 512x512 image, where the bit depth is 8 bits, I'd recommend just storing 1 bit of data in every second pixel by changing the LSB of each. 如果要将10KiB数据嵌入到位深度为8位的512x512图像中,建议通过更改每个像素的LSB在每第二个像素中仅存储1位数据。

Changing just 1 bit of data from every other pixel allows you to store (512*512*1)/2 bits of data, or 16KiB of data. 每隔一个像素仅更改一位数据,就可以存储(512 * 512 * 1)/ 2位数据或16KiB数据。 This way you can store all of the data that you need to while only changing the image in a very limited way. 这样,您可以存储所需的所有数据,而仅以非常有限的方式更改图像。

As an example, here's an image with varying amounts of white-noise embedded within it (by embedding n bytes per pixel), you can see how much noise(data) is embedded in the table below: 例如,这是一张图像,其中嵌入了不同数量的白噪声(通过每个像素嵌入n个字节),您可以看到下表中嵌入了多少噪声(数据):

图片

X | Y | bits used | data(KiB)
0 | 0 | 0         | 0
1 | 0 | 1         | 32
0 | 1 | 2         | 64
1 | 1 | 3         | 96
0 | 2 | 4         | 128
1 | 2 | 5         | 160
0 | 3 | 6         | 192
1 | 3 | 7         | 224
_ | _ | 8         | 256 (image omitted as just white noise)

As can be seen, embedding up to 64KiB of data into a 512x512x8 image is perfectly reasonable expecting little noticeable change in the image by editing the 2 LSB of each pixel, so that a pixel is encoded as: 可以看出,将最大64KiB的数据嵌入到512x512x8的图像中是完全合理的,并且期望通过编辑每个像素的2 LSB来在图像中产生很少的明显变化,因此将像素编码为:

XXXX XXYY

Where X came from the original image, and Y is 2 bits of the stored data. 其中X来自原始图像, Y是存储数据的2位。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM