Question: Matlab Assignment This assignment is to make a tool to enhance images. It should reduce red-eye, allow the user to gray-out part of the image,

Matlab

Assignment

This assignment is to make a tool to enhance images. It should reduce red-eye, allow the user to gray-out part of the image, and allow the user to blur part of the image. Allow the user to undo actions, too. These should all be done with a GUI, with a button devoted to each. Your program should save the changes to a separate image file, so that the original is always there. If the user reloads the image, say in a different session, your program should be able to pick up where it left off.

How should the user quit your program? Implement some way to do that.

Your program should do the following.

Red eye Sometimes, when we take pictures, people or animals appear to have red eyes. The user selects a part of the image, typically the eye or eyes of a person, and your program changes the eye colors from red to something natural.

Gray The user selects a part of the image, and your program changes all pixel values to the same value, such as [127, 127, 127]. This could be done for a variety of images, such as creating a border around the image, hiding something in the image, or to make a background for text to be added.

Blur The user selects a part of the image, and your program blurs it. This can be done to show that something is there, but not show exactly what it is. Some receipts will show this, where the last few digits of a number (like a credit card number) are visible, but the other numbers are not. See additional details below.

Undo The user may do several of the above operations, then change his/her mind. Pressing this button should undo the last operation. If the user presses it twice, it should undo the last two operations. Note that an operation means the press of a button. You might select one person's eye on an image, press the red-eye button, then select the other eye, and press the red-eye button again. These are considered two operations. Someone else who has the same image could select both eyes and press the red-eye button. This is considered one operation.

Other Include any other GUI elements that you need.

Your program will need a way to get the image file to work with. Use the uigetfile command to do so. It must work with JPG files, and you can make it work with other formats, if you want. Your program should work with color images.

To select part of the image, your program can use the ginput command. You can super-impose a rectangle over the selected part, to show the user what was selected. Consider the following code. % x = imread('some_color_image.jpg'); r1 = 10 r2 = 196 c1 = 25 c2 = 279 y = x; y(r1:r2, c1:c2, 1:2) = 0; y(r1:r2, c1:c2, 3) = 255; imshow(y) y(r1+2:r2-2, c1+2:c2-2, :) = x(r1+2:r2-2, c1+2:c2-2, :); imshow(y)

Your program will need to use callbacks.

Your program will need to keep track of what the user does. The simplest way to do this is with a matrix, where each row represents an operation. The first number can be a code, like 1 for red-eye reduction, 2 for gray, etc. Other numbers are the start row, start column, end row, and end column. If you need to store anything else, you can do that as additional columns. What if you need 5 columns for red-eye reduction operations, but 6 columns for blur operations? The simple solution is to use 6 columns, but ignore column 6 for red-eye reduction.

Your program should keep the undo data and the enhanced image as separate files. If the original image is "photo1.jpg", you can store the enhanced image and the undo data as "photo1.mat". How do you know if "photo1.mat" exists? exist('photo1.mat')

To solve your problem, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Design your program by specifying its behavior, identifying the variables and operations it needs to solve the problem, and then organizing the variables and operations into an algorithm. Then code your design in MATLAB using stepwise translation. Finally, test your program thoroughly.

Your function should work for all possible inputs. Make sure that you test it with several different cases. Also, your function should include in the header comments the usage, showing a working example.

Make sure to submit both the function and the program for grading. That is, print both out, and be sure to e-mail both of them to the TA.

Make sure, when you e-mail your code to the TA, that you indicate whether you are in 4630 or 6630. Also, this information should be in your header comments.

CSc 4630 students: Use 11 pixels for the blur.

Blurring (or pixelating) is when part of an image is obscurred, such as when a photo contains a license plate or a person's face, and you do not want these to be recognizable. That is, suppose that you use N pixels for the blue. Each NxN square within the area to blur should be replaced with an NxN square where all pixel values are the average.

Suppose that we have a tiny grayscale image, with these values: 1 1 2 3 4 3 0 2 0 4 11 2 6 0 8 0 7 12 The find the blur for 3 pixels, we find x = (1 + 1 + 2 + 0 + 2 + 0 + 6 + 0 + 8)/9 y = (3 + 4 + 3 + 4 + 11 + 2 + 0 + 7 + 12)/9 The image after the blur has this pattern: x x x y y y x x x y y y x x x y y y So the image after the blur is: 2 2 2 5 5 5 2 2 2 5 5 5 2 2 2 5 5 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!