I'm trying to encrypt some images (as an example, not for real use), and part of the method uses DNA encryption. For this, I have to convert the uint8 matrix that the image greyscale values are stored in (for R, G, and B, I separate them beforehand) to binary.
The code I'm running is:
message_Image = imread ('baboon.tiff');
message_Image_R = message_Image(:,:,1);
message_Image_R_bin = dec2base(message_Image_R,2,8)
The value of message_Image_R(1,1) is 164 (a uint8)
The first value that message_Image_R_bin prints out in the command window upon execution is '01010100'. This, however, is 84 (164 in binary is '10100100')
When execute dec2base(164,2,8), it results in '10100100'. Thus the code works fine on the individual number, but not on the matrix.
What am I doing wrong here?