MATLAB: Watermarking

image processingwatermarking

i have a question regarding to grayscale image. i have a stream of bits which i get from the original image. i get some bits that i need and i put them into an array. the value of array is like :
myarray = [01010111110101010101 ... ]
but my question is, i want to recover this array to grayscale image how can i do this ?
i think, i need something like "convert bits to image!"
Thanks in advance

Best Answer

What's the type of myarray? Is it a double vector? Does "0101" mean "[0, 1, 0, 1]" actually?
Additional information is required: How are the dimensions of the image defined? Does the bit stream contain header data or the pixel values only? Is the original an 8, 16 or 24 bit greyscale image?
Possibly this solves the problem:
x = rand(1, 1600) > 0.5; % Test data
y = 2.^(0:7) * reshape(x, 8, []); % Bits -> Bytes
image = uint8(reshape(y, 20, 10)); % -> [80, 20] UINT8 grey scale image
Related Question