## Matlab

Moderators: None (Apply to moderate this forum)
Number of posts: 2147

This Forum Only

New in Matlab. Need some help. Plz plz someone help me. Urgent !!!! Posted by abhi1112 on 8 Dec 2011 at 12:12 PM
Coursework Part 1: LSB Steganography in Spatial Domain (50%)
In this part of coursework, you need to implement an LSB steganographic system in spatial domain, which should cover different ways of hiding and extracting texts and binary images (e.g. logos) into an image. You also need to demonstrate how steganalysis can be done on different settings of your LSB steganographic system. The detailed tasks are listed as follows:
 Implement a MATLAB function for LSB embedding. This function should match the following description.
o The interface should be function stego_image = LSB_embed(cover_image, plaintext, key_embed, key_encrypt, channel).
o The function embeds a (possibly encrypted) plaintext in a particular channel of a (true-color or gray-scale) cover image and returns the stego-image.
 Hint 1: Use num2bit function in the Crypto package to convert a textual message into a bitstream for embedding.
 Hint 2: The size of the plaintext can be obtained by size function. You should check if the plaintext size exceeds the maximum capacity of the cover image. If this happens, return with an error message.
o The plaintext is embedded into the cover image by substituting the LSBs of selected pixels.
o When key_embed is empty, use the sequential path for embedding.
o When key_embed is not empty, use it to generate a random path for embedding.
 Hint: To generate a random path, first invoke the RC4 cipher in the Crypto package to produce a pseudorandom byte-stream and then invoke sort function to get the random path (the second output argument of sort function). To this end, you will need to send the RC4 cipher a 1-D plaintext having the same number of elements as the cover image. To make your code simpler, you are recommended to use a zero matrix zeros(1,numel(cover_image(:,:,channel))). Remember to use the same at the extractor side to reproduce the same pseudorandom byte-stream.
o When key_encrypt is not empty, the plaintext should be encrypted before embedding. You can use the MATLAB Crypto package in ULearn.
o The last three input arguments should have default values: key_embed = '', key_encrypt = '', channel = 3 (true-color image: blue channel) or 1 (gray-scale image: the only channel). This means that the function can be invoked without giving the last three arguments or part of them.
o If the plaintext exceeds the maximum capacity of the cover, print an error and return the cover image without embedding.
 Implement a MATLAB function for extracting the hidden message from a stego-image returned by your LSB_embed function. This function should match the following description.
o The interface should be function plaintext = LSB_extract(stego_image, plaintext_size, key_embed, key_encrypt, channel).
o The second input argument plaintext_size should be a scalar for embedded texts and a 2-tuple vector for embedded binary images.
4
 Example 1: plaintext_size = 200 for an embedded textual message “I am living in Guildford!”
 Example 2: plaintext_size = [256 256] for an embedded binary image of size 256×256.
o The output argument should be converted to a string or a binary image according to the number of elements in plaintext_size.
 Hint: Use bit2num function in the Crypto package and the MATLAB built-in function char to convert an extracted bitstream into a textual string. Use MATLAB built-in function reshape to convert an extracted bitstream into a 2-D binary image.
o If the plaintext denoted by plaintext_size exceeds the maximum capacity, print a warning and use the maximum capacity to extract the hidden text/binary image.
 Given a textual message and a binary image of your own choice, demonstrate the above two functions work as expected.
 Calculate the PSNR values of the stego-images with respect to the original image after the textual message and the binary image are embedded. Estimate the tight lower bound of the PSNR value of the stego-image both analytically and experimentally.
 Steganalysis of LSB steganography
o Demonstrate the visual attack can reveal the existence of a hidden plaintext in a stego-image under some settings. Explain why.
o Demonstrate how the histogram may be used to reveal the existence of a hidden plaintext in a stego-image. Explain why.
o (Optional, 5% bonus mark) Demonstrate how POV steganalysis can detect a fully embedded stego-image when the plaintext is encrypted to have a balanced distribution of zero and one bits. Explain why.
 Hint: Use the MATLAB built-in function chi2cdf to calculate the p-value.
5
Coursework Part 2: Robust Watermarking in DCT Domain (50%)
In this part of coursework, you need to implement a robust watermarking scheme in transform (DCT) domain, which should cover both watermark embedding and detection processes. You also need to demonstrate how robust the watermarking scheme is to some image processing operations and why it does not survive some others. The detailed tasks are listed as follows:
 Implement a MATLAB function for embedding a watermark into a gray-scale image. This function should match the following description.
o The interface should be function watermarked_image = watermark_embed(image, watermark, key_embed, coeff_list, d).
o The function embeds a watermark into an image in the following steps:
 Step 1: Apply 8×8 blockwise 2-D DCT to the image.
 Step 2: If key_embed is not empty, generate a random path (using the same method in Coursework Part 1) of selected blocks; otherwise use the sequential path of selected blocks.
 Step 3: Convert the watermark into a bitstream (if it is not) and embed each watermark bit into a selected DCT coefficient of a selected DCT block. The DCT coefficients that can be used in each block are fixed and defined by coeff_list. For a selected DCT coefficient c and a watermark bit w, use the binary Quantization Index Modulation (QIM) approach to get the watermarked coefficient: c’=(round(c/(2d)-w/2)+w/2)*2d.
 Step 4: Apply 8×8 blockwise 2-D IDCT to the manipulated DCT coefficients to get the watermarked image.
o The input argument coeff_list represents the zigzag indices of the selected DCT coefficients in the 8×8 block.
 Hint: You can use the zigzagN function available in ULearn to get the index of the i-th (i=1, …, 64) DCT coefficient in an 8×8 block.
o The last two input arguments should have default values: coeff_list = 32 (only one mid-frequency coefficient), d = 8.
o If the plaintext exceeds the maximum capacity of the cover, print an error and return the cover image without embedding.
 Implement a MATLAB function for extracting the watermark from a watermarked gray-scale image.
o The interface should be function watermark = watermark_extract(watermarked_image, watermark_size, key_embed, coeff_list, d).
o The second input argument watermark_size should be a scalar for texts and a 2-tuple vector for binary images as embedded watermarks. (The same requirement as in Coursework Part 1.)
o The output argument should be converted to a textual string or a binary image according to the number of elements in watermark_size.
o If the plaintext denoted by watermark_size exceeds the maximum capacity, print a warning and use the maximum capacity to extract the hidden text/binary image.
 Given a textual message and a binary image (e.g. a logo) as the watermarks, demonstrate the above two functions work as expected.
6
 For different values of d, calculate the PSNR values of the watermarked images with respect to the original image after the textual message and the binary image are embedded. Estimate the tight lower bound of the PSNR value of the stego-image both analytically as a function of d.
 Using a binary image as the watermark, demonstrate that the watermarking scheme is robust to some image processing operations but not the others. Use the correlation coefficient (MATLAB built-in function corr2) as the performance indicator of the robustness. The following image processing operations should be considered.
o Lossy JPEG compression with different quality factors.
 Hint: Use MATLAB built-in function imwrite.
 Hint: Use MATLAB built-in function imnoise.
o Image scaling.
 Hint: Use MATLAB built-in function imresize.
o Image cropping.
 Hint: No special MATLAB built-in function is needed. Make sure the cropped image’s width and height can still be exactly divided by 8, otherwise you need to pad the image to make blockwise DCT possible.
 Demonstrate how the watermarking scheme’s robustness changes with respect to the following factors: 1) the value of d; 2) the choice of selected DCT coefficients (the number of coefficients and their locations – low-frequency, mid-frequency or high-frequency bands); 3) the size of watermark embedded.
 (Optional, 5% bonus mark) Implement another (robust or fragile or semi-fragile) DCT watermarking algorithm you learned from this module or read from a research paper or designed by yourself.
o Hint: Do not forget the embedding methods you learned in the steganography part. They can be also used for watermarking. Explain if you get a robust watermarking scheme or a fragile one if you use an embedding scheme for steganography.

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic