MATLAB: How to convert the color image into binary sequence

binaryimage processingImage Processing ToolboxMATLABsequencewatermark

I am M.Tech scholar and working on watermarking. I imported color immage of size 512*512 and i want to convert that color image into binary sequence and that sequence has used in embedding of watermark.
Then, how to convert image into binary sequence?

Best Answer

Provided that your image is not logical() [possible for some black and white images in some image formats], and is not character or string (no known image file formats) then
binary_sequence = reshape(dec2bin(typecast(YourImage, 'uint8'), 8) - '0', 1, []);
This will not have any watermark embedded in it: this is what you use to get a binary sequence of the watermark in preparation for embedding it into an image.
The way to embed bits in an image depends upon your embedding technique and data class, but often involves bitset()