- Details
- Parent Category: Programming Assignments' Solutions
We Helped With This MATLAB Programming Assignment: Have A Similar One?
Short Assignment Requirements
Assignment Description
Homework 2
Math/InfAs/CprE 535
Spring 2019
On-campus due date: Thursday Feb. 28, 2019
Off-campus due date: Monday, March 4, 2019
Please submit a zipped file, which contains all your write up (including Problem 1) and codes to Canvas. Be sure to include all images requested for Problem 2-5. Do not include images generated from Problem 1. Those will be uploaded to CyBox.
1. Image Data Collection. You need two different smartphones as your devices for data collection: (You can use your own cell phone as Camera I, and borrow another cellphone for Camera II. For those who don’t have access to a second device, please email Dr. Newman at ..., and she will provide you with an old cellphone from the lab, if you are on campus):
(1) Collect 90 JPEG image files from Camera I, and 40 JPEG images from Camera II. For the 90 JPEG images from Camera I, make sure 50 of them are flat-field images and the rest 40 are all natural scene images. For the 40 images from Camera II, make sure they are all natural-scene images. AVOID pictures of sensitive nature: Don’t have people in your pictures, private information such as names, addresses, etc. or other pictures of an inappropriate nature.
(2) Rename all your images with the following labeling:
Camera_1_CameraModelName_flat_1.jpg
…
Camera_1_CameraModelName_flat_50.jpg
Camera_1_CameraModelName_natural_1.jpg
…
Camera_1_CameraModelName_natural_40.jpg
Camera_2_CameraModelName_natural_1.jpg
…
Camera_2_CameraModelName_natural_40.jpg
Example: Camera_1_iPhone7_flat_1.jpg, etc.
(3) Record the models/types of cameras used for your experiment and describe in a short paragraph in your write up.
(4) Include a description about how your process to obtain the flat-field images and natural-scene images.
Upload the images you collect to the Cybox link (don’t upload to Canvas) that I will share with you. Each of you will create a folder in the Cybox folder called
yourfirstnameLastinitial_HW2_Images Example:
JenniferN_HW2_Images
In that folder, create 2 subfolders called Camera_1 and Camera_2. In this folder
(yourfirstnameLastinitial_HW2_Images), please also put a .txt file or a boxnote, where you describe the two models of cameras you used in your data collection.
In the folder Camera_1, put your 50 flat-field images from your camera and 40 natural scene images. In the folder Camera_2, put 40 natural scene pictures taken with Camera_2.
2. Implement LSB replacement. Your goal for this problem is to generate a stego image using LSB replacement. Be sure to implement the algorithm on the pear and onion gray images in HW.2_Images folder. You may use the formula in image algebra in the slides, or you can develop your own approach.
What to submit: a function m-file that has form:
function [stego] = embedLSB(imagepath, payloadlength)
where imagepath is a path to an image file on the computer; payloadlength is 50 or 75. For the output, stego is the resulting stego image.
and a separate script file to run it.
(a) Create an array M the same size as the image. The matrix M will hold the payload or message bits. Generate random 0s and 1s and store them in the matrix M. Then, embed the top half of the matrix M into the first 50% of the least significant bits of the cover image, lexicographically (row-wise: left to right, top to bottom of the array, or column-wise: top to bottom, left to right). This produces a stego image – call it stego2a.png - whose payload is contained in the first 50% of the bits of the cover image. (The remaining gray values of the stego image are the same as the cover image.)
(b) For the second experiment, do as in part (a), but use 75% of M. Embed the top ¾ of M into the cover image, lexicographically. This produces a stego image – call it stego2b.png - whose payload is contained in the first 75% of the bits.
a. What percentage of ones and zeros are in the original cover image you used?
b. What percentage of ones and zeros are in the matrix M?
c. What percentages of ones and zeros are in the top half of M that was written to stego2a.png?
d. What percentages of ones and zeros are in the top half of M that was written to stego2b.png?
We will revisit these numbers later.
3. Generate the p-graph for the two stego images generated from Problem 2: You must use the image provided with the homework: pears_gray.png. Generate 3 stego images with different embedding rates (percentages of embedded bits): 10%, 50% and 75%.
The code chisq.m is also provided in the Code folder on Canvas. Run chisq.m on your cover and stego images. Let j be an integer between 1 and 100, and for a fixed image, lexicographically read j% of your stego image’s gray values into a column vector. Pass this column vector ((*,1) is a column vector) to chisq.m. The variable in chisq.m that stores the column vector is B. chisq.m returns a number between 0 and 1.0, called the p-value for that percentage of image gray values. For an input of j%, let 𝑝"be the number that chisq.m returns. Do this for every j value from 1 to 100, and plot the set of points {$𝑗, 𝑝"’:𝑗 = 0, … ,100}. (Note that (0,0) is already a point on the plot.) That produces the p-graph as shown in class. It may look very different for different input images. You can run different images through chisq.m to get an idea of the different p-graphs possible. Don’t turn in these extra runs though.
Turn in: m-file and script to run it. In your write-up, display the input image and the 3 stego output images and the corresponding p-graphs for the cover and stego images (you should have 4 p-graphs in total.
4. Following the example in class of calculating the matrix corresponding to the von Neumann template on a 3X4 pixel array X, in this problem you will create the matrix corresponding to a different template on a different sized array , namely, the averaging template. Display all matrices in your write up. You may use the computer to calculate the inverse matrices; turn in all m-files used to solve this problem.
a. On X = 6x6 array, write down the 36 x 36 matrix that corresponds to the averaging template on X, with circulant edges instead of truncation.
b. Does this matrix have an inverse? If so, calculate it.
c. Do the same for the averaging template on X = 5x5 array. What is its inverse, if it exists?
d. Try this with a few more different sized arrays X, perhaps even non-square arrays. What is your conjecture about which inverse matrices you can find? (Hint: read the IA pdfs.)
5. Extra credit. For a matrix that you can find an inverse, what are the corresponding template images? Can you write a commutative diagram with corresponding images describing this relation? Can you display the template image in the image domain?