Assignment 1

.pdf

School

Western University *

*We aren’t endorsed by this school

Course

4445

Subject

Mechanical Engineering

Date

Dec 6, 2023

Type

pdf

Pages

3

Uploaded by DrWater10265

Report
ECE4445 / MBP4445 / ECE9201 / ECE9021 / BME9509 / MBP9509 Fall 2023 Page 1/3 INTRODUCTION TO DIGITAL IMAGE PROCESSING ASSIGNMENT 1 Due date: Friday, October 6, 2023 by 11:55 pm Total marks: 5 Late penalty: 0.5 marks per day overdue. Late assignments will not be accepted after 11:55 pm on Monday, October 9, 2023, and a mark of zero will be given. All assignments will be done in groups of 4 , and the same final mark for the assignment will be assigned to all group members; there may be one group with fewer than 4 students because of the number of students in the course. Currently, you have all been randomly placed in groups. Please see the Appendix on how to check in OWL which group you are in. The group names are of the form “AssignmentGroup - #” where # is an integer. You are required to stay in the same group for each subsequent assignment. The rationale for creating groups randomly is to encourage you to meet others beyond those with whom you normally work/socialize. Besides, it s good preparation for the work environment where you will need to work with new people. Group members may interact with each other either in-person or using Zoom or any other web conferencing tool of your choice. Note : An institutional version of Zoom is available to Western students that does not have some of the limitations of the free version. Instructions on using the institutional version can be found at: https://wts.uwo.ca/zoom/getting_started.html If you are an auditor , you have not been assigned to a group and are not required to submit the assignment; you may do it on your own and check the results when solutions are posted online. 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, hence if you submit a new version after the due date, you will be marked as late. I recommend that all group members 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. OBJECTIVES 1. To meet others in the class to foster collaboration. 2. To gain experience with writing functions in MATLAB using programming statements ( function , for , etc). 3. To help you become familiar with MATLAB’s help facilities. 4. To reflect on ways that you can continue to keep abreast of changes in image processing tools. PROBLEMS 1. Write a MATLAB function that accepts a uint8 image matrix called im and a 1 x N vector v of strictly increasing positive integers (not necessarily of type uint8 ); N is the length of vector v . This function should
ECE4445 / MBP4445 / ECE9201 / ECE9021 / BME9509 / MBP9509 Fall 2023 Page 2/3 return as output a 1 x ( N -1) row vector, y , where y(i) is the total number of pixels in im that satisfy v(i) ≤ im < v(i+1) . The function header should be: function y = countGL_#( im, v ) where # is your group number. For instance, if you are part of AssignmentGroup-01, your filename would be countGL_01.m . If you are part of AssignmentGroup-27, your filename would be countGL_27.m . You may only use the following MATLAB keywords, functions and operators: for … end, sum, &, >=, <, length, if…end , function, size, zeros You are not required to use all the above, only as many commands as you think you need. You can also use any other operator found by typing: help ops You are not allowed to use the imhist function. The rationale for these restrictions is to require use of C-like programming statements and basic MATLAB operators that do not rely on any specific toolbox. For all assignments, you may assume that the user has entered the correct number and types of inputs to the function since we are focusing on image processing instead of input parsing. All code and answers requested below must be submitted using OWL. I have included instructions here and will do so for every assignment. 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 1”. 4. You will now reach the submission page for Assignment 1. Follow the instructions below for each part to submit answers. (a) [3 marks] Save the function in a file called countGL_#.m where # is your group number. For instance, if you are part of AssignmentGroup-01, your filename would be countGL_01.m . If you are part of AssignmentGroup-27, your filename would be countGL_27.m . NOTE: Use the exact filename and function name as specified above. Uppercase/lowercase is important. Your function should be commented. When you are on the submission page in OWL for Assignment 1, scroll to the bottom and attach your M-file. Also, cut and paste this code into the text box taking care to label this as part 1(a). (b) [0.25 marks] Generate a test image using the following set of MATLAB commands: >> row = uint8(0:255); >> im = repmat(row, 100, 1); Now, create a stem plot of the number of pixels at each graylevel 0, 1, …, 255 in im by typing the following: >> stem( 0:255, countGL_#(im, 0:256)) >> set(gca, 'xlim', [0, 255], 'ylim', [0, 150]) >> title('Assignment 1', 'fontsize', 16)
ECE4445 / MBP4445 / ECE9201 / ECE9021 / BME9509 / MBP9509 Fall 2023 Page 3/3 >> xlabel('Gray level') >> ylabel('No. Pixels') Note: In the first command (i.e., stem ) the # symbol will be replaced with your actual group number. What you have generated is the gray- level histogram of an image with “bin size” of 1. Histograms will be discussed in class after we finish our discussion of MATLAB. Once you generate the stem 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 “1 b _#” without quotes where # is your group number. This will save the figure in the file called “1 b_ #.tif”. Attach it in OWL as you did the M-file. (c) [0.25 marks] What would you type at the MATLAB prompt to find the total number of pixels in the test image im from Part (b) using the function countGL_# ? Enter your answer in the text box on the assignment submission page, taking care to label this as part 1(c). 2. [1 mark] Image processing software is constantly evolving, and this includes the MATAB Image Processing Toolbox. Hence, if you decide to work in image processing and you use MATLAB, you will need to learn new functionality throughout your career. Find and provide a list of resources you can use to learn new functionality in MATLAB. Limit your answer to half a page. Enter your answer in the text box on the assignment submission page, taking care to label this as part 2. 3. [0.5 marks] For each group member, indicate by one sentence or even just a few words what the member did for this assignment. Roles could include programming, testing, answering particular questions, proofreading, etc. Enter your answer in the text box on the assignment submission page, taking care to label this as part 3. APPENDIX: Checking Assignment Group Membership Below are instructions for checking your group membership. Step 1: Log into OWL and click on Site Info. Step 2: Click on the section near the bottom of the page that is labelled Groups you are a member of . Step 3: Your group’s name should come up. You should note th e group number as you will need it for the assignment. If you click on the link labeled “ View Members”, you will see other members of the group.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help