The first thing in your program should be documentation, such as the following. This should appear at the very top of your program.
% Author: (Your Name)
% Account: (your account name)
% CSc 4630/6630 Program #4
% Due date: (put the due date here)
% (Give a brief description of what your program does.)
% (State what the program inputs are.)
% (State what the program outputs are.)
% (Give an example of how to use your program.)
% (For example: out = myabs(in); )
Verify that the command help hmwk4 shows this information.
This homework is about data visualization.
Remember programming challenge #8? In that, you had to use "ginput" to get two points within an image, crop it according to those points, then show the cropped version. This homework builds on that, so you might want to re-visit your solution.
In this assignment, you are to show a grayscale image to the user, then get 2 pairs of coordinates. Open a new figure, use the "subplot" command (i.e. subplot(2,2,n), where n is the subplot number, 1..4), and show the cropped version of the image. Next, repeat the subplot command (with a different n value), and show the cropped image data as a surface plot (using the "surf" command). Then, repeat the subplot command (with a different n value), and show the cropped image data as a mesh plot (using the "mesh" command). Finally, repeat the subplot command (with a different n value), and show the cropped image data as a 3-D stem plot (using the "stem3" command). Use the "title" command to give each figure an appropriate title, indicating the figure (i.e. cropped, surf, mesh, stem3).
These three commands (surf, mesh, and stem3) each present the data as a 3-D view. You should specify an X and a Y, which are arrays. Let Y be the subset of original image rows (remember, you are only showing some of them, as selected by the user). X contains the subset of original image columns. (For example, if the subimage is rows 40:90 of the original image, Y would be 40:90.) The third parameter, Z, should be the image data, which you need to convert to double (or something else) for surf and mesh.
Let the user specify the filename with the "uigetfile" command. You can test your program with "PICT0009.JPG" from earlier assignments. Your program should convert any image used to grayscale. The "rgb2gray" command can do this for you. Your program should do this for any color image used. How do you know a color image from a grayscale one? The "size" command will return the rows, columns, and depth. A depth of 3 indicates a color image.
Along with the code, turn in a printout of the figure showing the 4 subplots. You may enhance this figure before printing, though indicate what you are doing and why. For example, you might reverse the image, or perhaps make it smaller, in order to make it clearer, or to save ink.
As with all programs:
Your program should work for all possible inputs. Make sure that you test it with several different cases.
Turn In Your Work
The printouts of the above must be handed in at the start
of class. To be considered "on-time", you must
e-mail the TA with the final version of your code before the due date,
and turn in all of the above on-time.
If your work is more than 1 page and not stapled,
it may be returned to you without a grade.
Make sure that your printouts use a monospaced font.