Question: Function Name: blur Inputs: 1. ( char ) The file name of the input image, including file extension Outputs: None File Outputs: 1. The output

Function Name: blur Inputs:

1. ( char) The file name of the input image, including file extension Outputs:

None

File Outputs:

1. The output image with 'blur_' appended to the beginning of the filename Banned Functions:

All image functions except imread() and imwrite() are banned for this problem.

Function Description:

Write a function called blur() that takes in an input image and outputs the same image modified with a box blur. In a box blur operation, each center pixel becomes the average of all 9 pixels around it (including itself), for every color layer. Refer to the example operation below for a 3x3 uint8 array.

30 30 30 90 90 90 -> 60 60 60

** ** ** ** 60 ** ** ** **

To determine the color values of the pixels in the output image, follow these steps:

1) Index out a 3x3 piece of the original array, where the middle pixel of the 3x3 piece corresponds to the new pixel.

2) Average the values in the 3x3 array, then set the new pixel to the average value (Do this for each layer of the image separately).

3) Repeat steps 2) and 3) for all 3x3 pieces of the image array.

There are not enough pixels in the original image to calculate the border values. Hence, the output image will have 2 fewer rows (top and bottom rows) and 2 fewer columns (far left and right columns) than the original. Write the resultant image with 'blur_' appended to the beginning of the input image filename. Function Name: blur Inputs: 1. ( char) The file name of the

Example: blur('spongebobImg.png') spongebobImg.png blur_spongebobImg.png

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!