Matlab tutorial course Exercises 2:
Exercises Copy the script ‘face_points.m’ from my webpage into your ‘scripts’ folder Create a new folder in your MATLAB folder called ‘data’ Copy the file ‘face_points.mat’ from the ‘data’ folder on my webpage into the folder you’ve just created – Run the script, look at the figures it produces Now go through the script line by line – Can you work out what each line does? The comments should help! – Make a note of all the variables assigned to – Make a note of all the functions called – Make a note of when and how arrays are indexed and assigned – Make a note of where element-wise or matrix processing is used
Exercises Try modifying the script changing pt_xy or changing how much the face is rotated by Change the script into a function that takes ‘pt_xy’ and ‘theta’ as input arguments Change this function so that it produces output ‘min_dist’ – the minimun distance of ‘pt_xy’ to a point on the face Use your new function to answer the follow questions: – If pt_xy = [40, -50], which point on the face is it nearest too? – How far is it from this point? – Generate a plot of the face upside-down - save this figure: Click ‘File’ -> ‘Save as’ Change ‘Save as type’ to ‘Portable Network Graphics file (*.png)’ Give it a suitable name and click ‘save’ When you’ve tried writing your own function, you can download mine for a sample answer And if you’re wondering what this has to with image, check out this video on youtube of a mobile face-tracking app developed in this department in 2010 –