我需要設置某些字節(來自圖像)的最低有效位。更改像素中的最低有效位
例如,我有一個寬度爲w和高度爲h的圖像。每個元素[w] [h]是一個像素。
對於紅色信道的樣本數據(其中,我想要設置的比特):
[0] [0] = 0101011
[0] [1] = 0101011
[0] [2] = 0101111
[0] [3] = 1111101
[0] [4] = 0101101
[0] [5] = 0110011
[0] [6] = 0101010
[0] [7] = 1101010
我想改變該位以粗體到00101010.
到目前爲止我的代碼:
Dim img As New Bitmap(TextBox1.Text)
For w As Integer = 0 To img.Width - 1
For h As Integer = 0 To img.Height - 1
Dim pixel As Color = img.GetPixel(w, h)
If w < 4 AndAlso h < TextBox2.Text.Length Then
Dim pix As Integer = pixel.R
Dim pix2bin As String = Convert.ToString(pix, 2).PadLeft(8, "0")
我該怎麼做?
我有點重新寫你的問題,以使其更清晰。如果你覺得它不代表你想問什麼,請隨時編輯它。 –
您可能會發現[將圖像RGB值的lsb值給出不一致的值](http://stackoverflow.com/a/26616856/1115360)可用。 –