Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given: One way to encrypt information is by encoding it into an image in a way t

ID: 668122 • Letter: G

Question

Given: One way to encrypt information is by encoding it into an image in a way that it is not recognizable. Two images are attached to this lab, monalisa.bmp and monalisa_encoded.bmp. If you subtract the two images and multiply the result by 255, a third image is revealed that contains another image.

Question: How can I write a MATLAB program that automatically decodes the message using the two images, displaying the resulting image? I guess I can't attach the two files but can someone help me with a code to solve this problem

Explanation / Answer

I have written the following MATLAB code in the easiest way possible using the built-in functions in the image toolbox with the MATLAB.

It follows the steps as given in the question.

1. Read the two images
2. Subtract the two images
3. Multiply the resulting image by 255
4. Display the final resulting image with the decoded message

% MATLAB Program to decode a message using two given images

img1 = imread ('monalisa.bmp');                           % Read the two given images using imread
img2 = imread ('monalisa_encoded.bmp');

decoded_img = imsubtract (img1, img2);               % Subtract the two images using imsubtract

decoded_img = immultiply (decoded_img, 255);    % Multiply the resulting image by 255

imshow(decoded_img);                                           % Display the decoded image with the message

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote