How to retrieve an embedded image from a .png image?

12 次查看(过去 30 天)
Hello, I have a university steganography project where I need to retreive a hidden image from a .png RGB image. The embedded image is hidden in the LSBs of the original .png image. I am having problems extracting the hidden information from the image, does anyone have a code that does a similar function?
Thank you

采纳的回答

Abhisek Pradhan
Abhisek Pradhan 2020-6-3
Considering it as an 16-bit image. The primary image is stored in the most significant byte, while the secondary image is stored in the least significant byte.
Decomposing the image :
imdata = imread('image.png');
Converting RGB 3-D Array to a Vector and typecasting to unit8 (in case the hidden image is stored in the 8 LSBs ).
pixelVals = imData(:);
pixelValsConv = typecast(pixelVals, 'uint8');
Separating both the images:
% This generates a 2D array with first column denoting the most significant digit and the second column
% denoting least significant digit.
pixelValsConv = reshape(pixelValsConv, 2, [])';
imDataPrimary = reshape(pixelValsConv(:, imOrder(1)), size(imData));
imDataSecondary = reshape(pixelValsConv(:, imOrder(2)), size(imData));
Displaying both the images:
figure;imshow(imDataPrimary);
figure;imshow(imDataSecondary);

更多回答(0 个)

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by