Question: Using Matlab: Write a script entitled hiddenMessage.m that loads an image (provided on Canvas) and accepts a string from the user to embed in the

Using Matlab:

Write a script entitled hiddenMessage.m that loads an image (provided on Canvas) and accepts a string from the user to embed in the image. Take the string, convert it to binary and place the information in the image. Display the image to the user with the hidden message. You will need to plan your script and likely use the following structure: Ask the user for the image filename. Read the image into MATLAB using imread. Search the image for existing values equal to zero and replace them with ones (this will prevent having binary conversion problems later on). Ask the user for the message to embed. Recall that a string is a vector. Walk through each string value and convert the character to its binary equivalent (use a switch statement here). You will want to post these new values into another zeros matrix that is the same size as the image. Put each letter in the string on a new row. This is most likely the most difficult part... try and figure this out on your own before asking the TA for assistance. Hint: The indexing may look like c(s,1:8) when building your blank matrix. You may also need this:

a 01100001 n 01101110 b 01100010 o 01101111 c 01100011 p 01110000 d 01100100 q 01110001 e 01100101 r 01110010 f 01100110 s 01110011 g 01100111 t 01110100 h 01101000 u 01110101 i 01101001 v 01110110 j 01101010 w 01110111 k 01101011 x 01111000 l 01101100 y 01111001 m 01101101 z 01111010

Extra hint: One of the perks of programming is that you can utilize the power of a machine to automate tasks. Make use of your knowledge of fprintf(), and learn about ASCII and dec2bin() to circumvent manually typing out the table above. Next, scan your new matrix for values of 1 and set the corresponding points in the image to zero (black). Remember your image file is 3 layers deep: RGB (1st = red; 2nd = green; 3rd = blue). Now, display your updated image using image. Once youve gotten your final image, zoom into the upper left corner and locate your message. Using pencil and paper, decipher your message then show your zoomed image and decoded message to the TA. Note: the image on Canvas is the image that will be used to test the scripts, but any code that makes use of the image dimensions should NOT be hardcoded. Make use of the size() function.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!