Question: Using Matlab Create a script m-file which displays an image variable where the border of the image grows with a new color determined by the
Using Matlab
Create a script m-file which displays an image variable where the border of the image grows with a new color determined by the users keyboard presses. You should use the waitforbuttonpress command within a while-loop to keep waiting for user inputs. Use the get (gcf, 'CurrentCharacter') expression to obtain the most recently pressed keyboard key. You can assume the user will always press a keyboard key (you do not need to check for mouse clicks). Pressing the R key will grow the image by 2 pixels in both x and y dimensions, where the new pixels around the perimeter are red. The previous image should be displayed inside. Pressing G, or B should have the same affect, except it should add a green, or blue border, respectively. Pressing the Q key should terminate your while-loop. (30 Points)
The program can be initially started with a 1x1 black pixel image. The code below works to add a red border to a 1x1 black image using a temporary variable tmp, and a size variable called N. Every time we wish to grow the image, the dimensions of the image should increase by 2 (since we are adding a 1-pixel border to the perimeter).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
