- 1. Load new image
Requests a filename and loads image.
Implement as a function: pic = load_image(filename);
- 2. Crop image
Submenu requests edge to be cropped (1. top, 2. left,
3. right, 4. bottom), and number of pixels to remove and does it.
Implement as a function:
pic_new = crop_image(pic,direction,pixels);
- 3. Scale image
Submenu requests scale_zoom which has valid values from
0.50 - 2.00, where 0.50 would result in the new image having
half the number of rows and columns and 2.00 would result in
the new image having twice the number of rows and columns.
Calculation of new pixels will in general require interpolation.
This operation is sometimes called "resize" and
the new image should look just like the old one but of a different
size.
Implement as a function:
pic_new = scale_image(pic,scale_zoom);
- 4. Edit image
For color images, a submenu requests one of the following: 1. red,
2. green, 3. blue, 4. all.
For grayscale images, this submenu is skipped.
The next submenu requests one of the following:
- 1. Intensity adjust
Submenu requests intensity_adj with valid values from
0.00 - 2.00 where:
new_value = current_value * intensity_adj;
new_value = new_value saturated to maximum of 1.00
A value of intensity_adj=1.00 results in no change.
- 2. Auto-intensity adjust
Same as option #1 except that the scaling is automatically chosen such
that the image's new max value is 1.00
- 3. Contrast adjust
Submenu requests contrast_adj with valid values from
0.10 - 10.00 where:
mid_value = 0.50; % middle of valid pixel values
new_value = (current_value - mid_value)*contrast_adj + mid_value;
A value of contrast_adj =1.00 results in no change.
- 4. Color bringout
This option does not appear for grayscale images.
If user previously selected "all" color and then selects this option,
print an error message
saying, "Error: red, green, or blue color must be selected."
Otherwise, use this algorithm for each pixel:
if pixel has more of the selected color than either of the other two
colors: do nothing
else: convert pixel to grayscale
- 5. Blur image
Submenu requests direction to be blurred (1. left-right, 2. up-down,
3. all directions), and range of pixels to blur (valid range is
0-num_rows or 0-num_cols as appropriate).
For example: 2 (up-down), 5 (pixels): pixel (x,y) new value =
sum of pixels from
((x,y-5)...+...(x,y)...+...(x,y+5)) / 11.
Pixels within 5 rows of the top and bottom of the image have
the values summed and averaged over only the pixels that fall
on the image.
Implement as a function:
pic_new = blur_image(pic,direction,pixels);
- 6. Convert color image to grayscale
Shown on menu only when the current image is color.
- 7. Plot histograms
Plot histograms with intensities showing the full range
with at least 100 "bins". Plot in Figure 2.
For color images, plot red, green, blue histograms as subplots
above each other in a single figure.
For grayscale images, plot a single histogram.
- 8. Undo
Undo last editing command.
Only one level of undo supported.
Option is removed from menu if last command was "undo" or at
beginning before any command has been run.
- 9. Repeat/Redo
This command works in two ways.
1) If the last command was a supported command that makes sense
to repeat (such as "blur" but not "load" or "save"), print
"Repeat" on the menu, and Redo the last editing command if selected.
Do not ask the user for input and just repeat the operation.
2) If the last command was "Undo," print
"Redo" on the menu, and return the image to the state is was
before "Undo" was executed, if selected.
- 10. Save current working image
Requests filename and the image file type (jpeg, gif, png, tiff, bmp)
in a string format. Program continues running after saving.
- 11. Play slideshow
Shows slideshow by fading between jpeg images at a specified rate.
Requests filename of a file with slideshow information: first line
contains the number of images, the second line contains the number
of seconds to show an image unfaded, the third line contains
the number of seconds to fade images in and out, and the remaining
lines contain filenames of images in the local directory.
Images are loaded into an array structure "slides" and then played.
Choose a rate to update image fades that looks good.
Use the pause() command to control timing.
Images of any size must work but all images in
a slideshow will always be the same size.
Here are the contents of an
example file:
5
2
3
beach.jpeg
hiking.jpeg
skiing.jpeg
biking.jpeg
birthday.jpeg
- 12. Exit
Quit program.