Matlab代写|Assignment代写 - INTRODUCTION TO DIGITAL IMAGE PROCESSING
时间:2020-11-18
All assignments will be done in groups of 3, and the same final mark for the assignment will be given to all group members. You should stick with the same group as for previous assignments. Instructions for submitting answers are given with each question below. Note that I allow you to keep resubmitting until the deadline. Only the last submission is available to the TAs for marking. I recommend that all group members should agree to a submission before uploading it. Only one person in the group needs to submit on behalf of the entire group. CONVENTIONS Fixed-point font (Courier) is used to denote MATLAB commands, variables and filenames. OBJECTIVE 1. To use an implementation of the background removal function discussed in class. 2. To automate the background removal function discussed in class. All code and answers requested below must be submitted using OWL. To provide answers via OWL: 1. One group member should log into OWL and access the course site. 2. Select the “Assignments” tool. 3. From the page that comes up, select “Assignment 4”. 4. You will now reach the submission page for Assignment 4. Follow the instructions below for each part to submit answers. PROBLEMS 1. (a) [0.1 marks] A MATLAB function implementing the background removal code that is based on our discussion in class is on the course OWL site; it is available with Module 5 on Algebraic Operations and is uploaded with this assignment. It is called level.m. Apply this function to the image ‘rice.png’ that is available as part of the MATLAB image processing toolbox. Display the levelled image (i.e., image with background removed). Once you generate the display, you should save the display by selecting “File” in the figure window and then “Save As…”. In the dialog box that comes up, select “TIFF image (*.tif)” as the output type and for “File name”, enter “1a_#” without quotes where # is your group number. For instance, if you are part of group 1, your function name would be autolevel_1. If you are part of group 50, your filename would be autolevel_50. This will save the figure in the file called “1a_#.tif”. When you are on the submission page in OWL for Assignment 4, scroll to the bottom and attach your image. (b) [0.2 marks] What did you estimate the coefficients ai, i = 0, 1,…,5, to be? Would you expect these to be identical to what other groups found? Explain your answer. Write your answer in the text box on the submission page for Assignment 4 taking care to label this as part 1(b). ECE4445 / MBP4445 / ECE9201 / ECE9021 / BME9509 / MBP9509 – Fall 2020 – Page 2/3 (c) [0.2 marks] Using the ‘plot’ command, plot a vertical profile through column 50 of the original unlevelled image as a dashed curve.1 On the same axis, plot a vertical profile through column 50 of the levelled image as a solid curve. You may need to use the help facility in MATLAB to learn more about the plot command, including how to specify line types (dashed or solid) and how to plot on the same axis. Once you generate the plot, you should save the display by selecting “File” in the figure window and then “Save As…”. In the dialog box that comes up, select “TIFF image (*.tif)” as the output type and for “File name”, enter “1c_#” without quotes where # is your group number. This will save the figure in the file called “1c_#.tif”. Attach the image in OWL on the submission page for Assignment 4. (d) [0.2 marks] Based on the plot you made in Question 1(c), explain whether or not the function level is working correctly. Write your answer in the text box on the submission page for Assignment 4 taking care to label this as part 1(d). 2. In the level function, the user is asked to interactively select points in the background of the image to be levelled. In order to find background pixels automatically, one can break the image up into M x N non￾overlapping blocks and find the minimum value and its coordinates in each block. The minimum value in each block and its coordinates can be used as background pixels. Modify the level function so that background pixels are found automatically, and no user interaction is required. You will have to select appropriate values of M and N, and these can be hardwired into your code. The modified function should display the original (unlevelled) image with selected points superimposed. This new automated levelling function should have the header: function [im2, a] = autolevel_#(fname) where # is your group number. HINTS: (i) To find the minimum value in a sub-matrix extracted from an image, you can apply the MATLAB function min twice. Part of the exercise is for you to figure this out. (ii) To plot points on top of a displayed image, you should use the hold function as follows: imshow(im) hold on plot(x, y, ‘y+’) (a) [4 marks] Save the function in a file called autolevel_#.m, where as before # is your group number. NOTE: Use the exact filename and function name as specified above. All letters are in lowercase. Your function should be commented. Attach the M-file in OWL on the submission page for Assignment 4. Also, cut and paste this code into the text box and label it as 2(a). (b) [0.1 marks] Display the original image (‘rice.png’) and the points automatically selected by your function. Once you generate the display, you should save the display by selecting “File” in the figure window and then “Save As…”. In the dialog box that comes up, select “TIFF image (*.tif)” as the output type and for “File name”, enter “2b_#” without quotes where # is your group number. This will save the figure in the file called “2b_#.tif”. Attach the M-file in OWL on the submission page for Assignment 4. 1 A vertical profile through column 50 refers to a plot of gray levels in column 50 versus the row number. You can plot a vertical profile through column 50 of image im with a dashed black line using the command: >> plot(1:size(im,1), im(:,50), 'k--') ECE4445 / MBP4445 / ECE9201 / ECE9021 / BME9509 / MBP9509 – Fall 2020 – Page 3/3 (c) [0.2 marks] In your automatic levelling function, what values of M and N did you use? Explain your rationale for using the particular values of M and N. Write your answer in the text box on the submission page for Assignment 4 taking care to label this as part 2(c). Each group should only make one submission. In the text box on the assignment submission page, enter the name and student number of each group member. MATLAB RESOURCES All MATLAB guides can be found at: http://www.mathworks.com/access/helpdesk/help/helpdesk.shtml which can also be accessed by typing doc at the MATLAB prompt. For information on the image processing toolbox, select the link labelled “Image Processing Toolbox”.