I am getting an error while embedding text file inside the image that is Inputs must be numeric. Error in gliomatextfile (line 17) modifiedImage = bitset(image, bitPlane, bi
% Read the image
image = imread('image.jpg');
% Convert the image to uint8
image = im2uint8(image);
% Read the text file
fid = fopen('textfile.txt', 'r');
textData = fread(fid, '*char');
fclose(fid);
% Convert the text data to binary
binaryData = dec2bin(textData, 8)'; % Each character represented as an 8-bit binary string
% Reshape the binary data to a column vector
binaryData = binaryData(:);
% Embed the binary data into the image using LSB steganography
bitPlane = 1; % Choose the bit plane to modify (1-8, typically use 1 or 8 for LSB)
modifiedImage = bitset(image, bitPlane, binaryData);
% Display the modified image
imshow(modifiedImage);
title('Modified Image with Embedded Text');
% Save the modified image
imwrite(modifiedImage, 'image_with_text.jpg');
0 Comments
Accepted Answer
0 Comments
More Answers (0)
See Also
Categories
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!